On-chain vs. off-chain. Blockchain ON-chain and OFF-chain. What’s this all about? Is there a difference if data are “on the chain” or off it? I’ll explain!
The terms “on-chain” and “off-chain” refer to the processing and storing of data in blockchain-based systems.
- on-chain is the processing and storing of data on the chain, i.e. directly on the blockchain. This is the standard and classic use of blockchain for reading data and writing blockchain transactions.
- off-chain, L2, or layer two, concerns the processing and storing of data outside the “chain”, i.e. outside the blockchain. The high cost of maintaining the blockchain, in which the recording of data based on transactions is high, has resulted in the development of second layers that aim to relieve the main chain. “Relieve” means offering the possibility of processing and saving data on the second layer instead of on the first layer, i.e. the blockchain.
The second layer is ideally meant to be decentralized and offer transaction security that is equal to the first layer. In addition, the cost of using this layer must be much lower than that of the first layer (to make sense using it), preferably – zero. In practice, achieving these goals is virtually impossible.
What exactly is off-chain? There are currently several specific implementations of off-chain layers, e.g.
- the so-called sidechains, which in practice become separate blockchains. Their relationship with the main blockchain is mainly based on the possibility of transferring funds (e.g. cryptocurrencies), which, depending on where they are meant to be, are blocked on the second chain (so there is no duplication). An example of such a network is, e.g. Liquid Network, a Bitcoin sidechain that was developed by Blockstream.
- commit chains, which are a variation of sidechains. A popular technology here is Matic, the commit chain of Ethereum. Matic uses the first layer, i.e. Ethereum, to secure its chain. Therefore, it is not a classic sidechain and is more or less independent of the main chain.
- payment channels, e.g. the Lightning Network in Bitcoin. Although the Lightning Network creates a network, the very idea of payment channels has existed in the blockchain for some time. In a nutshell, it is about not approving all transactions in the blockchain, but instead only writing the final state to the blockchain in the form of a single transaction. In cases where there is a continuous interaction between e.g. two blockchain participants who make multiple transactions with each other, instead of saving every single transaction in the blockchain, only the last one can be saved, which summarizes the final state.
On-chain vs. off-chain. L2 development is dynamic. The created solutions are more or less related to the main chain, although in the context of security and decentralization – the greater the relationship with the blockchain, the better (greater independence often leads to the creation of separate networks).
I design and build enterprise IT solutions based on blockchain technology.
I am blockchain architect in Trans.eu building ECMR (digital CMR Consignment Note) based on blockchain. I teachabout Bitcoin, blockchain and decentralization via Linkedin and blog: https://mobycrypt.com.