Blockchain Blockchain Rollups

Rollups Explained: A Guide to Blockchain Rollups

Blockchain Rollups

Blockchain rollups are layer 2 scaling solutions designed to help scale blockchain networks like Ethereum by handling transactions off the main chain (layer 1) while storing transaction data on the chain. The key goals of rollups are to reduce fees, increase throughput, and enhance scalability.

There are two main types of rollups:

ZK-Rollups

ZK-rollups or zero-knowledge rollups bundle hundreds of transactions together and generate a cryptographic proof known as a SNARK (succinct non-interactive argument of knowledge). This proof is posted to layer 1 along with the new state root.

  • Validators on layer 1 can easily verify the proof without needing to check all the underlying transactions. This means a large number of transactions can be compressed into a compact cryptographic proof.
  • ZK-rollups offer better security than optimistic rollups but limit the types of computations that can be done to simple transfers, swaps, and other pre-defined transaction types.

Optimistic Rollups

Optimistic rollups decompress the transactions on layer 2 and run the computation. The transaction data is posted to layer 1, but the state root updates only if someone challenges the proposed new root.

  • They assume transactions are valid by default and only run computations on layer 1 when there is a dispute. This improves efficiency.
  • However, since validity is only checked in the event of a dispute, there is some risk of fraud. Users must wait for a window of time before withdrawing funds to allow disputes to arise.

Some of the key benefits of rollups:

  • Reduced fees – By bundling/compressing transactions, fees are amortized across hundreds of transfers keeping costs low.
  • Increased throughput – Rollups can process more transactions per second than layer 1 since computation is done off-chain.
  • Preserves security – Funds always remain on layer 1. Cryptographic proofs guarantee integrity of layer 2 state.

There are a few rollup implementations already live on Ethereum including Optimism, Arbitrum, zkSync, Loopring, Starkware, and Matter Labs zkPorter.

How Do Rollups Work?

At a high level, rollups are constructed with three components:

Layer 1 Chain

The base blockchain layer (e.g. Ethereum) serves as the security anchor and settlement layer. Rollup transactions originate from and finalize back to layer 1.

Layer 2 Computational Network

This is where transaction execution happens. For ZK-rollups, computation is done off-chain before generating the validity proof. For optimistic rollups, computation runs on layer 2.

Bridge Contract

The bridge enforces consensus by storing transaction data on layer 1. It verifies proofs (for ZK rollups) or can initiate dispute resolution (for optimistic rollups).

Here is the basic workflow:

  1. Many transactions are bundled off-chain.
  2. ZK-rollups generate a validity proof. Optimistic rollups run computation and submit results.
  3. Proof or transaction data gets sent to the bridge contract on layer 1.
  4. Bridge contract verifies the proof (for ZK) or stores transaction data for dispute resolution (optimistic).
  5. Users can withdraw funds from layer 2 via the bridge after finality window.

For ZK-rollups, the proof is verified without checking underlying transactions. This allows a high degree of scaling while ensuring validity through cryptography.

Optimistic rollups assume validity of layer 2 computation but can check results on-chain if needed. This improves efficiency but has risk of inaccurate states.

Advantages of Rollups

Here are some of the key benefits that rollups provide:

  • Lower fees – By bundling hundreds of transfers into a single transaction, fees are amortized substantially.
  • Faster throughput – Computations happen off-chain so transaction speed is no longer limited by layer 1.
  • More scalability – Compressing transactions or running computations off-chain allows more throughput.
  • Leverages layer 1 security – Rollups depend on layer 1 for security guarantees so funds remain secure.
  • Supports layer 2 innovation – Rollups enable experimentation with layer 2 designs and features.
  • Allows complex computation – ZK-rollups support pre-compiled transactions. Optimistic rollups have EVM compatibility for more flexibility.

Overall rollups represent a major scaling advancement that maintains the security of layer 1 while improving cost, speed, and capacity of transactions.

Limitations of Rollups

However, there are some limitations of Rollups to be aware of:

  • Fund locking – Assets moved to layer 2 cannot be immediately withdrawn back to layer 1. Users must wait for challenge period.
  • Bridging delays – Moving assets between layer 1 and 2 requires bridging which can take time depending on activity.
  • Censorship risks – Operator of optimistic rollups could theoretically censor transactions before posting to layer 1.
  • Future proofing concerns – If Ethereum changes from proof-of-work to proof-of-stake, some rollups may need to alter designs.
  • Limited general computation – ZK-rollups only allow pre-defined transaction types. Optimistic rollups have more flexibility but not as much as layer 1.
  • Proving times – SNARKs for ZK-rollups can take significant time to generate depending on computational complexity and required trust assumptions.

Overall rollups represent a major advancement but still have limitations in flexibility, bridging latency, and withdrawals. Technology and research is rapidly evolving to address these limitations.

ZK-Rollups Explained

Here is a more in-depth look at ZK-rollups and how they work:

Overview

ZK-rollups bundle hundreds of transfers off-chain and generate a SNARK (succinct non-interactive argument of knowledge) as cryptographic proof of validity. This proof is posted to layer 1 along with new state root.

SNARKs

SNARKs are a form of zero-knowledge proof that use homomorphic encryption and bilinear pairings to generate a short proof that transactions are valid without revealing any other information.

They are constructed using probabilistically checkable proofs (PCPs) that convert a validity statement into a polynomial form that can be efficiently verified.

Workflow

  1. Transfers initiated on layer 2 and new state root calculated.
  2. SNARK generated to prove state root is valid based on transfers.
  3. SNARK posted to layer 1 along with new state root via bridge contract.
  4. Contract verifies proof efficiently using public inputs.
  5. Users can instantly withdraw funds from layer 2 using the verified state.

