Module 3: How Blockchains and Transactions Work

Layer 2 Networks and Rollups

Chapter 8 of 13 · about 7 minutes

8.1 The same swap for a few cents

After Mint's expensive mainnet swap, Hash suggested trying the same swap on a Layer 2 network. Same type of decentralised exchange, same tokens, same amount. The fee was a few cents, and the swap confirmed almost instantly.

"How is that possible?" Mint asked. "If it's so cheap, why does anyone use mainnet?"

"Because the cheap part comes with some extra trust assumptions and some complexity," said Hash. "Let's look at how rollups actually work, so you know what you're trading off."

8.2 The idea behind rollups

A rollup is a Layer 2 network that executes transactions outside Ethereum's main chain, bundles many of them together, and then posts a compressed record of them to Ethereum.

Think of a busy post office with a long queue. Instead of everyone in an office building queuing separately to send letters, one courier collects all the letters, packs them into a single box, and takes the box to the post office. The building's residents get fast, cheap service. The post office still processes and records the box. If anything goes wrong, the post office record shows exactly what was sent.

The key properties of a rollup are:

  1. Transactions are executed on the Layer 2, which is fast and cheap.
  2. The transaction data is posted to Ethereum, so anyone can reconstruct the Layer 2's state.
  3. Ethereum checks or can challenge the correctness of the Layer 2's results, using one of two methods.

That third point is what separates a rollup from simply being a separate blockchain. A rollup aims to inherit Ethereum's security, rather than relying entirely on its own.

Chapter 8 · How a rollup works

Users transact on a Layer 2 sequencer, which batches many transactions and posts their data to Ethereum as blobs. An optimistic rollup assumes the batch is valid and allows a challenge period before withdrawals finalise. A ZK rollup instead posts a validity proof that Ethereum verifies immediately.

A rollup runs transactions off-chain on its own sequencer, then posts compressed data and a proof back to Ethereum. Optimistic rollups assume validity with a challenge window; ZK rollups post a validity proof up front.

8.3 Where the fee goes

A Layer 2 transaction fee usually has two parts.

Execution fee: the cost of processing the transaction on the Layer 2 itself. Usually very small.

Data fee: the transaction's share of the cost of posting the bundle's data to Ethereum.

The data fee used to be the largest part. In March 2024, an Ethereum upgrade introduced a cheaper type of data storage for rollups, called blobs. Blobs are temporary data attached to blocks, kept for a limited period, which is long enough for anyone to verify rollup activity. Rollup fees fell dramatically after this upgrade, often to fractions of a cent. Later upgrades continued the trend: Pectra, in 2025, raised the number of blobs per block, and Fusaka, at the end of 2025, added PeerDAS, a technique that lets nodes check only small random samples of blob data, expanding how much data rollups can post.

Ethereum mainnet swapLayer 2 swap
Where it executesEthereum directlyOn the Layer 2
Fee componentsGas on EthereumLayer 2 execution plus a share of Ethereum data costs
Illustrative fee on a quiet daySeveral dollarsA few cents or less
Confirmation feelAbout 12 seconds per blockOften near-instant soft confirmation

8.4 Optimistic rollups

Rollups need a way to convince Ethereum that their results are correct. The first method is optimistic.

An optimistic rollup posts its results to Ethereum and assumes they're correct, unless someone proves otherwise. There's a challenge period, typically about seven days, during which anyone watching can submit a fraud proof showing that the rollup's results were wrong. If the proof succeeds, the incorrect result is rejected.

Think of an exam where answers are accepted unless a classmate formally challenges one within a week, with evidence.

The practical consequence is withdrawal time. Moving assets from an optimistic rollup back to Ethereum using the official bridge usually requires waiting out the challenge period. That's why third-party fast bridges exist, which pay you on Ethereum immediately, for a fee, and take on the waiting themselves.

8.5 ZK rollups

