Roo's All-In Giveaway, $300,000 in Prizes
2.4 k views

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:

  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 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.

Bitcoin live price
price change

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.

Stay up to date with our latest articles

More posts

Using Open-Source Protocols for Developing Scalable Solutions on Blockchain

Blockchain technology's safe, transparent, and decentralized transaction platform might transform several sectors. However, building scalable blockchain solutions can be a challenging task.  This short guide will explore how to leverage open-source protocols to develop scalable blockchain solutions. The article aims to make it easier for developers to plan the realization of robust and secure blockchain applications.  Understanding Open-Source Protocols Open-source protocols, such as Ethereum and Hyperledger Fabric, come from organizations and are available for anyone to code for free. Unlike…

From Web2 to Web3 – How to Move an Existing Project to the Blockchain

Web2 and Web3 are two different generations of the World Wide Web. While Web2 is a centralized platform, Web3 is decentralized and powered by blockchain technology.  The success of Web3 has been enormous, with many people now moving from Web2 to take advantage of its benefits.  However, the path to Web3 is not always straightforward. It is complicated and requires a deep understanding of both technologies. Today's guide will ensure you have the right information to successfully move from Web2…

How to Write a Crypto Whitepaper – A Beginner’s Guide

With the rise of cryptocurrency, it's no surprise that many people want to get involved in the industry. But before launching a successful crypto project, one of the most important steps is writing an effective whitepaper. A whitepaper serves as a document that outlines your project and explains its core components and strategies for success. This process may seem daunting and overwhelming for those who have never written a whitepaper. This guide aims to help beginners understand how to write…

Centralized vs. Decentralized Bitcoin and Crypto Mixers

Many people see cryptocurrencies as a way to keep transactions anonymous and private. However, recent reports suggest that most crypto transactions happen on centralized exchanges, leaving user data vulnerable to theft and fraud. The popularity of crypto mixers has been steadily growing as a way to combat this problem. A crypto mixer is an online service that helps mix funds from different crypto wallets and exchanges.  This strategy makes it difficult for anyone to trace the transaction back to the…

Play-to-Earn (P2E) Games – What Are They and How Do They Work?

Regarding Play-to-Earn (P2E) games, there needs to be more clarity about their concept and how they work.  Behind the Huge Play-to-Earn Success: What's the Idea? Play-to-Earn games are a new way of playing games that have recently gained traction in the gaming world. The basic idea behind them is simple: you can play the game and make money. The concept works by allowing players to earn real money or cryptocurrency rewards for completing certain tasks within the game. Among these,…

Smart Contract Security – Pitfalls and Solutions

Smart contracts are becoming increasingly prevalent as the world moves towards a more digital and automated future. Still, they are far from being the panacea of all technological ills. Smart contracts are self-executing contracts with a predetermined set of rules. They are stored on the blockchain and run by computers, which makes them tamper-proof and reliable. However, as with any new technology, smart contracts have associated risks. This article will explore some of the most common pitfalls and how to…

Looking for Crypto Marketing? Here are The Best Crypto Advertising Agencies in 2023

It is vital to have a strong marketing strategy if you wish to succeed in cryptocurrency. This is where crypto marketing agencies come in. You may successfully promote your project and reach your target audience through a crypto marketing agency.  This article will explore the top crypto marketing agencies in 2023. Moreover, we will look at their services and how to choose the right one for your project.  We will also discuss the benefits of using a crypto marketing agency.…

The Risks of Investing in Crypto Projects without Smart Contract Audit

Smart contracts are self-executing contracts that run on blockchain technology. They are stored and verified on the blockchain, which means they are transparent and cannot be tampered with. This makes them a secure way to conduct transactions without needing a third party.  Despite their many advantages, some risks exist with using smart contracts. One such risk is investing in crypto projects that have yet to have their smart contracts audited by a qualified auditor.  With an audit, knowing whether the…

Top Smart Contract Audit and KYC Companies in 2023

It's no secret that business is undergoing fast change. As a result, companies must adapt when new technologies, like smart contracts, emerge to remain competitive. A crucial part of this adaptation process is ensuring compliance with regulations and safety. This is where a company's KYC (Know Your Customer) process or smart contract audit comes into play.  Working with a reputable smart contract auditor or KYC provider ensures your company is compliant. This blog article discusses the benefits of using a…

Top 5 KYC Solutions for Crypto or NFT Projects

As the importance of blockchain technology grows, many people look for ways to get involved in the crypto world. One of the most important aspects of any cryptocurrency or blockchain project is KYC/AML.  Without proper KYC/AML procedures, your project could be at risk for fraud and illegal activities. This article will discuss the types of KYC solutions available and how to choose the right one for your project.  We will also provide tips on how to implement these solutions properly.…