← Protocols
Linea
01Description

Linea is a Consensys-built zkEVM Layer 2 settling SNARK validity proofs to Ethereum, with ETH as the gas token and full Ethereum-equivalent bytecode execution. Mainnet chain ID 59144, runs upstream Besu with Linea plugins (no fork needed since 2025), and targets ~2–4s block times with Ethereum-anchored security.

02Best for
  • 01EVM-equivalent ZK L2 with ETH gas
  • 02Consensys / MetaMask-aligned consumer apps
  • 03low-fee Solidity deployments unchanged from mainnet
  • 04Ethereum-settled DeFi
03Install
  • pnpm add viem wagmi
04Environment variables
VariableScopeDescription
NEXT_PUBLIC_LINEA_RPC_URLClientLinea RPC URL (mainnet: https://rpc.linea.build).
NEXT_PUBLIC_LINEA_CHAIN_IDClientChain ID — 59144 for mainnet, 59141 for Linea Sepolia testnet.
05Prompt snippet
Use viem's built-in `linea` / `lineaSepolia` chains (`import { linea } from 'viem/chains'`) — chain ID 59144, gas token ETH, RPC `https://rpc.linea.build`. Solidity contracts deploy unchanged with Foundry: `forge create --rpc-url $LINEA_RPC --private-key $PK src/MyContract.sol:MyContract`. Bridge ETH/ERC-20s via the canonical Linea Bridge (`bridge.linea.build`) — the L1 message service is at `0xd19d4B5d358258f05D7B411E21A1460D11B0876F`. For nodes, run upstream Hyperledger Besu with the `linea-besu-package` plugins; Linea no longer ships a forked client. Indexers: The Graph and Goldsky both support chain 59144.
06Gotchas
  • Linea is Type-2 zkEVM-equivalent but uses an opcode-restriction list — `SELFDESTRUCT`, `MODEXP` with certain inputs, and a few precompiles behave differently or are disabled. Re-test contracts that rely on edge-case opcodes; do not assume mainnet receipts hold.
  • Withdrawals require waiting for proof finalization on L1 — typically several hours, sometimes longer under prover load. Build UX around the long withdrawal window, or route exits through a fast-bridge (Across, Stargate) at the cost of fees.
  • Sequencer is centralized and operated by Consensys — there is no permissionless fallback today. Plan for liveness incidents and document an exit story for high-value users.
  • Linea has run multiple incentive programs (LXP, LXP-L, Surge) that affect on-chain behavior of users and contracts; unsanctioned activity can trigger eligibility flags. Read the current rules before launching anything that resembles wash-trading or sybil farming.
  • Block time is ~2–4s and gas estimation diverges from L1 (L2 execution gas + L1 calldata gas). Use `eth_estimateGas` plus the Linea-specific calldata cost surcharge rather than assuming mainnet pricing.
  • Linea's USDC is a bridged variant (not native CCTP at launch); track the canonical USDC contract via Circle's address registry rather than guessing — token-route logic that assumes one canonical address will mismatch.
07Alternatives