Layer 2 Scaling

Layer 2 Scaling

Definition: Networks built on top of a base blockchain (Layer 1) that process transactions off the main chain and only periodically settle a summary back to it, trading some decentralization for much lower cost and higher speed.

How It Works

  • Transactions execute on the Layer 2 network, which has its own faster, cheaper block production separate from Layer 1
  • Periodically, a batch of Layer 2 activity is compressed and posted back to Layer 1, either as raw transaction data, a validity proof, or both
  • Layer 1 acts as the final settlement and dispute-resolution layer, if something on Layer 2 is contested or an operator misbehaves, Layer 1 is where it gets resolved
  • Different approaches (rollups, sidechains, channels) make different tradeoffs between speed, cost, and how directly they inherit Layer 1’s security
  • Assets move between layers through a bridge contract, locking the asset on Layer 1 while minting a representation of it on Layer 2, and vice versa on withdrawal
  • Users typically pay a small L2 execution fee plus an amortized share of the L1 posting cost, rather than the full L1 gas cost per transaction
  • Withdrawals from some Layer 2s aren’t instant, a challenge period (optimistic rollups) or proof-generation delay (zk-rollups) can add minutes to days before funds are usable on Layer 1
  • Most rollups today rely on a single sequencer to order and batch transactions, a centralization point the ecosystem is actively working to decentralize
  • A rollup’s smart contracts on Layer 1 are what actually enforce correctness, the Layer 2 network itself is only as trustworthy as that L1 contract’s logic and any admin keys it retains
  • Transaction ordering, fee levels, and finality times can differ significantly between Layer 2s even when they share the same Layer 1
  • Some Layer 2s (notably several zk-rollups) use a different virtual machine or execution environment than Layer 1, requiring contracts to be ported or recompiled rather than deployed unchanged

Data Availability Choices

  • Rollup: full transaction data is posted to Layer 1, so anyone can reconstruct Layer 2 state independently even if the operator disappears
  • Validium: only a validity proof is posted to Layer 1, the underlying data stays off-chain with a separate committee, cheaper but adds a data-withholding risk
  • Volition: lets users choose per-transaction whether their data goes on-chain (rollup mode) or off-chain (validium mode), trading cost against guarantees
  • Danksharding and related L1 upgrades aim to make posting L2 data to Ethereum cheaper directly, reducing how much rollups need to compress or trade off in the first place

Types of Layer 2s

TypeSecurity modelExample
Optimistic rollupAssumes transactions are valid, allows a challenge window to submit fraud proofsArbitrum, Optimism
ZK-rollupPosts a cryptographic validity proof with every batch, no challenge window neededzkSync, Starknet
SidechainIndependent chain with its own validator set, bridged to Layer 1, weaker security linkPolygon PoS
State/payment channelTwo parties transact off-chain directly, only opening/closing hits Layer 1Lightning Network
PlasmaChild chains that periodically commit a summary root to Layer 1, mostly superseded by rollupsEarly scaling designs
ValidiumPosts a validity proof to L1 but keeps transaction data off-chain with a separate committeeImmutable X

Under the Hood

Worked example: cost comparison, L1 vs L2

  • Given: a token swap costs 150,000 gas on Ethereum L1, base fee is 40 gwei, tip 2 gwei, ETH is $3,000
  • Step: L1 cost = 150,000 x 42 gwei = 6,300,000 gwei = 0.0063 ETH, about $18.90 (matches the Gas Fees worked example)
  • Step: on an optimistic rollup, the same swap executes for a small L2 fee plus a fraction of the L1 cost to post its batch, since that L1 cost is split across hundreds of transactions in the batch
  • Answer: if a batch of 500 transactions shares a 200L1postingcost,eachtransaction′sshareis200 L1 posting cost, each transaction's share is 0.40, plus a small L2 execution fee, often bringing the total to well under 1,versus1, versus 18.90 alone on L1

Worked example: optimistic rollup challenge window

  • Given: an optimistic rollup uses a 7-day challenge window, a user withdraws funds from L2 back to L1
  • Step: the withdrawal is included in a batch and posted to L1, starting the 7-day window during which anyone can submit a fraud proof if the batch is invalid
  • Step: no fraud proof is submitted because the batch is valid
  • Answer: after 7 days with no successful challenge, the withdrawal finalizes and funds become available on L1, the delay exists specifically to give honest verifiers time to catch fraud before it’s irreversible

