Layer 2 Technology: Optimistic vs ZK
This post aims to conduct research on the development of Solana Layer 2 through Optimistic and ZK rollups.
GitHub: https://github.com/xfactor-toml/solana-L2
1. What is Layer 2?
A layer 2 refers to any off-chain network, system, or technology built on top of a blockchain (commonly known as a layer-1 network) that helps extend the capabilities of the underlying base layer network. Layer-2 networks can support any blockchain to introduce enhancements such as higher transaction throughputs.
One core requirement for a network, system, or technology to be considered a layer 2 is that it inherits the security of the blockchain it is built on top of.
2. The Need for Layer 2s
Coined by Ethereum Co-founder Vitalik Buterin, the blockchain scalability trilemma posits that blockchains are incapable of scaling effectively while keeping the underlying network both secure and decentralized. Instead, there must be tradeoffs between these three features—today’s blockchain networks can fulfill two out of the three conditions, but not all three simultaneously.

To sum up, the limitations of Layer-1 blockchains include:
- Poor scalability
- Low throughput
- Energy-intensive
3. Layer 2 Vital Breakthrough: Rollup
Blockchain rollups are a scalability solution that processes and bundles several transactions off-chain before submitting them to the main blockchain, reducing congestion on blockchain networks.
3.1 Optimistic Rollup
As implied by the name, optimistic rollups operate under the premise that all transactions are legitimate unless demonstrated to be otherwise.
Optimistic rollups only submit the result to the main chain after processing transactions off-chain. The primary chain employs a fraud-proof technique to confirm the legitimacy of the transactions. The transactions are approved if there is no evidence of fraud, but if fraud is detected, the fraudulent transactions are rolled back.

Advantages of optimistic rollups:
- Security derived from the main chain
- Low transaction fees
- Trustlessness
- Good incentive structure
Disadvantages of optimistic rollups:
- Larger transaction finality
- More centralization
- Relies on honest validators and sequencers
Implementations: Arbitrum, Optimism, Boba Network
3.2 ZK(Zero Knowledge) Rollup
ZK-rollups condense transaction data into a succinct proof using zero-knowledge proofs, which is subsequently sent to the main chain. ZK-rollups accomplish this by lowering the quantity of data that must be processed on-chain while preserving transaction security.
Xero-knowledge (ZK) proof is a cryptographic protocol that enables one person (the prover) to convince another (the verifier) that a particular claim is true without disclosing any details about the claim itself.
Zero-knowledge proofs ensure privacy by enabling validators to confirm the accuracy of the transactions without requiring access to the transaction details.

Advantages of ZK rollups:
- Avoids incorrect state changes
- Faster finality periods
- Maintains integrity of decentralization
- Low withdrawal delays
Disadvantages of ZK rollups:
- Expensive hardware requirements can risk chain centralization
- Ethereum Virtual Machine-compatible ZK rollups are expensive
- Centralization may lead to greater censorship
Implementations: zkSync, Polygon Hermez, StarkNet
Conclusion
Rollups present a practical way to increase network capacity, lower transaction costs and improve user experience as blockchain networks expand and encounter scalability issues. Furthermore, rollups are expected to play a bigger role in the DeFi space, where gas fees and large transaction volumes have proven to be major obstacles.