Blockchain Blockchain Rollups

Optimistic Rollups vs. ZK-Rollups: A Comparison of Layer 2 Scaling Solutions

Optimistic Rollups vs. ZK-Rollups

As Ethereum has evolved into the leading smart contract protocol, it has run up against inherent limits in transaction throughput and gas fees due to its decentralized architecture. This has led researchers and developers to design innovative “layer 2” scaling solutions that improve performance while inheriting the security guarantees of Ethereum layer 1. Two of the most promising rollup technologies to emerge are optimistic rollups and zero-knowledge (ZK)rollups. This in-depth article will compare and contrast these two approaches to scaling.

Introduction to Rollups

The core innovation behind rollups is bundling or “rolling up” transactions off-chain into a compressed singular transaction that is submitted to Ethereum layer 1. This aggregation offers two major benefits:

  • Reduced fees – Transaction costs are amortized across all transfers in the rollup, lowering fees significantly.
  • Increased throughput – Batching can improve throughput up to 100-200x compared to submitting transactions individually to layer 1.

Both optimistic and ZK-rollups build on this general principle of aggregation. However, they vary in their technical implementations and tradeoffs, which we will unpack in detail.

Optimistic Rollups

Optimistic rollups operate under the assumption that all bundled transactions are valid by default. They use an incentive structure and fraud proof challenge period to ensure any invalid transactions will be detected and disputed on-chain.

Here is a deeper look at how optimistic rollups work:

  • Transactions batches execute off-chain and are compressed into a rollup format.
  • The rollup is submitted to Ethereum along with an economic bond. This financially disincentivizes malicious activity.
  • There is a 1 week fraud proof challenge period where anyone can dispute invalid transactions in the rollup.
  • If no disputes occur, the rollup is considered undisputed and therefore valid. The transaction data is permanently recorded on Ethereum.
  • If a dispute arises, only the disputed transactions are exited, while the remainder stay rolled up.

The key innovation is the fraud proof challenge period, which allows invalid transactions to be selectively kicked out without having to validate every single transaction on layer 1. This system unlocks scalability gains while still leveraging Ethereum as the final settlement layer.

Use Cases for Optimistic Rollups

Given the 1 week challenge period, optimistic rollups are better suited for transactions that do not require ultra-fast withdrawal times. They work well for:

  • Decentralized exchanges – settling large volumes of trades
  • Lending protocols – managing long-term loans
  • Stablecoins – transferring tokens that are not time sensitive
  • NFT platforms – no urgent need to instantly withdraw NFTs
  • Complex smart contracts – optimization is more important than speed

Essentially any application that currently faces congestion, delayed confirmation times, or high gas costs on Ethereum layer 1 can benefit from transitioning to optimistic rollups while keeping settlement security intact.

Key Advantages of Optimistic Rollups

  • High scalability – 2000+ TPS demonstrated thus far
  • Low fees – bundling rolls up transaction costs
  • Leverages Ethereum security
  • EVM compatibility – easy for dApps to integrate
  • No limitation on computation – arbitrary logic supported
  • Easy exit mechanism via fraud proofs

Leading providers of optimistic rollup technology include Optimism, Arbitrum, Offchain Labs, Cartesi, Fuel, and ImmutableX. Adoption has grown rapidly with over $3 billion total value locked migrated to optimistic rollups so far.

Zero-Knowledge Rollups

In contrast to optimistic rollups, ZK-rollups rely on advanced cryptographic proofs called zero-knowledge proofs to validate transactions.

Here is how ZK-rollups work under the hood:

  • Transactions execute off-chain and generate a ZK-proof of validity.
  • The proof is published to Ethereum along with any new state updates.
  • Verifiers can efficiently check proofs on-chain to confirm validity.
  • If the proof checks out, new states are accepted with no further validation needed.
  • Users can instantly withdraw funds given validity is pre-proven.

ZK-proofs enable validity to be proven succinctly without revealing any underlying transaction data, allowing for much faster withdrawal times. Users can withdraw their funds in minutes rather than waiting for fraud proof challenges.

Use Cases for ZK-Rollups

The fast withdrawal times of ZK-rollups make them well-suited for applications where latency is critical:

  • DEXs – active traders need fast access to funds
  • Payments – near-instant token transfers
  • Interactive apps – gaming, NFT minting, etc. require responsiveness
  • Oracles – price feeds that must update in real-time
  • Auctions – fast bidding and ability to withdraw funds

Any use case where deep interactivity or fast exits from layer 2 are crucial can benefit from the performance gains of ZK-rollups.

Key Advantages of ZK-Rollups

  • Ultra-fast withdrawal times – minutes rather than days
  • Predictable, consistent withdrawal times
  • Privacy preservation due to zero-knowledge
  • Theoretical 5000+ TPS based on math proofs
  • No need to monitor the chain for dispute periods

