Layer 1 and Layer 2 Blockchains
L1 blockchain is a “main” or “primary” blockchain that provides the foundation for other blockchains to build upon. An example of an L1 is Bitcoin.
Layer 2s are secondary frameworks or protocols that run on top of a Layer 1 blockchain, often called side-chains. For example, the Lightning Network is a Layer 2 for Bitcoin.
Layer 2s usually offload transactions from the Layer 1 chain, batching them to save on costs while maintaining security by posting the results back to Layer 1.
The key difference between an L1 and L2 is that L1 is a platform for decentralized applications, while L2 extends L1's functionality, allowing for application scaling and additional features.
Rollups
Rollups are Layer 2 scaling solutions designed to improve the scalability and efficiency of blockchain networks by processing transactions off-chain. Rollups bundle multiple transactions into a batch, reducing costs and enhancing speed.
Why Do We Need Rollups?
As blockchains grow in user interaction, congestion can lead to high gas fees and slow transaction times. Rollups help by offloading computation from the Layer 1 chain, making transactions faster and more affordable.
How Rollups Work
- Off-chain processing: Most transaction computations occur off-chain on the Rollup.
- Batch submission: Transactions are compressed into a single batch and submitted to L1.
- Security via Layer 1: Proof data is posted back to L1, ensuring transaction security.
Types of Rollups
Rollups come in two main types: Optimistic Rollups and ZK-Rollups. These differ in their security and verification approaches.
1. Optimistic Rollups
- Assumes all transactions are valid but has a challenge period for dispute resolution.
- Fraud Proofs: Challenges trigger fraud proofs to verify transaction accuracy.
- Examples: Arbitrum and Optimism.
Advantages: High throughput, cost savings. Disadvantages: Potential delays due to challenge period.
2. ZK-Rollups (Zero-Knowledge Rollups)
- Uses zero-knowledge proofs for each transaction, removing the need for a challenge period.
- Examples: zkSync, Loopring, StarkNet.
Advantages: Fast finality, secure transactions. Disadvantages: More complex, computationally expensive.