Layer 2 Explained for Developers

How Ethereum layer 2 networks work for developers, from optimistic and ZK rollups to blobs, data availability, the Stages framework and deployment choices.

In this guide
  1. What counts as a layer 2
  2. How a rollup processes your transaction
  3. Optimistic vs ZK rollups
  4. Data availability and blobs
  5. How mature is a rollup? The Stages framework
  6. What changes when you deploy to an L2
  7. Choosing where to deploy
  8. FAQ
  9. Sources

A layer 2 (L2) is a separate network that executes transactions off Ethereum Mainnet and then posts data and proofs back to it, so users get lower fees while still relying on Ethereum for security. Most L2s today are rollups, and most run the EVM, so your Solidity contracts and tools carry over with few changes. What does change is the trust model, the fee structure and how long withdrawals take, and those are the parts a developer needs to understand.

What counts as a layer 2

ethereum.org uses the term for off-chain systems that derive their security from Mainnet: optimistic rollups, zero-knowledge rollups and state channels. Networks that secure themselves separately are not layer 2 in that definition, even when they are EVM-compatible and bridged to Ethereum:

  • Sidechains run their own consensus and set their own block parameters.
  • Validiums use validity proofs like a ZK rollup but keep transaction data off Ethereum.
  • Plasma chains anchor to Ethereum and resolve disputes with fraud proofs, but also keep data off chain.

The distinguishing test is simple: if the L2's operators disappeared or turned hostile, could users rebuild the state from data on Ethereum and exit? For a rollup that posts its data to Ethereum, the design goal is yes.

How a rollup processes your transaction

The flow is similar across rollups:

  1. You send a transaction to the L2's RPC endpoint, exactly as you would on Mainnet.
  2. A sequencer orders and executes it and returns a confirmation, usually within seconds. On many rollups the sequencer is a single operator.
  3. Transactions are batched and compressed, and the batch data is published to Ethereum.
  4. A new state root is posted to the rollup's contracts on Ethereum.
  5. The state root becomes final on Ethereum once it has been proven valid or the dispute period has passed, depending on the rollup type.
A transaction goes to the layer 2 sequencer, which orders, executes and confirms it, then joins a batch. The batch data is published to Ethereum Mainnet, a state root is posted, and the root later becomes final.
Steps 1 to 3 happen on the rollup within seconds; settlement on Ethereum (steps 3 to 5) comes later.

Two details matter for application design. First, a sequencer confirmation is a promise from the operator; settlement on Ethereum comes later. Second, well-designed rollups let users force a transaction through Ethereum directly if the sequencer ignores them, which is the protection against censorship.

Optimistic vs ZK rollups

The two families differ in how Ethereum becomes convinced that a posted state root is correct.

Optimistic rollup ZK rollup
Correctness mechanism State roots are assumed valid unless challenged with a fraud proof Each state root is accepted only with a validity proof
Dispute process Interactive: parties narrow the disagreement to a single step, which an L1 contract checks None needed; the verifier contract checks the proof
Withdrawal to L1 Waits out the challenge window, typically about seven days No challenge period; available once the proof is accepted, though some rollups add their own delay
Main cost driver Publishing data Publishing data plus generating proofs, which is computationally heavy
EVM compatibility Generally equivalent at bytecode level Harder to achieve; zkEVMs reproduce EVM behaviour inside proof circuits
Key assumption At least one honest party watches and can challenge in time The proof system and its implementation are sound

Proof systems come in two main kinds. SNARKs produce small proofs that are cheap to verify but most constructions need a trusted setup. STARKs avoid the trusted setup at the price of larger proofs that cost more gas to verify.

Users who do not want to wait seven days on an optimistic rollup can use liquidity providers that pay out on L1 immediately for a fee and collect the withdrawal later. That is a third-party service with its own risks, not part of the rollup's security.

Data availability and blobs

Publishing transaction data is what lets anyone reconstruct a rollup's state, and it has historically been the largest part of L2 fees. Ethereum's roadmap over the last three years has focused on making that data cheaper.

  • EIP-4844 (March 2024). The Dencun upgrade introduced blobs, a data space attached to blocks for rollups. Blob contents are not accessible to the EVM; contracts only see a commitment. Nodes prune blobs after roughly 18 days, long enough for disputes and for anyone to copy the data. Before this, rollups posted data as calldata, which stays in chain history permanently.
  • Pectra (May 2025). Raised the blob target per block from three to six.
  • Fusaka (December 3, 2025). Introduced PeerDAS, under which a node no longer downloads every blob but samples a portion of the data, with the full data recoverable from any half of it. This is what makes much higher blob counts practical.
  • Blob-parameter-only forks. Fusaka also added a way to raise blob limits between major upgrades. The first raised the target to 10 and the maximum to 15 blobs per block on December 9, 2025; the second raised them to 14 and 21 on January 7, 2026.
  • Glamsterdam. The next upgrade has been live on the Sepolia testnet since October 2026. ethereum.org states that mainnet activation is not yet scheduled.