Worked example: why batch size matters for cost

  • Given: posting a batch to L1 costs a roughly fixed $150 regardless of how many transactions it contains, up to the batch’s data limit
  • Step: a quiet period produces a batch of only 50 transactions, 150/50=150 / 50 = 3.00 amortized L1 cost per transaction
  • Step: a busy period fills a batch to 1,000 transactions, 150/1,000=150 / 1,000 = 0.15 amortized L1 cost per transaction
  • Answer: L2 fees are cheaper, and more stable, when the network is busier and batches fill up faster, the opposite of how L1 congestion pricing behaves

Why It Matters

  • Base blockchains like Ethereum can only process a limited number of transactions per second; Layer 2s exist specifically to solve the gas fee and throughput problems that come with a congested base chain
  • Lets applications requiring frequent, low-value transactions (gaming, micropayments, high-frequency trading) exist without every action being prohibitively expensive
  • Preserves most of Layer 1’s security guarantees (for rollups especially) while operating at a fraction of the cost, rather than requiring a fully separate, less battle-tested chain
  • Allows a base chain to stay focused on security and decentralization while scaling happens in specialized layers built for it
  • Reduces pressure on Layer 1 block space overall, since a large share of activity that would otherwise compete for L1 blocks moves to L2 instead
  • Makes it economically viable to run applications that need many small state updates, like on-chain games or high-frequency order books, that would be unusable at L1 gas prices

Common Pitfalls

  • Assuming all Layer 2s offer identical security guarantees, sidechains and some older designs don’t inherit Layer 1 security nearly as directly as a rollup does
  • Underestimating the complexity of bridging assets between Layer 1 and Layer 2, bridge contracts are a common source of exploits and have suffered some of the largest hacks in the industry
  • Treating an L2 balance as immediately withdrawable to L1, an optimistic rollup’s challenge window can delay a withdrawal by days
  • Trusting a centralized sequencer without understanding the tradeoff, most rollups today rely on a single party to order transactions, a liveness or censorship risk even if funds stay cryptographically safe
  • Confusing “posts data to L1” with “fully secured by L1,” a rollup’s security also depends on its fraud-proof or validity-proof system actually working as designed
  • Forgetting that bridged tokens are IOUs, not the original asset, a wrapped token on L2 is only as good as the bridge contract that backs it
  • Using an unofficial or third-party “fast bridge” for convenience without checking its security model, these are separate trust assumptions layered on top of the rollup itself
  • Assuming a token exists identically across chains, the same token symbol on L1 and an L2 can be entirely different contracts if bridged through an unofficial path

Comparison

Optimistic rollupZK-rollupSidechainState channel
Security inherited from L1High, via fraud proofsHigh, via validity proofsLow, independent validatorsHigh, but only between channel participants
Withdrawal speedSlow, challenge window (often ~7 days)Fast, proof verifies instantlyFastInstant on close
Computation overheadLowHigh, proof generation is expensiveLowNone once open
Best forGeneral-purpose smart contractsGeneral-purpose, increasingly practicalHigh-throughput apps accepting weaker securityRepeated transactions between fixed parties
Proof costNone, relies on watchers/challengersHigh, specialized hardware to generate proofsN/AN/A
Trust assumption1-of-N honest challenger during the windowMath, no honest-party assumption neededOwn validator set’s honestyBoth parties available to close honestly

Example

Arbitrum and Optimism are Ethereum optimistic rollups that execute transactions cheaply off-chain, then post compressed transaction data back to Ethereum, inheriting its security through a fraud-proof challenge period. zkSync and Starknet are ZK-rollups that instead post a cryptographic proof of correctness with every batch, skipping the challenge window entirely.

FAQ

Is money on a Layer 2 as safe as on Layer 1? For a well-audited rollup, close to it, the main added risks are the bridge contract and, for optimistic rollups, trusting that someone will actually submit a fraud proof if needed.

Why do some L2 withdrawals take a week? That’s the optimistic rollup fraud-proof challenge window, it exists to give anyone time to catch and prove an invalid batch before funds are released.

Can a Layer 2 exist without a Layer 1? Not in the rollup/sidechain sense described here, a Layer 2 is defined by settling back to a base chain, without that it’s just its own Layer 1.

Do I need a different wallet for a Layer 2? Usually not, most EVM-compatible L2s work with the same wallet software as Ethereum L1, just pointed at a different network in the wallet’s settings.

Dig deeper