Why the main chain hits a wall
Picture a courtroom where every single citizen must personally witness every contract signed in the country, or it doesn't count. Nothing forged could ever slip through — but the line out the door would stretch for miles, and a simple signature would take all day. That is the bargain a chain like Ethereum strikes: thousands of independent nodes each re-run every transaction, so the result is something the whole world can verify rather than trust. Safety is total. Speed is not.
This is the heart of the scalability trilemma: a chain seems forced to pick two of three — security, decentralization, and scale. You could speed things up by demanding bigger, costlier machines to run a node, but then fewer people can afford to keep watch, and decentralization quietly erodes. For years the obvious-looking fixes all quietly traded away the very thing that made the chain worth using.
Do the work off-chain, settle on-chain
A layer 2 is a separate chain that runs on top of a base chain — the layer 1 — and borrows its security instead of building its own. The most important family of layer 2 today is the rollup, and the name is a clue to how it works. Out on the rollup, a single fast machine called a sequencer gathers up hundreds or thousands of transactions, executes them in one batch, and rolls them up into one compact bundle. Then it posts that bundle down to layer 1.
Here is the move that makes everything work. Layer 1 does not re-run those thousands of transactions. Instead, the rollup hands it just two things: the new state (the updated balances, the new account values) and enough information for anyone to check that the new state really follows from the old one. The expensive part — the actual computing — happened once, off-chain, on one fast machine. The base chain only has to be convinced the answer is right. Convincing is far cheaper than computing.
LAYER 2 (rollup) LAYER 1 (base chain)
------------------- --------------------
tx tx tx tx tx [ batch summary ]
tx tx tx tx tx --roll--> [ new state ]
tx tx tx tx tx [ validity info ]
(1000s of txs) |
executed once v
by sequencer verified, not re-run
-> inherits L1 securityBecause the rollup leans entirely on layer 1 to settle and to store its data, a transaction on the rollup ultimately enjoys the same security as one on the main chain. You are not trusting the sequencer to be honest; you are trusting the base chain to catch it if it isn't. That is the whole promise: layer-1 safety at a fraction of layer-1 cost.
Two ways to prove the batch is honest
Everything turns on one question: how does layer 1 become convinced the sequencer didn't cheat — didn't pay itself a billion coins along the way? Two different answers split rollups into two camps, and the difference is genuinely a difference in worldview.
An optimistic rollup trusts first and verifies only on challenge. It posts its new state and simply *asserts* it is correct — optimistically assumed good. A watchdog window opens, usually about a week, during which anyone who spots a lie can submit a fraud proof: a precise on-chain demonstration that one disputed step was computed wrong. If a fraud proof lands, the bad batch is thrown out and the cheater loses a posted deposit. If the window closes in silence, the state is final. The bet is that honesty is the default and challenges are rare, so almost nothing needs heavy proving.
A ZK rollup flips the burden. Instead of inviting challenges, it attaches to every batch a validity proof — a small piece of cryptography built with the same machinery as a zero-knowledge proof. This proof is, in effect, a mathematical receipt saying *"I ran all these transactions correctly,"* and layer 1 can check it in milliseconds without re-executing a single transaction. Here the *zero-knowledge* name is mostly historical: what the rollup actually needs is succinct validity, not privacy — the transaction data is still published, as the next section explains. There is no waiting window and no need to assume good faith: an invalid batch simply cannot produce a valid proof. The cheating isn't caught after the fact — it is made impossible up front.
- Optimistic: assume valid, post a deposit, and let a fraud proof undo any lie during a challenge window. Cheap to run, but withdrawals wait out the window.
- ZK: prove validity up front with a cryptographic receipt layer 1 checks instantly. Heavier math to produce a proof, but final almost at once and nothing to assume.
The real crux: data availability
Here is the subtle part that trips up almost everyone, and it is worth slowing down for. A proof — fraud or validity — can tell you that a new state is *correct*. But to actually use the rollup, to exit it, or to challenge it, the world needs to know what the transactions were. If the sequencer computed everything honestly but then refused to publish the underlying data, your funds could be provably correct and yet utterly stuck, because no one could reconstruct the state to withdraw. Correctness without the data is a locked vault with a verified balance you can never reach.
This is why a true rollup must publish its transaction data back to layer 1, where it is permanent and anyone can read it. That single requirement — data availability — is what separates a rollup that genuinely inherits the base chain's security from a faster cousin that merely promises to behave. It is also, by far, the biggest cost a rollup pays: most of a rollup's gas bill is not computation but the price of writing all that data down where everyone can see it.
Trade-offs and the open road ahead
Neither camp has won outright, because each pays a real price. Optimistic rollups are simpler and cheaper to build, and they run ordinary Ethereum code almost unchanged — but their challenge window means a full withdrawal back to layer 1 can take about a week. ZK rollups settle almost instantly and need no waiting, but producing those validity proofs is computationally heavy, and making them handle every kind of contract has been a long, hard engineering climb. Today both are live and carrying real activity; which one fits depends on what you value more, instant finality or simplicity.
There are open problems no one has fully closed. Most rollups today still run a single sequencer, a lone fast machine that orders transactions — convenient, but a point of central control that the community is actively working to share out. And because data availability dominates the cost, much of the frontier now aims at making data cheaper to publish without weakening the guarantee. These are live research questions, not settled facts, and that honesty is part of understanding the space.
Step back and the shape is elegant. A trilemma that once looked like an iron law turns out to have a seam: keep the base chain small, slow, and impossibly secure, and move the busy work up to a layer 2 that borrows that security wholesale. The base chain becomes a supreme court that hears only proofs; the rollups above it become the bustling courtrooms where life actually happens. The next guide follows this idea to its conclusion — chains built from the start as separate, specialized layers, the modular vision of what a blockchain can be.