Breakdown of Rollups — Layer 2 Scaling Solution

Parichaya Thanawuthikrai
Valix Consulting
Published in
8 min readNov 6, 2023

As the utilization of Ethereum has been steadily growing, the limitations faced by Ethereum Layer 1 have brought scaling solutions on stage.

The scaling solutions are crucial for achieving Ethereum's vision of faster transactions (speed) and reducing network congestion (high transaction throughput) without sacrificing security or decentralization.

Ethereum Layer 2 scaling solutions refer to a group of Ethereum scaling solutions designed to extend Ethereum while retaining the security guarantees of Ethereum.

This article breaks down the Rollups, which currently stand out as the most influential scaling solution implemented in Ethereum.

Table of Contents

  • Rollups — The Ethereum Layer 2 Scaling Solution
  • Optimistic rollups
  • Zero-Knowledge Rollups / ZK rollups
  • Optimistic rollups vs Zero-Knowledge Rollups
  • Summary

Rollups — The Ethereum Layer 2 Scaling Solution

Rollups aim to create the general-propose scaling solution while retaining security through native Ethereum security, entirely relying on the Ethereum consensus.

Rollups perform transaction data computation outside of the Ethereum main chain (Layer 1) and then bundle multiple transactions into a single transaction before submission to the main chain. Once submitted, the validation process confirms the accuracy of the computations and the validity of the transactions.

“You can think of rollups like opening a tab. Instead of paying for items you order individually, you can bundle your purchases and pay for them all at once when you close out your tab. A rollup is like a tab. It bundles multiple transactions at once. When it’s time to close out, you settle your bill with the restaurant’s payment processor, just like rollups settle their transactions on the Ethereum network.”

What Scaling Etherem Means For you by Uniswap

How does a Rollup work?

The Rollup introduces an on-chain smart contract to facilitate depositing, withdrawing, and verifying proofs.

Through this, the Rollup recomputes the Merkle tree using on-chain data and maintains the Merkle root of the state of the rollup, called a state root.

How do a Rollup work? (1)
An Incomplete Guide to Rollups: https://vitalik.ca/general/2021/01/05/rollup.html

To publish a batch or bundled transaction, participants have to provide the previous state root (pre-state root) and the new state root (post-state root), which is the result of re-computing the Merkle root after processing the transactions.

How do a Rollup work? (2)
An Incomplete Guide to Rollups: https://vitalik.ca/general/2021/01/05/rollup.html

Once published, the Rollup contract verifies the match between the incoming giving previous state root (pre-state root in the batch transaction), and its current one (state root in the Rollup contract). If they pass the verification, the Rollup contract then updates the state root to the new state root.

Additionally, the Rollup contract manages depositing and withdrawing tasks. Deposits are executed when a batch transaction includes assets from an outside, those assets need to be transferred to the Rollup contract. Conversely, if a batch transaction includes assets out to an outside, the Rollup contract processes the withdrawal of those assets.

However, what if someone submits a batch with an incorrect post-state root?

This question leads us to explore the two main types of Rollup solutions: Optimistic Rollups and ZK Rollups. Let’s dive into them in the next sections.

Optimistic rollups

Optimistic rollups are controlled by smart contracts deployed on Ethereum. Those smart contracts are responsible for storing rollup blocks, tracking state updates, and managing user deposits. They operate on the assumption that all transactions within the rollup are valid without requiring proof of validity.

To support this assumption, Optimistic rollups utilize fraud proofs, allowing anyone to challenge a state transition during a specified challenge period. If a dispute arises, the proof is submitted to demonstrate that the data in a batch is fraudulent, and then the rollup initiates fraud proofs.

A simplified breakdown of how Optimistic Rollups work:

  • Validator Processing:

Validators or operators bundle user transactions off-chain into batches and compress this transaction data as calldata, and then submit it to Ethereum.

  • Fraud Proofs:

During the challenge period, other validators can spot an incorrect transaction, and then they can initiate challenges and compute fraud proofs for that transaction.

Upon receiving the fraud proof, the suspicious transaction is re-executed on Ethereum Layer 1 to confirm that it is indeed fraudulent.

  • The Sequencer:

In certain optimistic rollups, a sequencer, different from a regular validator/operator, manages transaction execution.

The sequencer has greater control over transaction orders and exclusive access to bundle user transactions and submits these bundles to the on-chain contract.

  • Incentive mechanism:

Validators wishing to submit transactions or fraud proofs in Optimistic rollups have to provide a bond as an assurance of their honesty.

Rewards and penalties are based on the outcome of challenges. If a validator submits a fraudulent transaction or incorrect fraud proofs, they risk having their bond slashed as a penalty.

Security Considerations:

  • Centralized concerns as sequencers can gain control over a bundle transaction or influence transaction ordering.
  • Smart contract vulnerability is present as utilizing smart contracts to perform crucial operations can contain bugs and vulnerabilities
  • The security depends on having at least one honest node that performs rollup transactions and submits fraud proofs to challenge any incorrect state transitions.

