As the adoption of blockchain technology grows, scalability has become a pressing concern for significant networks like Ethereum. Due to high traffic in the network, which results in higher transaction fees and low speed, the rise of Layer 2 solutions like roll-ups has sprung up to solve this scalability issue.
Rollups are akin to adding express lanes next to a congested highway (the Ethereum main chain). These express lanes (Layer 2 solutions) process transactions off-chain and submit results to the main chain, thereby increasing throughput(the rate at which a blockchain processes transactions, reducing latency, and lowering fees. Rollups do not only solve network congestion but also ensure decentralization and security.
This article explores two popular roll-ups, Optimistic Roll-Ups and ZK-rollups (Zero-Knowledge Rollups), and examines how Ethereum and Base, a Layer 2 network developed by Coinbase, leverage them for scalability.
Understanding Rollups
Rollups are types of scaling solutions that post transactions to Layer 2. They are designed to address high transaction fees and slow speeds associated with blockchain networks. Due to the Ethereum network’s limited data bandwidth, users often face expensive gas fees, especially during periods of high demand. Scaling the network without moving everything off-chain is a challenge. This is where rollups come into play.
Rollups are one of the most secure methods for scaling Ethereum. They leverage the security of the Ethereum network by keeping some data on-chain, while taking the computational work off-chain to layer 2 protocols.
This method can increase transaction throughput. These technologies achieve this by using smart contracts to process transactions outside the Ethereum network, then compressing and batching transactions before publishing the results back on-chain. These batches include the transaction data, the state of the previous batch, and the updated data after processing.
Security is a concern for users, as such rollups implement methods to ensure transactions are processed correctly and without malicious activity. Different types of rollups use various verification methods to maintain trustworthiness, making them a reliable option for scaling Ethereum.
Layer 2 vs Layer 1
- Layer 1 is the core layer where transactions are verified, blocks are mined, and security is maintained. Examples include Bitcoin, Ethereum, and Cardano. Due to the large volume of transactions, layer 1 blockchains are limited in scalability and speed, leading to higher fees and slower performance.
- Layer 2 solutions address these issues by offloading some transaction off-chain processing from the Layer 1 blockchain. They operate as extensions to Layer 1, processing transactions externally while maintaining the same security and decentralization. They rely on the security framework of the Layer 1 blockchain. For example, Base is a layer 2 solution built on Ethereum to reduce transaction fees and speed up the process.
Where do Rollups come into play? Rollups are an advanced Layer 2 solution that processes transactions off-chain and submits them back to Layer 1. There are two types: Optimistic Rollups and ZK Rollups.
ZK-Rollups Explained
ZK Rollups stands for zero knowledge. It uses validity proofs, which provide immediate proof to Ethereum that the batches of transactions are correct. To do this, ZK Rollups use ZK-SNARK (Zero-Knowledge Succinct Non-Interactive Argument of Knowledge) or ZK-STARK (Zero-Knowledge Scalable Transparent Argument of Knowledge) a mathematically complex cryptographic proof that verifies all computations in a batch corresponding to the post-state root before sending them to the main chain.
This method requires more computational power, making ZK rollups more costly than optimistic ones.
ZK rollups interact with Ethereum in the following way:
-
Data Availability: ZK rollups publish compressed state data for every transaction on Ethereum as calldata. This ensures transparency and allows anyone to reconstruct the rollup’s state independently.
-
Transaction Finality: ZK rollups achieve faster finality compared to optimistic rollups. Transactions are considered final once the validity proof is verified on Ethereum, eliminating the need for a challenge period.
-
Censorship Resistance: While ZK rollups often use a centralized operator, users can submit transactions directly to the rollup contract on Ethereum if they suspect censorship
-
State Commitments: The ZK rollup’s state is represented as a Merkle tree, with the root hash stored in the on-chain contract.
-
Efficient Withdrawals: There are no delays when moving funds from a ZK rollup to Ethereum, as exit transactions are executed once the ZK rollup contract verifies the validity proof.
How ZK Rollups Work on Ethereum
ZK rollups use cryptographic proofs by bundling numerous transactions into a single proof submitted to the Ethereum blockchain. This process enhances throughput while ensuring the security and integrity of the underlying data.
1. Transaction Aggregation
In ZK-rollup, users submit their transactions to a rollup operator(the supernode), who aggregates these transactions off-chain. This aggregation allows for bundling hundreds or even thousands of transactions into a single batch, significantly reducing the workload on the Ethereum main chain.
2. Proof Generation
Once the transactions are aggregated, the rollup operator generates a zero-knowledge proof. This proof is a cryptographic representation that verifies the validity of all transactions in the batch without revealing any specific details about them. The most common type of zero-knowledge proof used in this context is zk-SNARK (Zero-Knowledge Succinct Non-Interactive Argument of Knowledge), which is compact and efficient.
3. On-Chain Verification
The generated proof, along with a new state root representing the updated state of the rollup after processing the batch, is submitted to an on-chain smart contract on Ethereum. This contract verifies the proof and updates the state accordingly. If the proof is valid, it confirms that all transactions within the batch were executed correctly.
Advantages of ZK-Rollups
- Scalability: ZK rollups can increase transaction throughput by processing transactions off-chain and only submitting proofs on-chain.
- Cost Efficiency: Users benefit from lower gas fees since multiple transactions are batched together.
- Security: ZK rollups inherit Ethereum’s security model, ensuring that transactions are processed off-chain but remain secure and verifiable.
- Speed: ZK-Rollups allow for immediate withdrawals once the proof of validity is verified.
Optimistic Roll-up Explained
Optimistic Rollups operate on the principle of presumption of innocence, using fraud proofs. This means they assume all the batches(transactions) they send to the network are valid; hence, the name is optimistic. Instead of cryptographic proofs, Optimistic Rollups rely on validators to monitor batches on-chain and check their validity.
Optimistic rollups typically process transactions using a centralized node or entity called a sequencer. This enhances scalability by bundling multiple transactions before submitting them to the Ethereum main chain(Layer 1). The sequencer must deposit significant ETH as collateral to deter fraudulent behavior when submitting batches.
Note: The term operators is often used interchangeably with sequencers in the context of Base and other Optimistic Rollups.
If a sequencer submits a fraudulent batch, part of that deposit is burned, and part is rewarded to the fault prover. Every time a sequencer publishes a batch, there is a dispute period during which any party can present fraud-proof showing that the batch is invalid and should be reverted.
However, optimistic rollups face delays in transaction finality, requiring users to wait through the challenge period (up to a week) before withdrawing funds.
Additionally, centralized sequencers pose potential censorship and security risks, although efforts are being made to decentralize these sequencers. Solutions to mitigate these risks include introducing crypto-economic penalties for malicious behavior or implementing fair ordering mechanisms through consensus protocols.
How Optimistic Rollups Work on Base
Optimistic rollups represent another Layer 2 scaling solution that operates under different assumptions than ZK rollups. They rely on an “optimistic” approach, where transactions are presumed valid unless proven otherwise.
They process transactions off-chain and submit aggregated data to the main blockchain. Base, built on the OP Stack, uses this technology to reduce gas fees and increase transaction speeds.
1. Transaction Aggregation
Users submit their transactions to operators, also known as validators, sequencers, or aggregators. These operators are responsible for processing the transactions within the optimistic rollup. The operator collects multiple transactions, aggregates them into batches, and compresses the underlying data before publishing this batch on the mainchain.
Unlike ZK rollups, there is no upfront proof generation; transactions are processed immediately based on an assumption of validity.
2. Assumption of Validity
Once submitted, these transactions are executed off-chain by the rollup operator. The optimistic rollup assumes all transactions are valid and updates their state accordingly without requiring immediate verification. After processing, the sequencer publishes the compressed transaction data(calldata or blobs) and the new state root to the Ethereum mainnet.
3. Challenge Period
To maintain security, optimistic rollups incorporate a challenge period where other validators can dispute a transaction’s validity. If a challenge occurs:
- The system reverts to a verification process.
- A fraud-proof mechanism is triggered to validate or invalidate the disputed transaction.
- If the transaction is proven invalid, sequencers face penalties, which may include losing part of their collateral deposit and corrective actions are taken to restore the state to what it should have been before the invalid transaction was processed.
4. Finality and Settlement:
Transactions are considered finalized once the seven-day dispute period has elapsed without any challenges or if all disputes have been resolved. At this point, the final state of the transactions is settled on the Ethereum mainchain (Layer 1), updating the global state of the blockchain. This process ensures that the main chain reflects an accurate and up-to-date network state, incorporating all effects from executed transactions.
5. User Withdrawal
After finalization, users can initiate withdrawals of their funds back to the main Ethereum chain. To do this, users must provide a Merkle proof demonstrating their balance in the finalized state. The Base contract on Ethereum verifies this proof and releases the funds to the user, completing the transaction process.
Advantages of Optimistic Rollups
- Speed: Transactions can be processed quickly since they do not require immediate proof generation.
- Simplicity: The architecture is more straightforward than ZK-rollups, making it easier for developers to implement.
- Cost Efficiency: Users can benefit from lower fees as fewer computational resources are used upfront.
- Compatibility with Smart Contracts: Optimistic rollups support complex smart contracts similar to those on Ethereum.
Current State of Rollups on Ethereum and Base
The current state of rollups on Ethereum and Base showcases significant advancements in Layer 2 scaling solutions. ZK and optimistic rollups are gaining traction, with several projects making notable progress.
ZK-rollups are making waves in the Ethereum ecosystem, with several prominent projects leading the charge:
- zkSync: This ZK-rollup solution has gained considerable attention for its EVM-compatible zkEVM. zkSync aims to provide high throughput and low fees while maintaining Ethereum’s security
- StarkNet: Developed by StarkWare, StarkNet utilizes STARK proofs to achieve scalability. It offers a permissionless decentralized ZK-rollup operating as an L2 network on Ethereum.
- Polygon zkEVM: Polygon’s zero-knowledge Ethereum Virtual Machine (zkEVM) is designed to be fully compatible with existing Ethereum smart contracts, making it easier for developers to migrate their projects.
While Base leverages optimistic rollups to scale Ethereum, ZK-rollups and optimistic rollups are making significant strides in addressing Ethereum’s scalability issues. ZK-rollups are gaining ground due to their potential for higher security and faster finality. However, optimistic rollups continue to attract developers and users due to their EVM compatibility and lower complexity.
Optimistic Rollups vs ZK-Rollups: A Comparative Analysis
Final Thought
While Ethereum continues to enhance its Layer 1 performance, Layer 2 solutions like Base are critical for near-term scalability. Base complements Ethereum’s rollup strategy by leveraging Optimistic Rollups to address high transaction fees and slow speeds for decentralized applications.
Further Reading
Understanding the difference between ZKSnarks and ZKStarks
Understanding Optimistic Rollups
The difference between blockchain scaling solutions: Layer 1 Vs. Layer 2