Withdrawals

The ability to withdraw immediately is a key advantage since funds are never locked for challenge period.

Pros and Cons

Pros:

  • Strong security guarantees and instant withdrawals due to validity proofs.
  • Very scalable since proofs are succinct and easy to verify.

Cons:

  • Limited to simple pre-compiled transaction types due to proof generation constraints.
  • Proving time can be slow depending on complexity.

Overall, ZK-rollups offer superior security assurances via validity proofs but have constraints on transaction types.

Optimistic Rollups Explained

Here is an overview of how optimistic rollups work:

Overview

With optimistic rollups, transactions run on layer 2, and data is posted to layer 1. State root updates only if no fraud proof challenges result.

Workflow

  1. Transactions executed on layer 2 computational network.
  2. Transaction data compressed and submitted to layer 1.
  3. Bridge contract stores data and updates state root if no challenge.
  4. Users can withdraw funds to layer 1 after challenge period passes.

Fraud Proofs

If invalid state transition is detected, anyone can submit a fraud proof to layer 1 contract to dispute. The contract resolves the dispute computation on-chain.

Challenge Period

Users must wait for the challenge period before withdrawing funds to layer 1 in case disputes arise.

Pros and Cons

Pros:

  • General computation on layer 2 since EVM compatible.
  • Fairly efficient since data not fully verified on layer 1.

Cons:

  • Funds locked during challenge period before withdrawal.
  • Requires dispute resolution mechanism for security.

Optimistic rollups offer more flexibility but need challenge periods for security.

Current Rollup Implementations

Here is the completed table with additional rollup implementations:

Rollup Type Launched Throughput Tokens Supported
Arbitrum Optimistic 2020 2,000+ TPS Any ERC-20
Optimism Optimistic 2020 200-1,000 TPS Any ERC-20
zkSync ZK-rollup 2019 500-800 TPS ETH, ERC-20, NFTs
Loopring ZK-rollup 2019 2,025 TPS ETH, ERC-20, NFTs
Aztec ZK-rollup 2022 300-500 TPS Any asset
Starkware ZK-rollup 2019 2,500 TPS Any asset
dYdX ZK-rollup 2021 Up to 10,000 TPS ETH, ERC-20
ImmutableX ZK-rollup 2021 9,000 TPS NFTs
Fuel Labs Optimistic 2021 4,000 TPS Any asset
Offchain Labs Optimistic 2019 1,000-10,000 TPS Any asset

Some things to note:

  • Throughput figures are estimates and vary based on usage levels and computation required.
  • zkSync 2.0 plans to add general computation similar to Starkware.
  • Many rollups focus on NFTs and trading due to high gas costs (ImmutableX, Loopring).
  • Starkware uses STARK proofs instead of SNARKs for validity proofs.
  • Fuel Labs uses a hybrid ZK and optimistic approach.

Rollup technology is advancing rapidly with implementations optimized for different use cases. Scalability continues to improve as designs evolve.

Rollup Security Considerations

While rollups offer better scalability, they have some unique security properties to understand:

Trust Assumptions

ZK-rollups require trusting the operator to construct proofs correctly. Failures could lead to invalid state roots.

Optimistic rollups trust operators will post data to layer 1. Censoring transactions could block withdrawals.

Validity Proofs

ZK-rollups have stronger security since state transitions are cryptographically proven valid. Does not rely on potential disputes.

Data Availability

Optimistic rollups security depends on data being available on layer 1 to check if needed. Historical data access could be an issue.

Bridge Contracts

Bridge contracts that coordinate consensus between layer 1 and 2 must be well-audited and free of bugs that could be exploited.

Withdrawal Delays

Optimistic rollups require challenge periods for withdrawals making funds illiquid and potentially exposed to issues during that time.

Operator Slashing

Rollup designs should penalize operators for uptime failures, censorship, or other misbehavior via slashing deposits.

Overall, while rollups improve scalability, they have security tradeoffs to be aware of compared to layer 1. Proper incentives and slashing are important to ensure correct operator behavior.

Rollup Future Outlook and Development

Rollups are an active area of research and development in the Ethereum community. Here are some innovations in progress:

Generalized Validity Proofs

Making ZK proofs more flexible to support generalized computation like optimistic rollups is being explored, such as with zkEVM.

Faster Proof Generation

New SNARK constructions like PLONK aim to make generating proofs faster and more efficient.

Hybrid Designs

Combining ZK and optimistic approaches can help optimize for cost, speed, and security based on transaction type.

Cross-rollup Communication

Allowing assets and messages to be exchanged directly between different rollup networks can improve composability.

Rollup Chains

Chains of interconnected rollups can further increase scalability where lower layers handle larger transaction volumes.

Optimized Bridging

Faster withdrawal speeds and liquidity for moving between layer 1 and 2 is being researched with bridges 2.0 designs.

Data Sharding

Sharding historical rollup data across nodes could improve availability for fraud proofs and withdrawals.

As rollup adoption increases, research is rapidly evolving to address limitations around withdrawals, liquidity, proofs times, and composability between different layer 2 systems.

Conclusion

Rollups such as ZK-rollups and Optimistic rollups provide a major breakthrough in scaling Ethereum while leveraging the security of the base layer. By moving computation and data storage off-chain, they offer superior throughput and lower gas fees.

However, tradeoffs exist around security assumptions, withdrawal locking, and flexibility. Innovations in cryptography, hybrid designs, and composability will continue to advance rollups. Overall, rollups are a key part of Ethereum’s roadmap for meeting demand and cementing its position as the dominant smart contract blockchain.