ethereum/l2-dev-guide
L2 Development Guide: Arbitrum / Optimism / zkSync / Base
ethereumguide👥 Communityconfidence highhealth 100%
v1.0.0·Updated 3/20/2026
L2 Types
Optimistic Rollups (optimistic, 7-day withdrawal period): Arbitrum One, Optimism, Base ZK Rollups (zero-knowledge, fast withdrawal): zkSync Era, Polygon zkEVM, Scroll, Starknet
Arbitrum (Most EVM Compatible)
Nearly identical to Ethereum mainnet. Key differences:
// block.number returns approximate L1 block number
// Use ArbSys to get actual L2 block number
const arbSys = new ethers.Contract(
"0x0000000000000000000000000000000000000064",
["function arbBlockNumber() view returns (uint256)"], provider
)
const l2Block = await arbSys.arbBlockNumber()
// hardhat.config.ts
networks: {
arbitrum: { url: "https://arb1.arbitrum.io/rpc", chainId: 42161, accounts: [PK] }
}
Optimism / Base (OP Stack)
Fully EVM equivalent, deployment same as mainnet.
networks: {
base: { url: "https://mainnet.base.org", chainId: 8453 },
"base-sepolia": { url: "https://sepolia.base.org", chainId: 84532 }
}
zkSync Era (Most Different)
npm install zksync-ethers @matterlabs/hardhat-zksync
// Must use zksync-ethers, cannot use ethers directly
import { Provider, Wallet } from "zksync-ethers"
const provider = new Provider("https://mainnet.era.zksync.io")
// hardhat.config.ts must add zksync: true
networks: {
zkSyncMainnet: { url: "https://mainnet.era.zksync.io", ethNetwork: "mainnet", zksync: true, chainId: 324 }
}
Does not support tx.origin; native account abstraction; supports custom Paymaster (gas sponsorship).
Cross-chain Bridge (Arbitrum SDK)
import { EthBridger, getL2Network } from "@arbitrum/sdk"
const ethBridger = new EthBridger(await getL2Network(l2Provider))
// L1 → L2 (approx. 10-15 minutes)
await ethBridger.deposit({ amount: ethers.parseEther("0.01"), l1Signer, l2Provider })
// L2 → L1 (requires 7-day challenge period)
await ethBridger.withdraw({ amount: ethers.parseEther("0.01"), l2Signer, destinationAddress })
Testnet Quick Reference
| L2 | Testnet ChainID | Faucet |
|---|---|---|
| Arbitrum | Sepolia 421614 | faucet.triangleplatform.com |
| Optimism | Sepolia 11155420 | app.optimism.io/faucet |
| Base | Sepolia 84532 | faucet.quicknode.com |
| zkSync | Sepolia 300 | faucet.quicknode.com |
Recommended Tools
Tenderly: All major L2s, best debugging tool Alchemy/Infura: Both support mainstream L2s Blockscout: Block explorer instances available for each L2