Leading teams building out ZK-rollup technology include Loopring, zkSync, Starkware, Matter Labs, Aztec Network, and Scroll. Adoption is still earlier but accelerating quickly.

Side-by-Side Rollup Comparison

Metric Optimistic Rollups ZK-Rollups
Withdrawal Speed ~1 week via fraud proofs Minutes via ZK validity
Transaction Privacy None High via zero-knowledge
Computation Support Anything Constrained by ZK proofs
Current TPS 2000+ 3000+ expected
Typical Fees Low Low-Medium

Development History and Timelines

Optimistic rollups were first conceptualized in a 2018 whitepaper by John Adler and Mikhail Vladimirov. The first production implementation was developed by Optimism team and launched on Ethereum testnets starting in 2020.

In contrast, ZK-rollups trace their history back even further to ZK-SNARK cryptography invented in the late 2000s. The first ZK-rollup testnets were launched in 2018, pioneered by Loopring.

Both technologies accelerated greatly throughout 2020 and 2021, with over $5 billion in total value locked (TVL) migrating to rollup-based protocols looking to scale while retaining Ethereum’s security. Momentum and adoption continue to grow quickly.

The Future Outlook

Analyzing technology trends and incentives suggests optimistic rollups and ZK-rollups are likely to co-exist serving different use cases rather than compete directly. Here are some potential developments on the horizon:

  • Hybrid rollups – Combining ZK speed with optimistic flexibility.
  • Interoperability – Assets and data transferred seamlessly between rollups.
  • Specialized rollups – Optimized for specific functions like NFTs.
  • Generalized rollups – Spanning across multiple L1s.
  • Enterprise usage – Banks and businesses leveraging rollups.
  • Formal verification – Mathematical proofs of correctness.
  • Decentralized sequencers – Making rollup operators more permissionless.

Both research communities are innovating rapidly, and the overall layer 2 ecosystem will continue expanding.

Comparing Rollups to Other Scaling Approaches

There are several broad categories of Ethereum scaling solutions currently in development:

  • Plasma chains operate similar to rollups but with certain limitations around exit timing and flexibility. Rollups improved upon Plasma’s ideas.
  • State channels like Raiden optimize specifically for asset transfers rather than general computation. This makes them fast and cheap for payments but with narrower uses.
  • Sidechains are separate companion blockchains that peg into Ethereum. They allow more flexibility but with potential decentralization and security tradeoffs.
  • Sharding splits the Ethereum blockchain itself into partitions. This offers strong composability between shards but is highly complex to implement at the base protocol layer.

Overall, rollups strike a productive balance between scalability, decentralization, and security while leveraging Ethereum mainnet protections.

Conclusion

In summary, both optimistic and ZK-rollups represent promising innovations to help scale Ethereum without compromising on decentralization or security. They accelerate transaction throughput and reduce fees by optimistically or cryptographically bundling transactions off-chain and posting validity proofs to Ethereum layer 1.

Optimistic rollups are likely to gain adoption for applications like DEXs, loans, and stablecoins where week-long withdrawal times are acceptable. ZK-rollups will shine for use cases like gaming, NFTs, and payments requiring instant withdrawals.

As rollup technology continues maturing, Ethereum is poised to scale orders of magnitude beyond its current capacity while retaining censorship resistance and trust minimization. This helps unlock its full potential to serve as the base settlement layer for billions of daily transactions across industries. Overall, rollups enable layer 2 innovation anchored by the soundness and reliability of layer 1.

FAQs

Q: How do fees compare between layer 1 and rollups?

Rollups can reduce fees 10-100x compared to submitting transactions directly to Ethereum layer 1, owing to transaction batching.

Q: Are on-chain smart contracts needed to use rollups?

No, existing smart contracts can work with rollups out-of-the-box without modifications by bridging assets and data.

Q: Do I need to monitor rollups for misbehavior?

For optimistic rollups yes, but ZK-rollups no since validity is pre-proven.

Q: How do rollups affect Ethereum’s roadmap priorities?

Rollups buy time for core protocol improvements like sharding to be carefully implemented and tested.

Q: Can rollups interoperate or share liquidity?

Cross-rollup bridges are in development to transfer assets and contract calls between rollup silos.

Q: How will users access rollups?

Wallets and interfaces will increasingly integrate support for interacting seamlessly with layer 2.

Q: Are rollup transactions final?

Yes, they inherit Ethereum’s settlement guarantees once fraud proofs expire or proofs are validated.

Q: What prevents rollup operators from cheating?

Financial slashing incentives and public verifiability prevent malicious behavior.

Q: How does Ethereum security underpin rollups?

Ethereum mainnet provides validity proofs, fraud proofs, and layer 1 checkpoints.

Q: Which layer 2 solution is the “best”?

They all have tradeoffs. Projects should examine use cases and pick the optimal fit.