Comparison of Optimistic Rollups and ZK-Rollups

5tGG...kNBo
18 Dec 2023
85

As Ethereum continues to struggle with high gas fees and limited scalability due to inherent blockchain constraints, layer 2 scaling solutions have emerged as a promising approach to drive wider adoption. Rollups are one category of layer 2 solutions that bundle or ‘roll up’ transactions off-chain before sending aggregated data back to the main Ethereum blockchain. This helps address scalability and cost issues.

The two main types of rollups taking off today are Optimistic Rollups and Zero-Knowledge (ZK) Rollups. They share the goal of increasing transaction throughput and reducing fees, but utilize different mechanisms to provide security guarantees around fund custody while off-chain. Understanding the nuances between the two is critical for developers building rollup-based applications and for users leveraging rollup technologies.

High Level Comparison


At the most basic level, Optimistic Rollups and ZK-Rollups have some key similarities and differences:

Similarities:


  • Improve scalability by processing transactions off the main Ethereum chain
  • Bundle/roll up transactions into a single transaction for efficiency
  • Create economic incentives to behave honestly off-chain
  • Data is posted back to mainnet via transaction calldata


Differences:


Security Model

Optimistic: Fraud proofs - players are assumed honest until proven otherwise
ZK Rollup: Validity proofs - all off-chain activity is cryptographically proven valid

Latency

Optimistic: 1 week fraud proof window means withdrawals take 1 week
ZK Rollup: Withdrawals are faster as validity is pre-proven

Computation

Optimistic: Minimal computation
ZK Rollup: Heavier computation for validity proofs

While they share the same end goal, Optimistic Rollups and ZK-Rollups get there in very different ways. Next we’ll do a deep dive into how each one works under the hood.

How Optimistic Rollups Work


Optimistic Rollups take an “optimistic” approach (as the name implies) to transaction validity. They operate under the assumption that all transactions bundled off-chain are valid, leaning on an incentive structure to financially discourage malicious behavior.

Here is how Optimistic Rollups work step-by-step:

1. Many transfers between users are bundled/rolled up into a single transaction. This compresses many transfers down to one for efficiency.

2. This transaction is submitted by an entity called the Operator to an Optimistic Rollup smart contract on Ethereum

3. The contract assumes all bundled transfers are valid and updates account balances accordingly

4. There is a 1 week challenge period where others can dispute the transaction if they detect foul play

5. If there are no disputes, funds from the assumed valid transaction are released to users after 1 week

6. If there is a dispute, the challenger triggers what's called a "fraud proof" - they must provide data proving invalid transactions

7. All counterparties in the disputed transactions then execute something called a "bisection search” to determine the validity of each transfer

8. Transfers found to be invalid result in slashing and loss of staked funds by the Operator as punishment

This structure heavily incentivizes the Operator to faithfully execute transactions, as they have their own funds at risk if caught cheating. The one week withdrawal delay allows for the fraud proof process before users can move funds.

The key innovation that makes this possible is the concept of fraud proofs - the ability to prove after the fact that a transaction was fraudulent. This eliminates the impossible requirement of validating every transaction before it happens, while still ensuring security.

Next let's look at how ZK-Rollups achieve scalability and security guarantees.

How ZK-Rollups Work


In contrast to Optimistic Rollups, Zero Knowledge Rollups take a validity proof approach. Using advanced cryptographic techniques, ZK-Rollups generate mathematical proofs that guarantee all off-chain transaction activity is valid before submitting any data to Layer 1.

Here is how ZK-Rollups operate:

1. Transfers between users are bundled off-chain, similar to Optimistic Rollups.

2. Then Merkle roots and validity proofs are generated via zkSNARK cryptography to prove all transactions in the bundle are valid.

3. These proofs entirely remove the need for fraud proofs or dispute resolution, as validity is pre-established.

4. The proofs plus a Merkle root of user balances are submitted to Ethereum. No transaction calldata is published.

5. Anyone can regenerate the proofs to independently validate transaction validity off-chain.

6. If valid, smart contracts update user balances on-chain via the Merkle root.

7. Users can immediately withdraw updated balances since dispute is impossible.

