Tutoriel·9 min de lecture·Par Solingo

Ethereum Layer 2 Scaling — Rollups, ZK, and Optimistic Explained

Understand L2 scaling solutions: Optimistic rollups, ZK rollups, validiums. Where to deploy your contracts.

# Ethereum Layer 2 Scaling — Rollups, ZK, and Optimistic Explained

Ethereum's Layer 2 (L2) scaling solutions have matured dramatically. In 2026, L2s process over 10 million transactions per day while maintaining Ethereum's security guarantees. If you're building on Ethereum, understanding L2s is essential.

This guide explains how L2s work, compares the major solutions, and helps you choose where to deploy your smart contracts.

Why Layer 2? The Mainnet Problem

Ethereum Layer 1 (mainnet) has fundamental constraints:

  • Limited throughput: ~15-30 transactions per second (TPS)
  • High costs: $5-$100+ per transaction during congestion
  • Slow finality: 12-15 minutes for economic finality

These limitations make many applications economically unviable on mainnet (gaming, social, micropayments, frequent trading).

L2s solve this by moving computation off-chain while inheriting Ethereum's security.

What is a Layer 2?

A Layer 2 is a separate blockchain that:

  • Executes transactions off Ethereum mainnet (faster, cheaper)
  • Batches transactions into compressed data
  • Posts this data to Ethereum L1 (for data availability)
  • Proves validity via fraud proofs (optimistic) or validity proofs (ZK)
  • Key insight: L2s don't replace Ethereum — they extend it. Your assets are secured by Ethereum, but transactions happen on L2.

    Types of Layer 2 Solutions

    1. Optimistic Rollups

    How they work:

    • Assume transactions are valid by default ("optimistic")
    • Anyone can challenge invalid state transitions within a challenge period (7 days)
    • If challenged, fraud proof is submitted to L1 to verify
    • If fraud is proven, malicious sequencer is slashed

    Architecture:

    User Transaction → L2 Sequencer → State Root Posted to L1
    

    Challenge Period (7 days)

    Fraud Proof (if challenged)

    L1 Verifies → Finalized or Reverted

    Leading implementations:

    • Arbitrum One: Largest L2 by TVL (~$15B in 2026)
    • Optimism (OP Mainnet): Pioneer of optimistic rollups (~$8B TVL)
    • Base: Coinbase's L2 built on Optimism stack

    Pros:

    • EVM-equivalent (deploy Solidity contracts unchanged)
    • Lower gas costs than mainnet (10-50x cheaper)
    • Mature ecosystem and tooling
    • Easy migration from L1

    Cons:

    • 7-day withdrawal delay (challenge period)
    • Higher costs than ZK rollups
    • Larger L1 data footprint

    Example deployment to Arbitrum:

    // hardhat.config.ts
    

    export default {

    networks: {

    arbitrum: {

    url: "https://arb1.arbitrum.io/rpc",

    chainId: 42161,

    accounts: [process.env.PRIVATE_KEY]

    }

    }

    };

    npx hardhat run scripts/deploy.ts --network arbitrum

    No code changes needed — same Solidity contracts work on Arbitrum.

    2. Zero-Knowledge (ZK) Rollups

    How they work:

    • Execute transactions off-chain
    • Generate a cryptographic proof (validity proof) that execution was correct
    • Post proof + compressed state to L1
    • L1 verifies proof mathematically (no trust required)

    Architecture:

    User Transaction → L2 Prover → ZK Proof + State Diff
    

    Posted to L1 (small data)

    L1 Verifies Proof (instant finality)

    Leading implementations:

    • zkSync Era: EVM-compatible ZK rollup (~$600M TVL)
    • StarkNet: Uses Cairo language (custom VM) (~$1.2B TVL)
    • Polygon zkEVM: EVM-equivalent via ZK-SNARKs (~$800M TVL)
    • Scroll: Another EVM-equivalent ZK rollup

    Pros:

    • Faster withdrawals (no 7-day wait)
    • Lower costs (more efficient data compression)
    • Mathematically proven security (no fraud risk)
    • Future-proof (quantum-resistant options exist)

    Cons:

    • Higher complexity for developers
    • Proving time adds latency (seconds to minutes)
    • EVM compatibility still maturing (some opcodes unsupported)
    • Fewer auditors familiar with ZK systems

    Example deployment to zkSync:

    // hardhat.config.ts
    

    import "@matterlabs/hardhat-zksync-deploy";

    import "@matterlabs/hardhat-zksync-solc";

    export default {

    zksolc: {

    version: "1.3.14",

    compilerSource: "binary"

    },

    networks: {

    zkSyncMainnet: {

    url: "https://mainnet.era.zksync.io",

    ethNetwork: "mainnet",

    zksync: true,

    verifyURL: 'https://zksync2-mainnet-explorer.zksync.io/contract_verification'

    }

    }

    };

    Note: zkSync uses a modified compiler. Most Solidity works, but some features differ.

    3. Validiums

    What they are:

    Validiums use ZK proofs like ZK rollups, but store data off-chain instead of on L1.

    Trade-off:

    • Pro: Even cheaper (no L1 data costs)
    • Con: Lower security (data availability assumption)

    Use cases:

    • Gaming (high throughput, lower value)
    • Private/enterprise applications
    • Exchange order books

    Examples: ImmutableX (NFT gaming), Sorare, dYdX v3 (migrated to Cosmos)

    4. Plasma

    Status: Largely deprecated in favor of rollups.

    Plasma chains posted only commitments to L1, not full data. This made withdrawals complex and required users to monitor the chain actively (the "mass exit" problem).

    Historical note: Plasma was a stepping stone to rollups. Most Plasma chains have migrated.

    Comparison Table

    | Feature | Optimistic Rollups | ZK Rollups | Validiums | Mainnet |

    |---------|-------------------|------------|-----------|---------|

    | TPS | 2,000-4,000 | 2,000-20,000 | 10,000+ | 15-30 |

    | Tx Cost | $0.10-$1 | $0.05-$0.50 | $0.01-$0.10 | $5-$100 |

    | Withdrawal Time | 7 days | Minutes-hours | Minutes-hours | Instant |

    | EVM Compatibility | Full | Good (improving) | Varies | Native |

    | Security | L1-level (fraud proofs) | L1-level (validity proofs) | Lower (off-chain data) | Native |

    | Maturity | High | Medium | Medium | High |

    | Examples | Arbitrum, Optimism | zkSync, StarkNet | ImmutableX | Ethereum |

    How Rollups Work: A Deep Dive

    Data Flow

  • User submits transaction to L2 sequencer
  • Sequencer executes transaction (updates L2 state)
  • Batches transactions (100-10,000 per batch)
  • Compresses batch using calldata compression
  • Posts to L1:
  • - Optimistic: State root + compressed calldata

    - ZK: State root + proof + minimal data

  • L1 stores data (ensuring availability)
  • Finalization:
  • - Optimistic: After 7-day challenge period

    - ZK: Immediately upon proof verification

    Bridging Assets

    To use an L2, you must bridge assets from L1:

    L1 → L2 (Deposit):

    // On L1 (Ethereum mainnet)
    

    L1Bridge.depositETH{value: 1 ether}(/* L2 recipient */);

    Assets are locked on L1 and minted on L2 (usually within minutes).

    L2 → L1 (Withdrawal):

    // On L2
    

    L2Bridge.withdraw(1 ether);

    • Optimistic: Wait 7 days, then finalize on L1
    • ZK: Wait for next batch + proof (minutes to hours), then finalize

    Fast withdrawals: Services like Hop Protocol and Across provide instant L2→L1 transfers for a fee (they front the liquidity).

    Deploying to Layer 2: Developer Experience

    Same Solidity, Different Network

    Good news: Your existing Solidity contracts work on most L2s with minimal changes.

    // Same deployment script for L1, Arbitrum, Optimism, Polygon, zkSync
    

    const MyContract = await ethers.getContractFactory("MyContract");

    const contract = await MyContract.deploy(/* constructor args */);

    await contract.deployed();

    console.log("Deployed to:", contract.address);

    Minor Differences to Know

    1. Block times:

    • L1: 12 seconds
    • Arbitrum: ~250ms
    • Optimism: ~2 seconds
    • zkSync: ~1 second

    Impact: block.timestamp updates more frequently on L2.

    2. Gas costs:

    • L2 gas price is much lower
    • But L1 data posting adds a base cost per transaction

    3. Precompiles:

    • Some L1 precompiles unavailable on L2
    • New L2-specific precompiles exist (e.g., ArbSys on Arbitrum)

    4. Cross-layer messaging:

    • Special contracts for L1↔L2 communication
    • Delays involved (minutes to days)

    Example: Cross-Layer Message

    From L1 to L2 (Arbitrum):

    // On L1
    

    import "@arbitrum/nitro-contracts/src/bridge/IInbox.sol";

    contract L1Contract {

    IInbox public inbox = IInbox(0x4Dbd4fc535Ac27206064B68FfCf827b0A60BAB3f);

    function sendMessageToL2(address l2Target, bytes memory data) external payable {

    inbox.createRetryableTicket(

    l2Target, // destination on L2

    0, // L2 call value

    0, // max submission cost

    msg.sender, // refund address

    msg.sender, // beneficiary

    1000000, // gas limit on L2

    0, // gas price bid

    data // calldata

    );

    }

    }

    From L2 to L1 (Arbitrum):

    // On L2
    

    import "@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol";

    contract L2Contract {

    ArbSys constant arbSys = ArbSys(0x0000000000000000000000000000000000000064);

    function sendMessageToL1(address l1Target, bytes memory data) external {

    arbSys.sendTxToL1(l1Target, data);

    // Message available on L1 after ~1 week (challenge period)

    }

    }

    Cost Comparison: Real Examples

    Uniswap V3 swap:

    • Ethereum L1: $15-$50
    • Arbitrum: $0.50-$2
    • Optimism: $0.30-$1.50
    • zkSync: $0.20-$1
    • Polygon zkEVM: $0.15-$0.80

    ERC-20 transfer:

    • Ethereum L1: $5-$20
    • Arbitrum: $0.10-$0.50
    • Optimism: $0.08-$0.40
    • zkSync: $0.05-$0.30

    NFT mint:

    • Ethereum L1: $20-$100
    • Arbitrum: $1-$5
    • Optimism: $0.80-$4
    • zkSync: $0.50-$3

    Savings: 10-100x cheaper on L2.

    Which L2 Should You Choose?

    Choose Arbitrum if:

    • You want maximum compatibility (EVM-equivalent)
    • You're building DeFi (most TVL and liquidity)
    • You need a mature ecosystem (tooling, bridges, oracles)
    • You want to migrate L1 contracts with zero changes

    Best for: DeFi protocols, DAOs, established projects migrating

    Choose Optimism/Base if:

    • You want to build on the OP Stack (superchain vision)
    • You're integrating with Coinbase (Base)
    • You value retroactive public goods funding
    • You're building social or consumer apps

    Best for: Consumer apps, Base ecosystem projects, OP collective members

    Choose zkSync if:

    • You want the lowest costs long-term
    • Fast withdrawals are important
    • You're okay with minor EVM differences
    • You believe in ZK's future (quantum resistance)

    Best for: Gaming, micropayments, frequent trading, new projects

    Choose StarkNet if:

    • You need maximum customization (Cairo language)
    • You're building ZK-native applications
    • You want cutting-edge ZK features
    • You're willing to learn a new language

    Best for: Advanced developers, ZK researchers, custom VM logic

    Choose Polygon zkEVM if:

    • You're already in the Polygon ecosystem
    • You want EVM-equivalence + ZK benefits
    • You need strong institutional support

    Best for: Enterprises, Polygon ecosystem projects

    Multi-Chain Strategy

    Best practice: Deploy on multiple L2s.

    Benefits:

    • Reach more users (some prefer specific chains)
    • Diversify risk (if one chain has issues)
    • Capture liquidity from different ecosystems

    Tools for multi-chain:

    • LayerZero: Cross-chain messaging
    • Axelar: General message passing
    • Chainlink CCIP: Cross-chain interoperability protocol

    The Future of L2s

    2026 trends:

    • L3s emerging: L3s built on L2s (even cheaper, app-specific)
    • Shared sequencing: Multiple L2s sharing sequencers for better UX
    • Based rollups: Using L1 validators as L2 sequencers
    • ZK-EVM equivalence: Perfect EVM compatibility with ZK proofs
    • Native account abstraction: Better UX on L2s

    Ethereum's roadmap (The Surge) aims for 100,000+ TPS across L2s.

    Conclusion

    Layer 2s have made Ethereum scalable. Key takeaways:

    • Optimistic rollups (Arbitrum, Optimism): EVM-equivalent, 7-day withdrawals, mature
    • ZK rollups (zkSync, StarkNet, Polygon zkEVM): Lower costs, fast withdrawals, improving
    • Validiums: Cheapest but lower security guarantees
    • 10-100x cost savings vs mainnet
    • Same Solidity code works on most L2s
    • Deploy multi-chain to maximize reach

    Where to start: Deploy to Arbitrum or Optimism for DeFi, zkSync or Polygon zkEVM for consumer apps. Test thoroughly — L2s have subtle differences.

    Solingo's L2 Development Track teaches you to build and deploy on all major L2s, handle cross-layer messaging, optimize for L2 gas costs, and architect multi-chain applications. Scale your dApps — start learning today.

    Prêt à mettre en pratique ?

    Applique ces concepts avec des exercices interactifs sur Solingo.

    Commencer gratuitement