Layers of Blockchain

July 1, 2024

When we talk about blockchain, most people refer to layer 1 blockchains, such as Ethereum, Bitcoin, Cardano, etc. They maintain their own network of nodes via a shared consensus mechanism (e.g., PoW, PoS, etc.) to process fundamental operations. We all know that. So, in this paper, I will focus on Layers 0, 2, and 3. Let's start with the basic one.

Layer 0

Layer 0s help us build Layer 1 blockchains. They provide the fundamental requirements, such as networking, consensus mechanisms, transaction validity controls, etc. You only need to focus on the main functionality you want to build. 

The most common Layer 0s are Cosmos and Polkadot. Follow this tutorial to learn more about Cosmos and build a chain!

Layer 2

There is a trilemma called the blockchain trilemma. It states that a blockchain architecture needs to choose between decentralization, security, and scalability. Ethereum and Bitcoin prioritize the former two aspects, so scalability inevitably takes a backseat.

The Blockchain Trilemma

With the increasing interest in Layer 1s, who chose decentralization and security, they become a playground for the rich because of the basic supply/demand relationship.

The block size and the number of transactions that can be accepted in a block are limited. This means that if demand increases and supply stays fixed, the price will increase.

You might ask, "Can't we increase the block size?" Increasing block size slows the network. Nodes need to reach a consensus for much larger data. One solution to this problem is Layer 2s.

There are different types of L2s, but their purpose is the same: to reduce the load on the main chain. Think of the main chain as a boss whose desk is overflowing with paperwork (validating and executing transactions). A Layer 2 blockchain is an efficient assistant who takes the bulk of the workload to their desk (L2 network) to process.

However, the final approval still comes from the boss. So, the assistant sends the processed paperwork back to the boss, who adds it to the final ledger upon approval. In other words, the transactions processed on the L2 network are added to the main Ethereum blockchain when approved.

Some L2 types are:

  • Sidechains: Independent blockchains with native tokens and consensus mechanisms whose purpose is to help scale the main network. They connect to the parent blockchain using a two-way bridge that enables users to move assets to and from the main chain. However, there's no real transfer of assets between the two chains. SIdechains use something called a two-way peg. A smart contract locks up assets on the main chain and mints a mirror image of the tokens on the sidechain. The value of these new assets is pegged to the assets on the main chain. But, you must trust the integrity of the side chain network and the bridge network that connects it to the main blockchain.
  • Rollups: Instead of processing transactions individually, bundles of transactions can be "rolled up" into a single transaction, vastly increasing the number of transactions that can be processed at once. The transactions are outsourced to be recorded off-chain, bundled, and then brought onto the main chain to process as a single entity. 
  • State Channels: Similar to a side chain, as transactions are recorded off-chain, but these transactions are recorded in bulk off-chain, and then the state of the channel is set at complete. The transactions are then recorded in bulk on the main blockchain network by broadcasting a completed "state" to the main network. This is how Bitcoin's Lightning Network is set up.

Layer 3

L3s work in the same way as L2s, but they use an L2 as a main chain instead of L2. Arbitrum - Technical I will dive deep into Arbitrum to give an example of how L2s work. You should know that Arbitrum is an Optimistic Rollup. This means transactions are accepted as valid until "someone" proves they are not.

References

  • What Are Ethereum Layer 2 Blockchains and How Do They Work? | Ledger
  • Built on top of Ethereum, Layer 2 blockchains help speed up transaction processing while keeping the costs down for the…www.ledger.com
  • https://www.investopedia.com/what-are-layer-1-and-layer-2-blockchain-scaling-solutions-7104877