Zero-Knowledge Rollups/ZK rollups

Zero-knowledge rollups are similar to Optimistic rollups as they execute user-submitted transactions outside of the Ethereum main chain and then send them as a single transaction onto the Ethereum main chain.

Zero-knowledge rollups utilize a validity proof (aka. Zero-knowledge proof), allowing anyone to prove the correctness of off-chain state transitions and submit only the finalized transactions without re-executing them on Ethereum.

Furthermore, let’s consider the simple concept of validity proof or Zero-knowledge proof. Think of the `Wordle` game, where a player can prove that they have the solution without revealing what the solution is, and everyone can confidently agree that they have the correct result.

A simplified breakdown of how Zero-Knowledge Rollups work:

  • Validator Processing:

Validators or operators bundle user transactions off-chain into batches, compress this transaction data, and compute the validity proof over the user transactions, before submission to the Ethereum main chain. This involves publishing the compressed data as calldata.

  • Validity proofs:

Zero-knowledge rollups use validity proofs (ZK-SNARK or ZK-STARK) to prove the correctness of the statement without revealing the statement itself. Consequently, re-execution processes become unnecessary, as these proofs instantly confirm the validity of finalized transactions on Ethereum Layer 1.

  • The Sequencer:

In certain Zero-knowledge rollups, a sequencer is the only entity responsible for processing the transactions and producing the Layer 2 blocks, which are then rolled up into the Zero-knowledge contract.

Security Considerations:

  • Centralized concerns arise when sequencers can gain control over a bundle transaction or influence transaction ordering.
  • Smart contract vulnerability is a concern as the Rollup uses smart contracts to perform crucial operations, which can contain bugs and have vulnerabilities
  • Producing validity proofs requires a trusted setup and specialized hardware requirements. Mishandling these elements could potentially compromise a ZK-rollup’s security model and encourage centralized control of the chain by some groups of parties.

Optimistic rollups vs Zero-Knowledge rollups?

The comparison of Optimistic rollups and Zero-Knowledge rollups is as follows:

An Incomplete Guide to Rollups: https://vitalik.ca/general/2021/01/05/rollup.html

Let’s summarize which method stands out for each property:

  • Fixed Gas Cost per Batch:

Optimistic rollups have a lower fixed gas cost per batch (~40,000) compared to ZK rollups (~500,000).

  • Withdrawal Period:

ZK rollups offer faster withdrawal times, only requiring waiting for the next batch, whereas Optimistic rollups have a longer withdrawal period, approximately a week.

  • Complexity of Technology:

Optimistic rollups are known for their lower technological complexity, while ZK rollups involve higher complexity due to the zero-knowledge technology.

  • Generalizability:

Optimistic rollups are easier to generalize, especially for general-purpose EVM rollups closer to mainnet deployment, whereas ZK rollups face challenges in proving general-purpose EVM execution with ZK-SNARKs, though ongoing efforts aim to improve this.

  • Per-Transaction On-Chain Gas Costs:

ZK rollups have lower per-transaction on-chain gas costs, especially when data is used just for verification, while Optimistic rollups result in higher costs as data needs to be published for potential fraud proof checks.

  • Off-Chain Computation Costs:

Optimistic rollups have lower off-chain computation costs but demand more full nodes for computation, whereas ZK rollups face higher costs, particularly for ZK-SNARK proving in general-purpose computation, potentially being much more expensive than direct computation.

Summary

The article provides a breakdown of Ethereum Layer 2 Rollups scaling solutions, focusing on Optimistic and Zero-Knowledge (ZK) Rollups.

Rollups are a powerful Ethereum scaling solution, facilitating the support of general-purpose EVM code and providing an easy migration for existing applications.

Rollups operate through off-chain transaction processing before submitting the validated transaction to the main chain. Optimistic Rollups ensure transaction correctness by relying on fraud proofs, whereas Zero-knowledge Rollups achieve the same through validity proofs.

Author Details

Parichaya Thanawuthikrai, Senior Blockchain Security Auditor and Consultant.

About Valix Consulting

Valix Consulting is a blockchain and smart contract security firm offering a wide range of cybersecurity consulting services. Our specialists, combined with technical expertise, industry knowledge, and support staff, strive to deliver consistently superior quality services.

For any business inquiries, please contact us via Twitter, Facebook, or info@valix.io.

Resources

  • Ethereum Layer 2: Link
  • Ethereum Scaling Solutions: Link
  • Optimistic Rollups: Link
  • Zero-Knowledge Rollups: Link
  • What are Zero-Knowledge Rollups (ZK-rollups): Link
  • An Incomplete Guide to Rollups: Link
  • How secure are Layer 2 rollups?: Link
  • ETH Scaling 2: How the Op Rollup and Zk Rollup Work: Link
  • ZK-rollup projects: Inner workings, importance & analysis: Link

--

--