Week 9 / Blockchain from zero
Scaling: Rollups And Layer 2
- Week 9 of Blockchain from zero
- More transactions, lower fees, same base security.
Week 9 · Blockchain
What You Can Do By The End
- Explain why capacity is limited
- Describe how a rollup works
- Compare optimistic and ZK rollups
- Explain data availability
- Judge the risk of a bridge
Week 9 · Blockchain
Recap Of Weeks 7 And 8
- Tokens are ledgers inside contracts.
- DeFi chains those contracts together.
- Every action costs gas on Ethereum.
- Demand drives gas prices up.
Week 9 · Blockchain
Why Capacity Is Limited
- Every full node re-executes every transaction.
- Blocks have a fixed size.
- More demand than space means a bidding contest.
- Bigger blocks make nodes harder to run.
Trade-offs
The Trilemma
- Scalability: many transactions per second.
- Security: attacks stay expensive.
- Decentralization: many people can verify.
- Improving one tends to strain another.
| Property | Meaning |
|---|
| Decentralisation | Many can run nodes |
| Security | Attacks are costly |
| Scalability | Many transactions |
Week 9 · Blockchain
Layers
- Layer 1: the base chain that settles results.
- Layer 2: networks that run the activity.
- Layer 2 posts data and results to layer 1.
- Users pay a share of one base fee.
users -> sequencer -> L2 block
|
batch of data + proof/claim
|
contract on Ethereum (L1)Week 9 · Blockchain
What A Rollup Does
- A sequencer orders transactions quickly.
- Compressed data goes to Ethereum.
- A contract on Ethereum records the new state.
- One L1 transaction carries many L2 transactions.
Week 9 · Blockchain
Optimistic Rollups
- State is accepted unless challenged.
- A challenge period gives watchers time.
- A valid fraud proof discards the bad state.
- Runs ordinary Solidity with little change.
Week 9 · Blockchain
Zero-Knowledge Rollups
- Each batch comes with a validity proof.
- Ethereum checks the proof, not the transactions.
- Checking is far cheaper than re-running.
- Examples: zkSync and Starknet.
Week 9 · Blockchain
The Cost Of Proving
- Generating proofs needs heavy computation.
- A zkEVM must prove Ethereum rules exactly.
- Withdrawals can finalize once the proof lands.
- Complex proving software is a trust surface.
Side by side
Compare The Two
- Optimistic: challenge window, simpler, longer exits.
- ZK: proofs, harder to build, faster finality.
- Both depend on data being available.
- Both can have centralized sequencers today.
| Optimistic | Zero-knowledge |
|---|
| Trust | Challenge window | Validity proof |
| Exit | About seven days | After proof |
Week 9 · Blockchain
Data Availability
- Data must be public so anyone can rebuild state.
- Hidden data blocks fraud checks and exits.
- EIP-4844 blobs made data cheaper in 2024.
- Outside data layers add a trust assumption.
Week 9 · Blockchain
Reading The L2 Landscape
- Who runs the sequencer, and is there a forced-exit path?
- Who can upgrade the contracts, and with what delay?
- Where does the data live?
- L2BEAT summarizes these risks.
Week 9 · Blockchain
Bridges
- Lock on one chain, mint on the other.
- Burn to go back and unlock the original.
- Native bridges inherit the rollup's security.
- Third-party bridges add their own trust.
chain A: lock 10 tokens in bridge contract
chain B: mint 10 wrapped tokens
...
chain B: burn 10 wrapped tokens
chain A: unlock 10 tokens
Week 9 · Blockchain
Bridge Safety Habits
- Prefer native bridges for large amounts.
- Send a small test transfer first.
- Check the official site address independently.
- Practice on test networks.
Week 9 · Blockchain
Recap
- Capacity limits drive fees.
- Rollups execute off chain and settle on Ethereum.
- Optimistic uses challenges, ZK uses proofs.
- Data availability and bridges decide safety.
Week 9 · Blockchain
Next Week: Wallets, Security And Custody
- Seed phrases and hardware wallets.
- Phishing, approvals and common contract bugs.
- Audits and what they can promise.
Week 9 · Blockchain
Questions And Exercise
- Deploy ClassToken on a rollup test network.
- Compare fees on both networks.
- Write your network choice with reasons.