What Is Layer Two (L2)?
There are three types of L2s:
L2 Blockchains Explained
Think of the layer one blockchain as a highway connecting city A and city B. The highway has a capacity of 1,000 cars. If more than 1,000 cars come on the highway, travel time will extend, and the toll booths will increase fees due to the high demand.
To meet the high demand and reduce travel costs and time, a special bus lane is built alongside the highway. The introduction of buses allows a single vehicle to transport a large number of people in a single trip. Travel between the cities is now faster and cheaper. In this analogy, the bus service is the layer two blockchain.
How Do Layer Two Blockchains Work?
L2 blockchains help L1 blockchains to scale by processing transactions separately. The L2 processes and validates transactions off-chain and posts only the finalized proofs on the base chain. As a significant number of transactions are offloaded, congestion on the base layer is reduced, resulting in lower gas fees and faster transactions.
In turn, the L2 depends on the L1 for security, data availability, and decentralization. The L2 is connected to the L1 via a bridge. Users will have to bridge their cryptocurrencies to be able to access their funds on the L2.
Why Are Layer Two Blockchains Important?
Blockchains are designed with three primary principles: decentralization, security, and scalability.
However, as blockchain networks grow, it is forced to prioritize two properties and sacrifice the third. This concept is also known as the “Blockchain Trilemma” as coined by Ethereum co-founder Vitalik Buterin.
In the case of Ethereum, it prioritizes decentralization and security. Hence, Ethereum suffers from the “Scalability Trilemma.”
Ethereum is the most popular smart contract blockchain in the world. The blockchain hosts a vibrant decentralized finance (DeFi) ecosystem, popular non-fungible token (NFT) collections, blockchain games, and more. However, the popularity of Ethereum has caused its network to overload on multiple occasions resulting in transaction congestion and high gas fees.
Ethereum aims to side-step this problem by using layer two blockchains for scaling.
3 Types of Layer Two Blockchains
Channels refer to private payment channels created off the main chain between two parties. These channels allow participants to transfer crypto to each other without paying any gas fees.
They are typically created using a smart contract that exists on the base blockchain. These channels are protected by multi-signature addresses, which require all parties to sign a contract update.
Once the contract is set up, participants can transfer cryptos. Participants will only pay gas fees when submitting the state of the channel on the main blockchain.
Lightning Network, which is a Bitcoin-based L2, is an example of a channel.
A plasma chain refers to a blockchain managed by a smart contract that processes transactions off-chain. Each plasma chain has a centralized actor called an “operator”. The operator batches plasma transactions off-chain and generates a cryptographic verification element called a Merkle tree for those transactions.
The Merkle root of the tree is published on the main chain for verification purposes.
Rollups are blockchains that bundle hundreds of transactions off-chain and submit them to the main chain as a single transaction. L1 gas fees are distributed across several transactions resulting in cheaper gas fees for the end user.
Rollups inherit the security of the L1 blockchain as transaction data are posted on the L1. Having the transaction data on the L1 chain makes it immutable and allows anyone to process operations and detect fraud in the rollup.
Furthermore, Ethereum Virtual Machine (EVM) compatibility of rollups lets Ethereum-based applications migrate from Ethereum L1 to rollups without having to rewrite the code.
The versatility of rollups has made it the preferred layer two solutions for scaling Ethereum.
Layer Two Rollups Explained
There are two types of layer two rollups that are being developed to scale Ethereum:
- Optimistic rollup
- Zero-knowledge (ZK) rollup
An optimistic rollup is a layer two blockchain that assumes that all the transactions on the chain are valid. The rollup is ‘optimistic’ about the honesty of the participants and bundles transactions and submits it to the L1 without checking its validity.
Users can challenge suspicious transactions within a time window called the challenge period. A fault proof is run to check the validity of the suspected transactions. Users cannot move their funds out of the optimistic rollup during the challenge period.
Examples of optimistic rollups are Optimism, Arbitrum One, and Boba Network.
A ZK rollup is a layer two blockchain that computes transactions off-chain and submits validity proofs of the transaction to the main chain. Unlike optimistic rollups, ZK rollups check the validity of each and every transaction. This allows users to move their cryptos out of a ZK rollup immediately after the transaction is finalized.
However, gas fees on ZK-rollups are higher than optimistic rollups due to the expensive computing hardware required in the former.
Examples of ZK rollups are Scroll, ZKSync, and Polygon zKEVM.
L2s are transforming the blockchain landscape by enabling scalability, faster transactions, and improved user experiences.
However, L2s come with limitations and flaws. Many L2 solutions bear centralization risks, have trust assumptions, and are not cheap enough for mass adoption. This is a development that needs close monitoring.