Envisioned with their desires in mind, Evertwine stands tall on four mighty pillars: integrated tokenomics, NFTs, staking and yield farming, backed by cutting-edge protocols. Together, these elements forge a path towards a smoother and more refined user journey, accommodating players of all expertise levels, and embracing both newcomers and seasoned veterans of card game mechanics and blockchain game trading. At Exordium, inclusivity is their guiding principle. They strive to create a fair and vibrant ecosystem where every individual can forge…
Understanding On-Chain and Off-Chain Blockchain Transactions
To ensure thorough comprehension, here are some cryptocurrency terminologies and what they mean as used in this guide:
- Node (blockchain node): Computers connected to the network that store a full copy of the ledger and process transactions, i.e., miners
- Wallet: a software or hardware + software container for keeping, sending, and receiving cryptocurrency.
- Protocol: a set of rules that govern how nodes or computers in a system communicate with one another.
- Ledger: Decentralized database or record of transactions. Used interchangeably with blockchain
Introduction to Transactions
All events that involve the exchange or transfer of goods, services, money, or value are called transactions. Transferring money between two bank accounts is a bank transaction. Buying a sandwich is a transaction between a buyer and a seller.
Simple transactions are straightforward and occur between two parties, while complex transactions may involve multiple steps and include several intermediaries. Nonetheless, however complex or simple a transaction is, they all follow the same basic principles.
Much of the same rules that govern transactions in the “real world” also apply to blockchain transactions. And to fully understand what on-chain and off-chain transactions are and their differences, you must first understand the basics of transactions and how they work on a blockchain.
The Nature of Transactions
Every transaction is comprised of a few elements. These elements are better viewed as information that must be available for a smooth event. They include:
- The parties involved in the transaction
- The commodities/goods/currency being exchanged
- The medium: Cash, Digital
- The amount being transferred
- The direction of the transaction: From who to whom
For example, Josh wants a sandwich. He walks up to Carlos (who is at his sandwich shop on the side of the road) and buys a sandwich. Josh gives Carlos $5 and, in return, is handed a delicious sandwich. Josh then walks away while Carlos goes about his business.
In the scenario above, Josh and Carlos are the parties involved. The Sandwich and $5, or a $5 Sandwich, are the commodities being exchanged. The medium is cash. The amount exchanged is $5. The direction of the cash transfer is from Josh to Carlos, i.e., (Josh → Carlos).
Another example: Susie sends $300 to her mom in Denver via a bank transfer. Susie and her mother are the transacting parties, with the bank standing in as a facilitator. Since the transaction is electronic, the medium is digital, the amount is $300, and the direction is Susie →, her mother.
While some transactions have more elements and conditions—for example, Susie’s bank might charge a transaction fee while Carlos won’t charge Josh any transfer fees—they all have the same basic elements.
These transactional elements and rules apply to on-chain and off-chain transactions. However, when it comes to cryptocurrency transactions, another element comes into play.
On-chain Transactions
On-chain transactions are regular transactions made on a blockchain. They can be called native transactions or just “transactions” when discussing a particular blockchain. Native here means they are endemic to a blockchain and are the natural way to make transactions.
A textbook definition is that they are transactions carried out and made available on the blockchain and, as such, are valid only when published/declared on the blockchain.
On-chain transactions are easier to understand when you keep in mind that a blockchain is a distributed public ledger comprised of blocks of completed transactions and nodes that process, check, and publish these transactions to the ledger.
Sending cryptocurrency, like Bitcoin, from one public address to another is an on-chain transaction. The transfer is processed, checked, and cleared by nodes (or miners), and the transaction is published on the blockchain, much like regular financial transactions.
However, as straight forward this may sound, several other processes are going on in the background.
How On-Chain Transactions Work
Blockchains are built on certain rules of engagement, called protocols, that all transactions must obey. These rules vary from one blockchain to another, so what constitutes an on-chain transaction on one blockchain may not apply to another. In essence, on-chain transactions are determined by the protocols of the blockchain.
To fully understand on-chain transactions, look at how transactions on the bitcoin blockchain are processed.
The bitcoin blockchain network was built primarily to send money from one wallet to another without needing a central authority or middleman like a bank. It does this by combining cryptography, distributed networks, and a ledger to ensure that payments are sent directly from one party to another.
Transactions are processed and published in blocks every 10 minutes and each block, 1Mb in size, consists of transactions. When a payment is sent, the network first checks if the sender is authorized to send the payment by checking their wallet. The transaction is approved if the currency in the sender’s wallet is above the amount they try to send. If not, the transaction is declined.
For the bitcoin network to maintain its security, nodes must prove the authenticity of the transactions they process by providing proof of work. This proof is called a consensus protocol, i.e., a set of rules determining what transactions should be processed.
The bitcoin network achieves this consensus by creating a hard cryptographic puzzle that all nodes or miners must compete to solve. This puzzle can only be solved by iteration (trial and error), which requires brute computational power.
The first node to solve this puzzle gets to process all the transactions in a block, after which all other nodes verify the transactions. After verification, the winning node publishes the block to the blockchain, gets rewarded with bitcoin, and all other nodes update their copy of the ledger.
On-chain transactions on the Bitcoin network are highly unscalable. Nodes waste a lot of energy competing to solve a cryptographic puzzle, not to mention the 10 minutes they take to process transactions. This system is too slow and inefficient to cater to enterprise and global demand, and to cater to this problem, off-chain transactions were created.
Off-Chain Transactions
Off-chain transactions resulted from the need for fast micro-transactions that were just not possible with on-chain transactions; for example, waiting 10 minutes to pay for a cup of coffee is too slow. Also, transaction fees charged for microtransactions were often higher than the amount being transferred, which is unsustainable.
In response to this, off-chain transactions utilize a layer 2 network on top of the blockchain to transfer value, information, or currency faster between parties. These transactions are not usually published on the blockchain.
A great example of a layer 2 network for off-chain transactions is the Lightning network. The Lightning Network, built on the bitcoin blockchain, allows fast micro-transactions between parties by creating “channels” between nodes. Bitcoin is transferred between parties through these channels at much faster speeds than on-chain transactions.
How Off-Chain Transactions Work (The Lightning Network Example)
The Lightning Network requires a multi-signature address to facilitate transactions between parties on a channel. This address allows more than one private key to sign off/approve transactions. When two parties use the Lightning network, they use channels created between nodes, along with a transaction balance sheet.
Both parties need to deposit an amount of BTC in the multi-sig wallet; the sum of both deposits must be greater than 0 BTC, and this initial deposit is published on the blockchain to ensure transparency.
Both parties’ crypto deposits are recorded on the balance sheet as each’s initial balance. Whenever a transaction is made, the balance sheet is updated, and both parties sign off on it with their private keys.
The amount exchanged between nodes on the network cannot be summed up to more than the initial deposit as more crypto isn’t added to the initial deposit but instead transferred from one node to the other.
At the end of the exchange or business, the final signed balance sheet is sent to the blockchain. The blockchain nodes verify the balance sheet and process it, and the amount in the multi-sig address is disbursed to the parties in the proportion stated on the final balance sheet.
Note that just as there are nodes and users—which are separate entities—on the blockchain, there are also nodes and users on the Lightning network. Nodes on the Lightning network download the LN software and create channels between themselves and other nodes, while users have wallets that send and receive payments on the network.
Practical Application
Josh sets up a subscription service on the Lightning network that rents ownership of Crypto Kitties for 0.010 BTC, and Kayla is a Crypto Kitties collector who wishes to subscribe to Josh’s service. If they were nodes, Kayla would deposit 0.5 BTC in the multi-sig address, while Josh would deposit 0 BTC as he is the seller and does not offer refunds.
The sum of deposits on the multi-sig wallet is 0.5 BTC, 0.5 BTC allocated to Kayla, and 0 BTC allocated to Josh.
When Kayla buys one Kittie, 0.010 BTC is deducted from Kayla’s balance and added to Josh’s. Every transaction creates an updated balance sheet that both parties sign with their private keys.
When either party chooses to opt out of the agreement at the end of the transaction, the most recent version of the balance sheet is sent to the blockchain, verified by miners, processed, and published.
According to the final balance sheet’s values, the multi-sig address funds are then disbursed to the parties.
This removes the need for processing every micro-transaction on the blockchain, thereby radically enhancing speed, scalability, and efficiency. It also reduces the transaction load that nodes must process and helps mitigate the ledger’s growing size.
However, off-chain transactions do not automatically inherit the blockchain’s immutability, and steps must be taken to ensure the transactions’ authenticity.
On-Chain Vs. Off-Chain
Comparing on-chain and off-chain transactions is not a question of “either-or,” nor is it about one being superior. Instead, both methods of resolving transactions work in tandem to make blockchain networks faster, more efficient, and suitable for enterprise use.
Without on-chain transactions, off-chain networks would be detached from the blockchain, defeating the whole purpose of having a blockchain. And without off-chain transactions, blockchain networks like bitcoin would be too slow and inefficient to cause any real disruption.
At the heart of it all, an On-chain Vs. An off-chain guide explains how both transactions work and then shows how they work together.