All computationally intensive verification work is done off-chain via zkSNARK proofs. This allows a ZK Rollup to squeeze thousands of transfers into a single Ethereum transaction, while still mathematically guaranteeing correctness. User funds remain secured on Ethereum at all times until withdrawal.

Now that we’ve seen how each type of Rollup works at a technical level, what are the advantages and disadvantages of each approach?

Optimistic Rollup Advantages


Here are some of the key advantages of using an Optimistic Rollup solution:

1. Censorship Resistance

Since transaction calldata is posted to Layer 1, this data is highly censorship resistant and visible on chain. ZK Rollups have more centralization risk as validators can theoretically suppress transactions by not generating proofs.

2. Simple & Flexible Protocol

The fraud proof process used by Optimistic Rollups is simple to implement. This makes the solution adaptable across EVM-compatible chains. ZK Rollups require complex SNARK circuits.

3. Low Computation Requirements

Operators can bundle large volumes of transactions with little overhead. Costly cryptographic proofs are not necessary to post data on-chain.

4. High Data Availability

With transaction calldata directly posted on Ethereum, the risk of data availability issues is low. ZK Rollups rely on operators to publish validity proofs off-chain.


Optimistic Rollup Disadvantages


Here are a few of the disadvantages to consider with Optimistic Rollups:

1. 1 Week Withdrawal Time

The Fraud Proof withdrawal period means it takes 1 week for settled funds to be withdrawn by users. ZK Rollups do not have this restriction.

2. Validity Delays

Dispute resolution eats up extra time if transactions are disputed. ZK Rollups pre-prove everything valid before submitting to mainnet.

3. Slashing Risks

Operators have to lock up capital in case they need to be slashed after a fraud proof reveals invalid transactions.

4. Requires Dispute Infrastructure

A network of nodes must actively monitor dispute opportunities and verification games. This raises infrastructure costs. ZK Rollups do not need watchtowers.


ZK Rollup Advantages


ZK Rollups introduce breakthrough validity proofs to the rollup recipe. Here are advantages unique to ZK Rollups:

1. Faster Withdrawals

Withdrawals only take minutes as all transactions have pre-verified validity proofs. Optimistic Rollups require 1 week fraud proof window.

2. Strong User Privacy

Since raw transaction calldata stays off-chain, user privacy is stronger compared to data posted on Ethereum by Optimistic Rollups.

3. Censorship Detection

Merkle roots on Ethereum allow for censorship detection. Missing account roots indicate potential suppression of proofs for disputes.

4. Deep Validation Every Batch

All off-chain activity is cryptographically proven valid before anything gets submitted to Layer 1. Users enjoy stronger security guarantees.

5. Greater Data Compression

ZK proofs further compress transactions, allowing more to fit inside a single batch. This raises throughput higher than Optimistic Rollups.


ZK Rollup Disadvantages


However, ZK Rollups also come with some downsides:

1. Computational Overhead

Generating zkSNARK circuits requires heavy computation and time. This raises operating costs for operators.

2. Commercial Unproven

As cutting edge technology, ZK Rollups remain commercially unproven versus battle-tested Optimistic Rollups running in production today.

3. Protocol Inflexibility

Integrating ZK proofs requires deep architecture changes. This reduces flexibility versus plug-and-play Optimistic Rollups across EVM environments.

4. Centralization Risks

Operators could theoretically censor transactions by refusing to generate proofs. Though detection mechanisms offset this risk.

5. Spark Vulnerability

Research into zero knowledge proofs is ongoing. Any weaknesses found in the math could undermine validity guarantees.


Now that we’ve dove into the differences on security models, performance, and more - what does this mean for practical considerations when building on rollups?

Design Considerations for Rollup Solutions


When evaluating Optimistic Rollups vs ZK Rollups for your project, keep these design factors in mind:

Speed to Market

If faster time-to-launch is critical, Lean towards Optimistic Rollups with battle-tested infrastructure already specialized for rapid deployment.

Enterprise Usage

If business logic requires complex contract interactions, Optimistic Rollups provide more flexibility for customization without zk proof constraints.

Censorship Risks

