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.
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.
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 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.
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.
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.
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:
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.
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:
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.
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.
Understanding the difference between ZKSnarks and ZKStarks
Understanding Optimistic Rollups
The difference between blockchain scaling solutions: Layer 1 Vs. Layer 2