Layer 2 Networks: How They Work
Understand layer 2 networks: what moves off-chain, how rollups work, and the withdrawal wait. A clear, risk-aware explanation of L2 mechanics.
Layer 2 networks, often called L2s, are systems built on top of an existing blockchain (the layer 1, or L1) to process transactions more quickly or cheaply. The core idea is to move most of the work off the main chain while still relying on the main chain for security and final settlement. This page explains the mechanism: what actually moves off-chain, what stays on-chain, and how the two interact. It also covers the main types of layer 2s—rollups—and the trade-offs users experience, especially the withdrawal wait.
What Moves Off-Chain and What Stays On-Chain
In a typical layer 2, the main chain (like Ethereum) continues to store the canonical record of account balances and contract code. What moves off-chain is the execution of transactions: the computation, the ordering, and the temporary state updates. Instead of every transaction being processed by every node on the main chain, a layer 2 batches many transactions together and submits a compact summary to the main chain.
What stays on-chain is the settlement: the final state after a batch is processed is recorded on the layer 1, often in the form of a state root (a cryptographic hash of the entire L2 state). This means the main chain provides the security guarantee—if the layer 2 misbehaves, the main chain can detect it and revert to a correct state.
How Rollups Work
Rollups are the dominant form of layer 2. They “roll up” hundreds or thousands of transactions into a single batch, then post that batch to the main chain. There are two main approaches: optimistic rollups and validity rollups (also called ZK-rollups).
Optimistic Rollups
Optimistic rollups assume that transactions are valid unless someone challenges them. The batch is posted to the main chain with a state root, and there is a period (often about a week) during which anyone can submit a fraud proof to show that the batch was incorrect. If a fraud proof is accepted, the batch is reverted and the challenger is rewarded. If no challenge occurs, the batch is finalized.
User experience: Deposits are fast (a few minutes), but withdrawals require waiting for the challenge period to end—typically 7 days—unless a liquidity provider offers instant withdrawals for a fee. This wait is the most noticeable difference for users.
Validity Rollups (ZK-Rollups)
Validity rollups use cryptographic proofs (zero-knowledge proofs) to prove that a batch of transactions is valid. The proof is posted to the main chain, and the main chain verifies it in seconds. No challenge period is needed because the proof mathematically guarantees correctness.
User experience: Withdrawals are typically faster (minutes to hours) because there is no waiting period for challenges. However, generating the proof can be computationally expensive, and some rollups have restrictions on the types of computations they can support efficiently.
Optimistic and validity rollups compared
| Feature | Optimistic Rollup | Validity Rollup (ZK) |
|---|---|---|
| How validity is ensured | Fraud proofs (challenge period) | Cryptographic proof (validity proof) |
| Withdrawal wait | ~7 days (unless instant liquidity) | Minutes to hours |
| Computation cost | Lower per batch (no proof generation) | Higher (proof generation) |
| Suitability for complex logic | Good (EVM-compatible) | Varies (some are EVM-compatible now) |
| When it does NOT apply | If you need fast withdrawals without extra fees | If you need to run complex smart contracts that are not yet supported |
The Withdrawal Wait: What It Really Is
For optimistic rollups, the withdrawal wait is not a technical limitation but a security mechanism. The challenge period exists to give honest actors time to detect and prove fraud. Without it, a malicious operator could post an invalid state root and steal funds. The wait is the cost of trusting the system to be self-correcting.
For validity rollups, the wait is shorter because the proof itself is the guarantee. But the proof generation can take time, and the rollup may still have a delay for other reasons (e.g., batching frequency).
What People Get Wrong About Layer 2s
A common misdiagnosis is that layer 2s are “separate blockchains” that you must trust on their own. In reality, they inherit security from the layer 1. For optimistic rollups, the security model relies on at least one honest party watching the chain and submitting fraud proofs. If everyone stops watching, the system could theoretically be compromised. This is not a flaw in the mechanism but a condition of its design.
Another misconception is that layer 2s are always faster and cheaper. While they often are, the cost and speed depend on the specific L2 and its usage. During peak times, an L2 can become congested, and fees can rise. Also, moving funds between L1 and L2 incurs costs and delays.
Finally, some users assume that all layer 2s are the same. Optimistic and validity rollups have different trade-offs, and other types of L2s (such as state channels or plasma) exist but are less common. Understanding the specific L2 you use is essential.
Risks and Limitations
- Smart contract risk: Layer 2s are software, and bugs can lead to loss of funds. Even if the L1 is secure, the L2’s contracts may have vulnerabilities.
- Operator failure: If the L2 operator stops producing blocks or acts maliciously, users may be unable to transact or withdraw until the issue is resolved.
- Censorship: In some designs, the operator can censor transactions, though users can usually exit to L1 if needed.
- Fraud proof assumptions: For optimistic rollups, the system assumes that at least one honest party will challenge invalid batches. If no one does, invalid state could become final.
How to Use a Layer 2
Using a layer 2 typically involves these steps:
- Bridge assets: Send tokens from the L1 to the L2 using a bridge. This locks your tokens on L1 and mints equivalent tokens on L2.
- Transact: Use applications on the L2 as you would on L1, but with lower fees and faster confirmations.
- Withdraw: When you want to move funds back to L1, initiate a withdrawal. For optimistic rollups, expect a wait; for validity rollups, it may be faster.
Example: Command Line Interaction
Some layer 2s offer command-line tools for interacting with the network. For example, a CLI might let you check your balance or send a transaction:
# Check balance on L2
l2-cli balance --address 0x...
# Output: Balance: 1.5 ETH
# Send a transaction
l2-cli send --from 0x... --to 0x... --amount 0.1
# Output: Transaction hash: 0x...
# Note: The transaction is submitted to the L2 and will be included in the next batch.
The output shows that the command communicates with the L2 node, not directly with the L1. The transaction is not final until the batch is posted to L1.
How layer 2 networks keep settlement on layer 1
Layer 2 networks are a mechanism to scale blockchains by moving execution off-chain while keeping settlement on-chain. Rollups are the main type, with optimistic and validity approaches offering different trade-offs, particularly in withdrawal time. Understanding what moves off-chain and what stays on-chain clarifies how these systems work and what risks remain.
Common questions
What is a layer 2 network?
A layer 2 network is a system built on top of a blockchain (layer 1) to process transactions faster or cheaper. It moves most transaction processing off the main chain, while the main chain still provides security and final settlement.
Why do withdrawals take so long on some L2s?
On optimistic rollups, withdrawals take about a week because of the challenge period. This is a security feature that gives time for anyone to prove fraud. Validity rollups have faster withdrawals because they use cryptographic proofs instead of challenges.
Is it safe to use a layer 2?
Layer 2s inherit security from the layer 1, but they are not risk-free. Smart contract bugs, operator failures, and other issues can lead to loss of funds. Always understand the specific L2's design and risks before using it.
What is the difference between optimistic and ZK rollups?
Optimistic rollups assume transactions are valid and rely on fraud proofs, leading to a withdrawal wait. ZK rollups use cryptographic proofs to verify transactions, so withdrawals are faster but proof generation costs more.
Do I need to trust the layer 2 operator?
For optimistic rollups, you need to assume that at least one honest party will monitor the chain. For ZK rollups, the proof itself guarantees correctness, but you still trust the code. In both cases, you can usually exit to L1 if the operator misbehaves.
Read next
- Liquidity Pools: How They Work Learn how liquidity pools power decentralized exchanges, how fees are earned, and the risks like impermanent loss.
- How Crypto Bridges Work: Lock, Mint, Burn Learn what a crypto bridge does with your original asset—locked, burned, or custodied—and why bridges are a top source of crypto losses.
- Impermanent Loss: How It Works and When It Applies Understand impermanent loss: why liquidity pools rebalance against you, when it becomes permanent, and how it interacts with trading fees.
- Crypto Wallet Addresses: Formats and Cross-Chain Risks Understand crypto wallet address formats across chains, why the same address differs by network, and how to avoid sending funds to the wrong network.
- SIM Swap Attacks: Why a Phone Number Is Not a Factor The attack is against the carrier, not the phone. Port-out locks, moving off SMS, and the email account that sits behind every recovery flow.