Layer 2 Networks and Scaling
Learn how rollups make Ethereum cheaper, compare optimistic and zero-knowledge rollups, and calculate when moving to a Layer 2 pays off.
What you will learn
- Why Ethereum needs scaling and what a Layer 2 (L2) is.
- How optimistic rollups and zero-knowledge rollups differ.
- Which trust assumptions L2s add: sequencers, upgrade keys and bridges.
- How to calculate whether bridging to an L2 is worth the cost.
Explanation
Ethereum's base chain, called Layer 1 (L1), can process only a limited amount of gas per block. When demand is high, the base fee rises (see Lesson 1). A Layer 2 is a separate network that executes transactions outside L1 but posts data or proofs back to L1, so that it inherits part of Ethereum's security.
Rollups
The main L2 design is the rollup. It collects ("rolls up") many transactions, executes them off L1, and publishes compressed transaction data plus the new state to an L1 contract. Because many users share one L1 posting, the cost per user is much lower.
- Optimistic rollups assume batches are correct unless someone proves otherwise. Anyone can submit a fraud proof during a challenge period, typically about seven days. For this reason, withdrawals through the official bridge back to L1 usually take about a week.
- Zero-knowledge (ZK) rollups publish a validity proof, a cryptographic proof that the new state was computed correctly. Withdrawals can complete once the proof is verified on L1, often within hours, but the proving technology is more complex.
The Dencun upgrade (March 2024) introduced blobs (EIP-4844): a cheaper, temporary data space that rollups use instead of normal calldata. Later upgrades increased blob capacity. This is why L2 fees fell sharply, although they still rise when demand is high.
Where the extra trust comes from
- Sequencer: the operator that orders L2 transactions. Many L2s run a single sequencer. If it goes offline, the L2 can stop; if it misbehaves, it can delay or reorder transactions. Some designs let users force transactions through L1, but this is slower and technical.
- Upgrade keys: many rollup contracts can be changed by a small group (a "security council" or multisig, a wallet that needs several signatures). If keys can upgrade the contract instantly, users rely on those key holders.
- Proof maturity: some optimistic rollups have no working, permissionless fraud proofs yet. Independent trackers classify rollups into maturity "stages" (0, 1, 2); a higher stage means less reliance on operators.
- Bridges: the canonical bridge is the official L1–L2 contract. Third-party bridges or "fast bridges" let you exit in minutes for a fee, but they are separate systems with their own risk (bridge hacks are covered in Lesson 9).
Other scaling designs exist: sidechains have their own validators and do not inherit Ethereum security, and validiums keep data off L1. They are cheaper but carry more trust.
Worked example
Hypothetical example: you plan several token swaps of about €1,000 each. Assumptions: L1 base fee 20 gwei, ETH €2,000, priority fee ignored; L2 swap fee €0.05 in total (execution plus L1 data cost); swap fees charged by the exchange itself, price impact and taxes are excluded.
- L1 swap at 150,000 gas: 150,000 × 20 gwei = 3,000,000 gwei = 0.003 ETH = €6.00.
- L2 swap: €0.05. Saving per swap: €6.00 − €0.05 = €5.95.
- Bridge in through an L1 transaction of 100,000 gas: 100,000 × 20 gwei = 0.002 ETH = €4.00.
- Break-even on the bridge-in alone: €4.00 ÷ €5.95 = 0.67, so the first swap already covers it.
- Exit: the canonical optimistic bridge takes about 7 days. A fast bridge charging 0.1% on €1,000 costs €1.00 plus gas.
The decision is not only about fees: you also accept sequencer, upgrade-key and bridge risk for the time your funds stay on the L2.
Common mistake
Practice activity
On paper: you hold €2,000 on L1. Hypothetical costs: bridge-in €4.00; exit via fast bridge 0.1% of €2,000 plus €0.50 gas; L1 swap €6.00; L2 swap €0.05. How many swaps on the L2 do you need before the round trip (in and out) is cheaper than doing the swaps on L1?
Show solution
Exit cost: 0.1% × €2,000 = €2.00 + €0.50 = €2.50. Round trip: €4.00 + €2.50 = €6.50.
Saving per swap: €6.00 − €0.05 = €5.95. Swaps needed: €6.50 ÷ €5.95 = 1.09, so you need at least 2 swaps.
Check: 2 swaps on L2 cost €6.50 + €0.10 = €6.60; on L1 they cost €12.00.
Limitations: fees change constantly, and the calculation ignores the extra L2 and bridge risk.
Key takeaways
- Rollups execute off L1 and post data or proofs to L1, which spreads the cost over many users.
- Optimistic rollups rely on fraud proofs and a challenge period; ZK rollups rely on validity proofs.
- Sequencers, upgrade keys and bridges are extra trust assumptions.
- Compare total round-trip costs and risks, not just the cost of one swap.
Next step
The next lesson examines stablecoins in depth, the tokens most DeFi activity on L1 and L2 is priced in.
Self-check
Answer the questions, then check your answers. You can retry as often as you like.
Automatic self-check for your own revision. Your answers are checked in your browser and are not seen or assessed by us. It is not an exam and not a qualification.
Your progress
“Complete” only means you marked the lesson as done. It is not a test of your understanding. Progress and notes are saved only in this browser on this device — not in an account.