Hexncoin

🧱 Layer 1, Layer 2 & Rollups

Rollups: Optimistic vs ZK

Two different ways rollups prove their off-chain execution was honest.

8 min read

The rollup recipe

A rollup is the most widely used kind of Layer 2. It executes transactions off-chain, compresses the results, and posts both the data and some evidence of correctness back to the Layer 1 - 'rolling up' many transactions into one compact submission.

That evidence of correctness is what separates a rollup from just trusting an operator's word. It's also where the two major rollup designs diverge.

Optimistic rollups: trust, but verify

An optimistic rollup posts a batch and assumes it's correct by default. For a set challenge window - commonly around a week - anyone watching can download the data, re-run it, and submit a fraud proof if something's wrong. A successful fraud proof reverts the bad batch and penalizes whoever posted it.

The trade-off is that withdrawals back to the Layer 1 have to wait out that challenge window, since the network needs time to make sure no one disputes the batch.

ZK-rollups: prove it up front

A ZK-rollup (zero-knowledge rollup) takes a different approach: it submits a validity proof alongside every batch - a compact cryptographic proof that mathematically guarantees the transactions were executed correctly. There's no need to wait for a challenge window, because the math itself rules out cheating.

The trade-off shifts elsewhere: generating those proofs is computationally heavy, and building a system that can produce valid proofs for arbitrary smart-contract code is a harder engineering problem than an optimistic design.

'Optimistic' assumes honesty and punishes lies after the fact. 'ZK' proves honesty mathematically before anyone has to ask.

Picking a lane

Neither design is strictly better. Optimistic rollups have historically been simpler to build and run general-purpose smart contracts on, at the cost of slower withdrawals. ZK-rollups offer near-instant finality back to the L1, at the cost of harder engineering - though that gap has been closing quickly.

In practice, most users notice the difference mainly as 'how long until my withdrawal to the base layer clears' - fast for ZK, delayed by a challenge window for optimistic.

Check your understanding

3 questions from this lesson, with the correct answer already marked.

1. What do all rollups have in common?

  • They never post any data to Layer 1
  • They execute transactions off-chain, then post data and correctness evidence back to Layer 1
  • They replace the need for a Layer 1 entirely
  • They only work for token transfers, not smart contracts

The rollup pattern is: execute off-chain, compress, then post the data plus proof of correctness back to the base layer.

2. In an optimistic rollup, how is an invalid batch caught?

  • A validity proof rejects it automatically
  • Anyone can submit a fraud proof during a challenge window
  • The sequencer self-reports errors
  • Invalid batches are impossible by design

Optimistic rollups rely on watchers submitting fraud proofs during a challenge window if a posted batch turns out to be wrong.

3. What's the main advantage of a ZK-rollup's validity proof over an optimistic rollup's fraud-proof model?

  • It's cheaper to compute in every case
  • Correctness is proven mathematically up front, so there's no challenge-window wait for finality
  • It doesn't require posting any data to L1
  • It works only for simple token transfers

Because the validity proof guarantees correctness immediately, ZK-rollups don't need a waiting period before a batch is considered final.