Learning Objectives:
-
Master the fundamentals of rollup technology
-
Understand optimistic rollups and their security model
-
Learn about zero-knowledge rollups and their advantages
-
Analyze the trade-offs between different rollup types
8.2.1: What are Rollups? – Complete Explanation
Definition and Core Concepts
A rollup is a Layer-2 scaling solution that executes transactions off-chain and posts transaction data (or proofs) to the Layer-1 blockchain. This allows for high throughput while maintaining the security of the underlying blockchain.
The key insight of rollups is that transaction execution can be moved off-chain while transaction validation remains on-chain. This reduces the computational burden on the Layer-1 blockchain while maintaining its security guarantees.
Rollups are called “rollups” because they “roll up” multiple transactions into a single batch and submit the batch to the Layer-1 blockchain. This compression dramatically reduces the cost of each transaction.
How Rollups Work:
The basic rollup architecture involves several components. The off-chain component includes a sequencer that collects transactions, orders them, and executes them. The on-chain component includes a smart contract that verifies the validity of the batch.
The process works as follows: users submit transactions to the rollup network, the sequencer collects transactions and orders them, the sequencer executes the transactions and updates the state, the rollup compresses the transaction data into a batch, and the batch is submitted to the Layer-1 blockchain. The Layer-1 smart contract verifies the validity of the batch and updates the state.
The verification mechanism differs between optimistic and zero-knowledge rollups. Optimistic rollups assume that batches are valid by default and rely on fraud proofs to catch invalid batches. Zero-knowledge rollups generate cryptographic proofs of validity for each batch.
Rollup Architecture: ┌─────────────────────────────────────────────────────────────────────┐ │ Rollup Architecture │ │ │ │ Off-Chain (Layer-2): │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ Users submit transactions │ │ │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ │ │ Tx 1 │ │ Tx 2 │ │ Tx 3 │ │ │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │ │ │ │ │ │ │ Sequencer: │ │ │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ │ │ Collects transactions, orders them, executes them │ │ │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ │ │ │ │ State Update: │ │ │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ │ │ New state root after execution │ │ │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ │ │ ┌───────────────────────────▼─────────────────────────────────┐ │ │ │ On-Chain (Layer-1): │ │ │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ │ │ Rollup Smart Contract: │ │ │ │ │ │ Verifies batch validity │ │ │ │ │ │ Updates state │ │ │ │ │ │ Manages withdrawals │ │ │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────────────┘
The Benefits of Rollups:
Rollups offer several significant benefits for blockchain users and developers. They dramatically increase transaction throughput, reduce transaction costs, and maintain the security of the underlying blockchain.
The throughput of rollups can be hundreds or thousands of times higher than the underlying Layer-1 blockchain. This enables new applications that were previously impossible due to throughput limitations.
The cost of rollup transactions is significantly lower than Layer-1 transactions because the cost is amortized across multiple transactions. This makes blockchain more accessible to users with limited funds.
Rollups also maintain the security of the Layer-1 blockchain. The validity of transactions is guaranteed by the Layer-1 blockchain, either through fraud proofs or validity proofs.
8.2.2: Optimistic Rollups – Complete Guide
What are Optimistic Rollups?
Optimistic rollups are a type of rollup that assumes transactions are valid by default. Instead of proving validity upfront, optimistic rollups rely on a challenge period during which anyone can submit a fraud proof to challenge an invalid batch.
The “optimistic” aspect refers to the assumption that batches are valid. This optimism reduces the cost of submitting batches because no expensive proof generation is required. However, it introduces a challenge period during which the validity of the batch can be disputed.
How Optimistic Rollups Work:
The process of optimistic rollups involves several steps. The sequencer collects transactions and orders them, executes the transactions and updates the state, and submits the batch to the Layer-1 blockchain. The batch enters a challenge period, during which validators can submit fraud proofs.
If no fraud proof is submitted during the challenge period, the batch is considered valid and the state is updated. If a fraud proof is submitted, the batch is re-executed on the Layer-1 blockchain to determine validity. If the batch is invalid, it is rejected, and the sequencer is penalized.
The challenge period is typically 7 days, which provides sufficient time for validators to review the batch. This period is long enough to ensure security but short enough to be practical for users.
Optimistic Rollup Process: ┌─────────────────────────────────────────────────────────────────────┐ │ Optimistic Rollup Process │ │ │ │ 1. Transaction Submission: │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ Users submit transactions to the rollup │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ │ 2. Batch Creation: │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ Sequencer collects transactions and creates a batch │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ │ 3. Batch Submission: │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ Batch submitted to Layer-1 with new state root │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ │ 4. Challenge Period: │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ 7-day period for validators to submit fraud proofs │ │ │ │ ┌─────────────────────────────────────────────────┐ │ │ │ │ │ If fraud proof submitted: Batch invalid │ │ │ │ │ │ If no fraud proof: Batch valid │ │ │ │ │ └─────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ │ 5. Finalization: │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ State updated on Layer-1 │ │ │ └─────────────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────────────┘
Fraud Proofs:
Fraud proofs are the security mechanism of optimistic rollups. If a validator detects an invalid batch, they can submit a fraud proof to the Layer-1 blockchain.
A fraud proof demonstrates that a specific transaction in the batch is invalid. The proof must show the exact transaction that is invalid and provide evidence of its invalidity.
Submitting a fraud proof requires a bond to prevent spam. If the fraud proof is successful, the bond is returned, and the validator receives a reward. If the fraud proof is unsuccessful, the bond is forfeited.
Withdrawals in Optimistic Rollups:
Withdrawals from optimistic rollups are subject to the challenge period. When a user wants to withdraw funds, they submit a withdrawal request, and the request must wait for the challenge period to expire.
This withdrawal delay is the primary user experience drawback of optimistic rollups. Users must wait up to 7 days to withdraw their funds from the rollup.
To address this issue, many optimistic rollups use liquidity providers that facilitate faster withdrawals for a fee.
Major Optimistic Rollups:
Arbitrum is one of the most widely used optimistic rollups. It is fully compatible with Ethereum, meaning that existing Ethereum applications can be deployed on Arbitrum without modification.
Optimism is another popular optimistic rollup that is fully compatible with Ethereum. It uses a slightly different fraud proof mechanism than Arbitrum.
Both Arbitrum and Optimism have significant ecosystem development and are widely used by DeFi applications.
8.2.3: Zero-Knowledge Rollups – Complete Guide
What are Zero-Knowledge Rollups?
Zero-knowledge rollups (zk-rollups) are a type of rollup that uses cryptographic proofs to verify the validity of batches. Instead of relying on fraud proofs and challenge periods, zk-rollups generate a validity proof for each batch.
The validity proof mathematically proves that the batch is valid without revealing the underlying transaction data. This allows for instant finality and eliminates the challenge period.
The “zero-knowledge” aspect refers to the fact that the proof reveals no information about the transactions themselves. This provides privacy benefits in addition to scalability.
How Zero-Knowledge Rollups Work:
The process of zk-rollups involves several steps. The sequencer collects transactions and orders them, executes the transactions and updates the state, generates a zero-knowledge proof of validity, and submits the batch and the proof to the Layer-1 blockchain. The Layer-1 smart contract verifies the proof and updates the state.
The zero-knowledge proof is generated using complex cryptographic techniques. The proof must demonstrate that the state transition is valid without revealing the transaction details.
The verification of the proof is computationally lightweight, making it efficient to verify on-chain. This is in contrast to the execution of the transactions themselves, which would be computationally expensive.
Zero-Knowledge Rollup Process: ┌─────────────────────────────────────────────────────────────────────┐ │ Zero-Knowledge Rollup Process │ │ │ │ 1. Transaction Submission: │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ Users submit transactions to the rollup │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ │ 2. Batch Creation: │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ Sequencer collects transactions and creates a batch │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ │ 3. Proof Generation: │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ Zero-knowledge proof of validity generated │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ │ 4. Batch Submission: │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ Batch and proof submitted to Layer-1 │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ │ 5. Verification: │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ Layer-1 smart contract verifies proof │ │ │ │ ┌─────────────────────────────────────────────────┐ │ │ │ │ │ If valid: State updated │ │ │ │ │ │ If invalid: Batch rejected │ │ │ │ │ └─────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ │ 6. Finalization: │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ State immediately updated with no delay │ │ │ └─────────────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────────────┘
Validity Proofs:
Validity proofs are the security mechanism of zk-rollups. The proof mathematically demonstrates that the batch is valid without revealing the transaction details.
The proof is generated using complex cryptographic techniques, such as zk-SNARKs or zk-STARKs. These proofs are computationally intensive to generate but lightweight to verify.
The generation of validity proofs requires significant computational resources, which is a barrier to zk-rollup adoption. However, advances in proof generation are rapidly reducing the cost.
Withdrawals in Zero-Knowledge Rollups:
Withdrawals from zk-rollups are nearly instant because there is no challenge period. Once the batch containing the withdrawal request is verified, the funds are available on the Layer-1 blockchain.
This is a significant user experience improvement over optimistic rollups. Users can withdraw their funds in minutes rather than days.
The instant finality of zk-rollups also enables new applications that require fast settlement, such as high-frequency trading and gaming.
Major Zero-Knowledge Rollups:
zkSync is one of the most widely used zk-rollups. It is compatible with Ethereum and supports a growing ecosystem of applications.
StarkNet is another popular zk-rollup that uses STARK proofs. It is known for its high throughput and scalability.
Loopring is a zk-rollup focused on decentralized exchanges and payments. It supports high-frequency trading and low-cost transfers.
Polygon zkEVM is a zk-rollup that is fully compatible with the Ethereum Virtual Machine (EVM). This allows existing Ethereum applications to be deployed without modification.
8.2.4: Optimistic Rollups vs Zero-Knowledge Rollups
Comparison:
Optimistic vs Zero-Knowledge Rollups: ┌─────────────────────────────────────────────────────────────────────┐ │ Comparison │ │ │ │ Optimistic Rollups: │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ • Security: Fraud proofs │ │ │ │ • Challenge Period: 7 days │ │ │ │ • Withdrawal Time: 7 days │ │ │ │ • Proof Generation: None │ │ │ │ • Computation: Low │ │ │ │ • EVM Compatibility: Full │ │ │ │ • Examples: Arbitrum, Optimism │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ │ Zero-Knowledge Rollups: │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ • Security: Validity proofs │ │ │ │ • Challenge Period: None │ │ │ │ • Withdrawal Time: Minutes │ │ │ │ • Proof Generation: High │ │ │ │ • Computation: High │ │ │ │ • EVM Compatibility: Limited to growing │ │ │ │ • Examples: zkSync, StarkNet, Polygon zkEVM │ │ │ └─────────────────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────────────┘
Trade-offs:
Optimistic rollups have lower computational requirements and are easier to implement. They are also fully compatible with the Ethereum Virtual Machine, making it easy to deploy existing applications. However, they have a 7-day withdrawal delay and rely on fraud proofs for security.
Zero-knowledge rollups offer instant finality and faster withdrawals. They also provide privacy benefits due to the zero-knowledge nature of the proofs. However, they require significant computational resources for proof generation and have limited EVM compatibility.
The choice between optimistic and zero-knowledge rollups depends on the specific needs of the application. Applications that require fast finality may prefer zk-rollups, while applications that prioritize compatibility may prefer optimistic rollups.
8.2.5: The Future of Rollups
Rollup Fragmentation:
One challenge of rollups is fragmentation. Different rollups have different ecosystems, and assets and applications cannot easily move between them.
Several solutions are being developed to address rollup fragmentation. These include cross-chain bridges, shared liquidity protocols, and rollup interoperability standards.
Rollup-as-a-Service:
Rollup-as-a-Service (RaaS) is an emerging trend where platforms provide rollup infrastructure as a service. This makes it easier for developers to deploy their own rollups.
RaaS platforms handle the technical complexity of running a rollup, allowing developers to focus on their applications. This is likely to accelerate rollup adoption.
The Rollup-Centric Ethereum Roadmap:
Ethereum’s scaling roadmap is rollup-centric. The long-term vision is for Ethereum to serve as a secure settlement layer for rollups, with most transactions occurring on Layer-2.
This vision is supported by EIP-4844 (Proto-Danksharding), which introduces blob data for rollups. This will significantly reduce the cost of rollup transactions.
The rollup-centric roadmap is likely to make rollups the dominant scaling solution for Ethereum.