If censorship resistance is paramount, Optimistic Rollups offer stronger guarantees as operators cannot suppress transaction calldata posted publicly.

User Privacy

If privacy is critical, ZK Rollups keep transactions fully encrypted off-chain for greater secrecy over public data from Optimistic Rollups.

Computation Budget

If your application requires billions of transactions, Computationally-cheaper Optimistic Rollups allow bundling higher volumes per batch within budget.

Withdrawal Needs

If users require instant withdrawals, ZK Rollups allow minutes-fast withdrawals while Optimistic support 1 week fraud proof windows.

These are just a few examples of key considerations when assessing the rollup approach best suited for your use case. Next let’s look at some live examples of Optimistic vs ZK Rollups.


Live Application Examples


To see these rollup technologies in action, several Ethereum-based protocols leverage Optimistic Rollups while ZK Rollup adoption is nascent:

Optimistic Rollups Usage


1. Synthetix and dYdX for Assets

These protocols use Optimistic Rollups to scale trading in synthetic assets and derivatives. The technology enabled over $7B in monthly transaction volume.

2. Immutable X for NFTs

Immutable X harnesses StarkWare’s Optimistic-style Cairo Rollups to allow instant minting and trading of blockchain gaming NFT assets with over 7M transactions.

3. Reddit’s Community Points

Reddit leverages Arbitrum’s Optimistic Rollup for scaling tokens and points systems across its site including 250M+ monthly active users.


ZK Rollup Usage


1. Loopring DEX Protocol

Loopring offers an Ethereum-based DEX harnessing zkRollups to reach nearly 3,000 transactions per second with low cost trading.

2. StarkWare STARK Layer

Starkware’s validity-proof-powered STARK application rollup scales general computation for enterprise usages beyond trading.

3. Consensys Quorum Hydra

Private blockchain platform Consensys Quorum uses AZTEC Connect’s ZK tech for private transactions on public Ethereum sidechains.

As Zero Knowledge Proofs technology matures, more protocols are expected to adopt ZK Rollups while Optimistic-style rollups power most usage today.


Conclusion

Optimistic Rollups and Zero Knowledge Rollups usher in a monumental leap forward in scaling Ethereum to support higher transaction volumes at lower cost per transactions. Both solutions have unique advantages and downsides across areas ranging from security guarantees and speed, to privacy and computation.

As rollup adoption continues accelerating across payments, NFTs, DeFi, and more, these layer 2 innovations remain essential to unlocking the next chapter of innovation across Ethereum and the broader blockchain ecosystem.

Give some love by commenting , reading and reacting to this Article✨


Thank you for reading! If you found this content valuable, please consider supporting my work


BITCOIN : bc1qehnkue20nce3zgec73qvmhy0g3zak69l24y06g
SOLANA : 5tGG8ausWWo8u9K1brb2tZQEKuDMZ9C6kUD1e96dkNBo
ETHEREUM/polygon/OP/ARB/FTM/ AVAX/BNB :
0x608E4C17B3f891cAca5496f97c63b55AD2240BB5
TRX and TRX USDT : TMtuDzU9XE5HHi83PZphujxSFiiDzyUVkA
ICP : wbak4-ujyhn-jtb4f-gyddm-jkpwu-viujq-7jwe3-wl3ck-azbpz-gy45g-tqe
XRP : rGzWnVNpecRVqzb95pWvGxqUY8DpSTGATT
ADA: addr1qx026lu93l7nj229alh0qcf2e69fx0selxmm870f80h9uzsgze4den3cvq337q65esfgw8t5zttfvkm6j6fljjsh00cqca3nqx
BCH : qpvs92cgn0722lwsraaumczj3dznpvclkv70knp0sn
LTC : ltc1qq0jp3xj5vmjwm57lr6339xhp8sf6c3lq9fv3ye
ATOM : cosmos1dvvn0p4dgdtzjh9eudy2gcrcys0efhd2ldhyvs
Flow Address: 0xc127a6d0990af587

Write & Read to Earn with BULB

Learn More

Enjoy this blog? Subscribe to CapitalThink

9 Comments

B
No comments yet.
Most relevant comments are displayed, so some may have been filtered out.