update 19 August 2021

Understanding On-Chain and Off-Chain Blockchain Transactions

Terminologies

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:

  1. The parties involved in the transaction
  2. The commodities/goods/currency being exchanged
  3. The medium: Cash, Digital
  4. The amount being transferred
  5. 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 talking about 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 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 the need for 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. If the currency in the sender’s wallet is above the amount they try to send, the transaction is approved. 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 the 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.

The crypto deposited by both parties is 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 deposits 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 transactions’ authenticity.

On-Chain Vs. Off-Chain

Comparing on-chain and off-chain transactions is not a question of “either-or,” neither 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.

Btc
Bitcoin
$64.157
price
2.71925%
price change
BUY NOW

At the heart of it all, an On-chain Vs. An off-chain guide is one that explains how both transactions work and then show how they work together.

More posts

Earliest Cryptocurrencies with DeFi-like Characteristics

A recent Chainalysis report shows how Europe accounts for 25% of the world's cryptocurrency transactions. The news came as a surprise to many. However, Decentralized Finance (DeFi) is the center of these crypto transactions. So, it takes about 50% of the total amount from the region's trades. DeFi is an innovative niche that many enthusiasts still have not explored fully. Nevertheless, numerous smaller crypto assets with similar characteristics to DeFi tokens already exist. Binance Chain, PancakeSwap, and Uniswap are examples…

Which Altcoins Made The News in H1 of 2021

Altcoins are constantly jostling to make a mark in the crypto world. After Bitcoin and Ethereum, the race to be the third cryptocurrency force keeps heating up every year. Many strong contenders with different use cases promise more than what the big two currently offer. As a result, many are making their mark in a big way, for good and not so good reasons, as long as they stand out from meme coins that ride the celebrity popularity wave and…

Top Altcoins with the Most Potential For 2022

In 2017, altcoins became a thing when thousands of Bitcoin competitors flooded the market. Today, many altcoins have evolved beyond expectations and are stand-alone products with unique real-world applications. Furthermore, they provide an opportunity for investors to diversify their portfolios. Identifying the best cryptocurrencies to invest in can be overwhelming for most newbies, primarily since thousands of them exist. We bet you're having difficulty finding the most promising altcoins in the crypto space. So, this article should help you get…

Institutional Investors who have Expanded their Portfolio in 2021

Cryptocurrency and blockchain investments from the first 9 months of 2021 have surpassed last year's grand total. In the first half of 2021, the worldwide crypto and blockchain activity was $8.7 million, more than double last year's figures. It is a significant sign that institutional money is streaming into the crypto space. Furthermore, it increases the investor base, and thus the institutional awareness and knowledge of this sector are also surging. The "institutional adoption" of crypto is already underway. Today…

Understanding Cardano, IOHK, and EMURGO

Cardano is the first decentralized public blockchain platform that developed on a research-first driven approach. Charles Hoskinson, the co-founder of Ethereum, created it in 2015 and later launched it in 2017. It comprises a development team of global researchers and engineers. This platform's development continued thanks to academics and computer scientists and their peer-reviewed papers. The Cardano ecosystem involves three founding entities that work together. These partners are EMURGO, IOHK Company, and The Cardano Foundation. Cardano in a Nutshell Cardano…

Billionaires Who Have Publicly Showed Interest in Cryptocurrencies

The cryptocurrency boom of 2017 saw a rise in their acceptance from prominent economic figures. Since then, their volatility hasn't stopped significant investments in them. Today there's a push for their global mass adoption. Industry-leading lights and renowned celebrities have expressed their support for the assets. Nothing best captures this reality than Forbes's recent list of the world's wealthiest people. It indicates a growth in the number of crypto billionaires over time. From an asset that courted controversy and skepticism,…

Which is the Most Crypto-Friendly Country in Europe?

When cryptocurrencies made their first appearance in the financial world, many people were skeptical about them. Governments mainly felt threatened because the digital currencies dispelled the need for central banks. A little over a decade later, cryptocurrency mainstream adoption has made strides. However, many jurisdictions remain hostile toward digital currencies.  There's no denying that cryptocurrencies present several advantages, which is why many enthusiasts and investors are jumping on board. However, for mainstream crypto adoption to go globally, jurisdictions must accept…

Crypto Signals to Stop You from Succumbing to FOMO Woes

In the case of cryptocurrency, FOMO is popular due to enormous and rapid gains. However, as more people realize these great opportunities, they are afraid that they will miss them. When you think that you can win a particular cryptocurrency, you begin to buy it in huge numbers. As numerous investors and traders believe that blockchain and crypto are in the early stages and have excellent development potential, FOMO appears to be more than just a driving force in the…

Understanding Ethereum’s Solidity Programming Language

Ethereum is a cryptocurrency capable of storing value and making payments. However, that's not all. It is also a fully-fledged platform for creating smart contracts, and this is where Solidity comes in. Solidity is a high-level language for implementing smart contracts. It gets its inspiration from C++, Python, and JavaScript and should target the Ethereum Virtual Machine (EVM). This article will uncover all about the Solidity programming language and how it works. But first, we'll look closer at the Ethereum…

Hedera – A Comprehensive Guide to a Revolutionary Consensus System

Blockchain is the digital environment supporting cryptocurrencies and decentralized app (DApps). You may know it as one of the greatest innovations of the 21st century. However, this remarkable invention has its shortcomings. For instance, it is difficult to scale and consumes too much energy, making it bad for the environment. Fortunately, some projects aim to solve these issues. One of them, Hedera, has come up with a potentially better alternative to blockchain: Hashgraph consensus. Consequently, Hedera used it to open…