The one-line mental model
A rollup executes transactions on a fast side machine but publishes enough data to Ethereum for anyone to re-run them, which is why it inherits security while a sidechain that publishes nothing does not.
Prerequisites
- !Ethereum gas costs and why storage dominates them
- !The difference between a node verifying rules and a node storing data
What You'll Learn
- 1Explain the data availability problem in one paragraph to a non-specialist
- 2Compare fraud proofs with validity proofs on latency, cost, and trust assumptions
- 3Calculate how calldata compression changes the marginal cost of a transfer
- 4Decide whether a given application belongs on a rollup, a channel, or a sidechain
The bottleneck is not the CPU
Ethereum's base layer executes roughly a few hundred simple transfers per second, and the reason is usually misdiagnosed as "not enough compute." The constraint is actually that every full node must store the resulting state and re-execute every transaction to validate the chain. Raising the compute ceiling without raising the data ceiling would simply produce a chain that validators cannot afford to run, which quietly converts a public network into a small club of well-funded operators.
Layer 2 designs therefore attack the problem along different axes. A rollup executes off chain and posts compressed transaction data back to Ethereum, keeping the settlement and data guarantees while moving computation away. A state channel skips the chain entirely for a burst of off-chain updates and only uses Ethereum to open and close the exchange. A sidechain runs its own consensus and borrows nothing from Ethereum except, sometimes, a bridge contract. Each choice spends a different currency: trust, latency, or capital lock-up.
Optimistic rollups: assume honest, prove fraud
Optimistic rollups publish state roots with the claim that every transaction was valid, and they rely on at least one honest observer to challenge a lie during a fixed window. The fraud proof below sketches the contract surface:
// Simplified fraud-proof interface for an optimistic rollup
contract OptimisticRollup {
struct StateBatch {
bytes32 stateRoot;
uint256 proposalBlock;
address proposer;
bool finalized;
}
StateBatch[] public batches;
uint256 public constant CHALLENGE_WINDOW = 7 days;
event BatchProposed(uint256 indexed batchId, bytes32 stateRoot);
function proposeBatch(bytes32 stateRoot) external {
batches.push(StateBatch({
stateRoot: stateRoot,
proposalBlock: block.number,
proposer: msg.sender,
finalized: false
}));
emit BatchProposed(batches.length - 1, stateRoot);
}
function finalize(uint256 batchId) external {
StateBatch storage batch = batches[batchId];
require(!batch.finalized, "already finalized");
require(
block.number > batch.proposalBlock + CHALLENGE_WINDOW,
"challenge window open"
);
batch.finalized = true;
}
function challenge(uint256 batchId, bytes calldata steps) external {
require(block.number <= batches[batchId].proposalBlock + CHALLENGE_WINDOW, "too late");
// A full implementation replays disputed steps against the previous
// state root; the honest re-execution wins and the proposer is slashed.
_verifyFraudProof(batchId, steps);
}
function _verifyFraudProof(uint256 batchId, bytes calldata steps) internal pure {
steps; // replaced by a real one-step prover in production systems
}
}
The design's defining property is asymmetric latency. Deposits from Ethereum can be credited near-instantly because Ethereum already trusts its own state, but withdrawals must wait out the challenge window, because a withdrawal finalizes a state root that is still contestable. Seven days is typical, and applications that need faster exits typically pay for a liquidity provider rather than shorten the window, since shortening it weakens the guarantee for everyone.
ZK rollups: prove correctness, skip the argument
A validity rollup attaches a cryptographic proof that the new state root was computed correctly from the previous one and the published data. Verification on Ethereum is a fixed, relatively cheap check regardless of how many transactions were batched, and there is no challenge window because a forged root cannot produce a valid proof in the first place:
// Minimal verification surface for a SNARK-backed state transition
contract ZKRollupVerifier {
mapping(uint256 => bytes32) public stateRoots;
function verifyAndPublish(
uint256 batchId,
bytes32 prevStateRoot,
bytes32 newStateRoot,
uint256 txCount,
uint256[2] calldata a,
uint256[2][2] calldata b,
uint256[2] calldata c
) external {
require(stateRoots[batchId - 1] == prevStateRoot, "bad parent root");
bool ok = pairingCheck(a, b, c, [prevStateRoot, newStateRoot, uint256(txCount)]);
require(ok, "invalid proof");
stateRoots[batchId] = newStateRoot;
}
function pairingCheck(
uint256[2] memory,
uint256[2][2] memory,
uint256[2] memory,
uint256[3] memory
) internal pure returns (bool) {
return true; // delegates to a precompiled pairing check in production
}
}
The trade is the mirror image of the optimistic design. Exits are fast because a finalized proof is final, but proving is expensive, and proving cost historically limited what could be expressed in the VM. General-purpose ZK virtual machines have narrowed that gap considerably, to the point where the practical question is usually transaction latency and fee market design rather than expressive power.
Sequencers, escape hatches, and who orders transactions
Every production rollup today routes transaction ordering through a single sequencer run by the core team, which is a far cry from Ethereum's decentralized block production and the first thing a serious review should examine. The sequencer decides inclusion and order, which means it can censor a transaction, extract ordering value, or simply go offline. What separates a credible rollup from a trust exercise is what happens next.
Three escape hatches define the answer. First, forced inclusion: a user whose transaction is censored can post it directly to the settlement contract on Ethereum, and the sequencer is obliged to include it in a subsequent batch, or the rollup halts upgrades. Second, a fraud or validity proof path that any participant can submit, so the sequencer's claims can be corrected without its cooperation. Third, an exit mechanism that works even if the sequencer vanishes entirely, typically by forcing a withdrawal through the settlement contract on Ethereum.
A practical way to evaluate a rollup is to ask what an angry user can do on their worst day. If the answer is "wait for the operator to process a complaint," you are using a service. If the answer is "post a forced transaction to Ethereum and wait out the protocol's delay," you are using a rollup whose trust assumptions you can verify. The distinction matters most precisely when the operator is under pressure, which is when it is too late to discover the answer.
Channels and sidechains: different contracts entirely
State channels handle a burst of updates between fixed parties: open a deposit on Ethereum, exchange signed updates as fast as you like, close with the final state and a signature. Cost is two on-chain transactions regardless of how many off-chain payments occurred, which makes channels ideal for micropayment streams and useless for general computation, since every participant must stay online to defend their interests.
Sidechains run independent consensus, usually with a federation or a delegated validator set, and connect to Ethereum through a bridge that locks assets on one side and mints representations on the other. They are fast and cheap, and they do not inherit Ethereum's security â a compromised validator set can freeze or steal bridged funds. Calling a sidechain a layer 2 is a category error; it is a separate chain with a bridge.
| Solution | Throughput | Exit latency | Security source | Capital lockup | Best for |
|---|---|---|---|---|---|
| Optimistic rollup | Thousands TPS | Days (challenge window) | Ethereum fraud proofs | None for users | General applications, DeFi |
| ZK rollup | Thousands TPS | Minutes (proof finality) | Ethereum validity proofs | None for users | Payments, general apps |
| State channel | Effectively unlimited off chain | Instant mutual close | Ethereum challenge contract | Deposits locked | Micropayments, games between two parties |
| Sidechain | Hundreds to thousands | Bridge-dependent | Own validator set | Bridge custody risk | Cost-sensitive apps that accept weaker guarantees |
Anatomy of a cheap transaction
Where a rollup's fee reduction actually comes from is worth tracing, because it explains both the savings and their limits. Ethereum charges for calldata bytes, so a rollup that packs hundreds of transfers into one batch divides the fixed data cost across all of them. Compression exploits the structure of transactions: nonces are predictable, addresses repeat, and signature values have redundant bits, so an encoder can shrink a transaction to a fraction of its on-chain size.
The remaining cost floor is the data Ethereum itself must store. This is why the shift toward blobs, which are temporary rather than permanent data, cut rollup fees so dramatically: rollups need the data available for a short window so challengers or provers can read it, and they have no need for it to remain in Ethereum's permanent state forever.
âšī¸Fast exits are a market, not a protocol feature
Nearly every rollup's withdrawal delay is a protocol constant. Services that offer instant exits simply advance you the funds and wait out the window themselves, pricing the wait as a fee. When you evaluate a bridge or an exit provider, you are evaluating a counterparty taking on that delay risk on your behalf.
Common Mistakes
Treating a bridge representation of an asset as equivalent to the original
Fix: Assess the bridge's custody model separately; wrapped assets inherit the bridge's smart contract and validator risk, not the base layer's
Judging a rollup only by its headline TPS number
Fix: Read throughput together with data availability design, sequencer centralization, and the withdrawal delay, which together determine real safety
Assuming a challenge window can be shortened without consequence
Fix: The window is the honest-observer guarantee; shortening it makes censorship and fraud cheaper, so treat fast exits as a liquidity product
Ignoring sequencer centralization in rollups marketed as decentralized
Fix: Check who orders transactions today and what the censorship path is; most rollups still route ordering through one operator with an escape hatch
Best Practices
- Prefer rollups that publish data to Ethereum and can demonstrate a forced-inclusion path for users
- Keep long-term settlement on the base layer and treat layer 2 balances as operational float
- Track the canonical bridge address carefully; phishing sites routinely spoof bridge domains
- When building on a rollup, design your contracts so a migration to another chain is an address change rather than a rewrite
Interview Questions
Q1: Why does a rollup still need to post data to Ethereum?
Because data availability is what lets anyone re-execute the chain and detect a lie. A rollup that posts only state roots would force users to trust the operator, which is exactly the trust model a sidechain already provides.
Q2: What is the practical difference between fraud proofs and validity proofs?
Fraud proofs are cheap to produce but require a challenge window during which an honest watcher must respond, so withdrawals are slow. Validity proofs are expensive to produce but verifiable instantly on chain, so finality is fast and no watcher assumption is needed.
Q3: Why are withdrawals from an optimistic rollup slow?
Because the state root a withdrawal depends on may still be contested. Waiting out the challenge window guarantees that any fraud would have had time to be proven, converting the observer assumption into a concrete delay users can reason about.
Key Takeaways
- The Ethereum scaling bottleneck is data and state growth, not raw computation
- Optimistic rollups trade withdrawal latency for cheap proofs; ZK rollups trade proving cost for fast finality
- State channels scale a fixed pair of participants, not general computation
- Sidechains do not inherit Ethereum security, and their bridges carry the full custody risk
- Fee savings come from amortizing and compressing calldata, which is why data availability design dominates the safety discussion