A ZK rollup (zero-knowledge rollup) uses a different method. Along with its results, it posts a validity proof: a compact cryptographic proof that the computation was performed correctly. Ethereum verifies the proof directly. No challenge period is needed, because correctness is proven mathematically rather than assumed.

Using the exam analogy again: instead of waiting for challenges, every answer comes with a sealed certificate that the examiner can check in seconds.

Generating these proofs is computationally heavy, and ZK technology is complex. But it enables faster withdrawals, often within hours.

Optimistic rollupZK rollup
How correctness is ensuredAssumed correct unless challenged with a fraud proofProven correct with a validity proof
Withdrawal to Ethereum via official bridgeAbout seven daysOften hours, depending on proof frequency
Main complexityRequires honest watchers to challenge fraudProof generation is complex and resource-intensive
MaturityWidely used, simpler technologyRapidly maturing

8.6 The sequencer

Most rollups today rely on a single operator called a sequencer, which receives transactions, puts them in order, and produces Layer 2 blocks. This is why Layer 2s feel so fast: there's no waiting for many validators to agree.

But it introduces trust. A sequencer generally cannot steal your funds, because the rules are enforced by Ethereum. However, a sequencer could go offline, temporarily halting the network, or it could refuse to include your transactions, a form of censorship.

Well-designed rollups include an escape route. If the sequencer ignores you, you can submit your transaction directly through Ethereum, forcing it to be included, or withdraw your funds through Ethereum. How easy and fast this is varies by rollup.

"So the sequencer is a middleman," said Node.

"A limited one," said Hash. "It controls order and timing, not ownership. And the goal is to decentralise sequencers over time."

8.7 Not all Layer 2s are equally decentralised

Many rollups launched with training wheels: special powers held by the team, such as the ability to upgrade contracts instantly or override fraud proofs in an emergency. These powers help fix bugs quickly, but they also mean users are trusting the team.

Independent trackers rate rollups on how far they've removed these training wheels, often using a staged framework, from early stages with significant team control to later stages where the rollup is governed primarily by code and users have strong exit guarantees. When choosing where to hold significant funds, checking a rollup's stage and upgrade powers is worth the time.

Question to ask about a Layer 2Why it matters
Is it a rollup, or a separate chain that calls itself a Layer 2?Rollups post data to Ethereum and inherit more of its security
Optimistic or ZK?Affects withdrawal times
Who runs the sequencer?Affects censorship and downtime risk
Can contracts be upgraded instantly, and by whom?Instant upgrades mean trusting the team
Can users force transactions or withdrawals through Ethereum?Your escape route if something goes wrong

8.8 Practical tips for using Layer 2s

Bridge in using official bridges or direct exchange withdrawals (Module 2, Chapter 9).

Keep a little ETH on each Layer 2 for gas.

Plan withdrawals from optimistic rollups, allowing for about seven days if you use the official bridge.

Check token versions. The same token may exist in "native" and "bridged" versions on a Layer 2. Applications may accept only one.

Remember that each Layer 2 is a separate network with its own balances, approvals, and applications.

8.9 Try it yourself

Pick two well-known Layer 2 networks. For each, find out whether it's an optimistic or ZK rollup, who operates its sequencer, and its current stage on an independent Layer 2 tracker. Then compare the fee for a token swap on each with the same swap on Ethereum mainnet right now.

Key takeaways from this chapter

  1. Rollups execute transactions off Ethereum's main chain, bundle them, and post the data to Ethereum.
  2. Layer 2 fees combine a small execution fee and a share of Ethereum data costs, which fell sharply after blobs were introduced in 2024.
  3. Optimistic rollups assume results are correct unless challenged, so official withdrawals take about seven days.
  4. ZK rollups prove correctness with validity proofs, enabling faster withdrawals.
  5. Most rollups use a single sequencer that can delay or censor transactions but generally can't steal funds.
  6. Many rollups still have training wheels like instant upgrade powers. Check their stage and escape routes.
  7. Treat each Layer 2 as a separate network, keep gas on it, and plan withdrawals.