Fusaka also set a reserve price for blobs tied to execution costs, so blob fees no longer fall to practically zero when demand is low.

When data is not on Ethereum

Some networks publish data to a separate data availability layer or to a committee instead. Fees drop further, but users now also depend on that external system to keep the data available. When you evaluate a chain, find out where its data goes. This is the same trade-off discussed for validiums in private vs public blockchains.

How mature is a rollup? The Stages framework

Rollups launch with "training wheels": upgrade keys, permissioned operators and emergency councils. The Stages framework, published by ETHBEAT (the project formerly known as L2BEAT), is the common way to describe how far a rollup has moved past them.

  • Stage 0. The project posts state roots and data to L1, the software needed to reconstruct state is public, and a working proof system exists.
  • Stage 1. Apart from bugs, blocking or forging a withdrawal would require compromising at least 75% of a security council. Upgrades made outside the council give users at least seven days to exit.
  • Stage 2. The proof system is permissionless, users get at least 30 days to exit before unwanted upgrades, and the council can only intervene for bugs that are detectable on chain.

The framework's authors point out that it measures decentralization and control, not the absence of bugs. A higher stage does not mean the code is safe, and stages of individual rollups change over time, so check the current listing before making decisions.

What changes when you deploy to an L2

For an EVM rollup, most of your workflow stays the same: same language, same test framework, same libraries. The differences are worth a checklist.

  • Fees have two parts. You pay for L2 execution and for your transaction's share of the data published to L1. Compact calldata matters more than on Mainnet; heavy computation matters less.
  • EVM differences. Supported opcodes, precompiles, block times and the behaviour of block-related globals can differ from Mainnet and between rollups. Check the chain's documentation against the compiler's target EVM version. Also note that Mainnet itself now caps a single transaction at about 16.7 million gas (EIP-7825), which affects very large L1 deployments and batch operations.
  • Finality levels. Decide which confirmation your application acts on: sequencer confirmation, data posted to L1, or finalized on L1. High-value actions deserve the stronger levels.
  • Sequencer downtime. If the sequencer stops, time-sensitive logic such as liquidations or auctions may behave badly when it resumes. Design grace periods.
  • Cross-chain messages are asynchronous. A message from L1 to L2 or back arrives in a later transaction, possibly much later. Bridges and message handlers are security-critical code; apply everything in smart contract security basics.
  • Addresses and deployments. The same contract is a separate deployment on each chain with separate state. Keep per-chain configuration explicit in your scripts and frontend.
  • Infrastructure. You need RPC endpoints, an explorer and indexing per chain. See indexing blockchain data, and the wallet integration guide for prompting users to switch networks.

Test on the L2's own testnet, not only on a local Mainnet-like node, because fee behaviour and system contracts differ. Our overview of smart contract testing tools covers fork testing against live networks.

Choosing where to deploy

There is no single best network. Compare candidates on criteria you can verify:

  1. Security model. Rollup type, where data is published, and its current Stage.
  2. Upgrade control. Who can change the contracts, and how much notice users get.
  3. EVM compatibility. Whether your contracts and dependencies work unmodified.
  4. Ecosystem fit. Whether the tokens, oracles and protocols you integrate with exist there.
  5. Tooling. Explorer, verified-source support, indexers, RPC providers and wallet support.
  6. Exit path. How long a withdrawal to L1 takes and whether forced inclusion is available.

If you are early in your learning, deploy the same small project to an Ethereum testnet and to one optimistic and one ZK rollup testnet. Observing the differences first-hand is a useful exercise and a solid entry among blockchain portfolio project ideas.

FAQ

Do I need to learn a new language for layer 2?

Not for EVM rollups; Solidity and the usual tools work. A few ZK rollups use their own virtual machines and languages, so check before committing.

Are layer 2 networks as secure as Ethereum?

They inherit Ethereum's security for data and settlement only to the extent their design allows. Upgrade keys, centralized sequencers and immature proof systems add trust assumptions, which is what the Stages framework tracks.

Why do withdrawals from optimistic rollups take about a week?

The delay is the window in which anyone can challenge an incorrect state root with a fraud proof. Funds are released on L1 only after that window closes.

Did blobs make rollup data permanent on Ethereum?

No. Blob data is pruned after about 18 days. The commitments stay on chain, and long-term access to the full data depends on rollup operators and archival services.

Sources

About the author

Alessandro Moretti is a crypto analyst and blockchain strategist who writes and maintains the guides on BlockDev Path. Every factual claim is checked against the primary sources listed above. Spotted an error? Tell us and we will correct it. See our editorial policy.