Linea RPC: The zkEVM Where Gas Estimation Works Differently
Linea is a zkEVM Layer 2 built by Consensys — the team behind MetaMask and Infura — which means two things for developers. First, it's EVM-equivalent, so your existing contracts and tooling connect with a URL change and nothing else. Second, because Consensys ships the wallet most of your users already have, Linea tends to show up as a default network in a lot of places. The RPC surface is standard eth_*, so the on-ramp is easy.
The parts worth actually reading about are the two places Linea diverges from a plain Ethereum node: gas estimation and finality. Get those right and everything else is business as usual.
Connecting
Linea mainnet is EVM chain ID 59144 (0xe708). Gas is paid in ETH — no separate native token — so funding, balances, and fee display work exactly like Ethereum. Point any standard client at a SwiftNodes endpoint:
https://rpc.swiftnodes.io/rpc/linea?key=YOUR_API_KEY
viem, ethers, web3.py, Foundry, and Hardhat all work unchanged:
import { createPublicClient, http } from "viem";
const client = createPublicClient({
transport: http("https://rpc.swiftnodes.io/rpc/linea?key=YOUR_API_KEY"),
});
console.log(await client.getChainId()); // 59144
console.log(await client.getBlockNumber()); // ~31,700,000 and climbing
What "zkEVM" means here
Linea is a zkEVM rollup: it executes standard EVM bytecode and proves that execution correct with zero-knowledge validity proofs posted to Ethereum. For a developer, the practical upshot is bytecode-level compatibility — Solidity compiles the same, opcodes behave the same, and audits carry over. The RPC is plain eth_*; there's no Cairo (like Starknet) or a modified VM to learn.
It's worth placing Linea against the other ZK L2s we've covered. zkSync Era is EVM-compatible but not equivalent — it has a different VM, custom account abstraction, and its own transaction type. Scroll targets bytecode-equivalence. Linea sits in the equivalent camp: standard EVM semantics, standard tooling, with the validity-proof machinery running underneath. In the rollup taxonomy, it's a ZK rollup — proofs plus data on Ethereum.
The gas estimation gotcha
Here's the first place a naive integration goes wrong. On Ethereum you reach for eth_gasPrice and eth_estimateGas and move on. On Linea, those don't capture the whole cost, because an L2's fee has a component that reflects the cost of proving and posting data to L1 — and Linea exposes a dedicated method to price it correctly: linea_estimateGas.
It returns a tuple rather than a single number:
curl -s -X POST "https://rpc.swiftnodes.io/rpc/linea?key=YOUR_API_KEY" \
-H 'content-type: application/json' -d '{
"jsonrpc":"2.0","id":1,"method":"linea_estimateGas",
"params":[{"from":"0x...","to":"0x...","value":"0x0"}]}'
{ "gasLimit": "0x5208", "baseFeePerGas": "0x7", "priorityFeePerGas": "0x24137da" }
You get the gas limit, the base fee, and a recommended priority fee in one call. The priority fee it returns is not the near-zero tip you'd assume from mainnet habits — it's computed for Linea's fee market, and using a hand-picked or eth_gasPrice-derived value instead is the classic way to get transactions that either overpay or sit unmined. If you're building a wallet or a bot on Linea, prefer linea_estimateGas and use the values it hands back. (It's a Linea-specific method, so this is knowledge that lives with the chain, not with any one provider — the standard eth_estimateGas mechanics still apply for the EVM side.)
Finality: the finalized tag means something specific
The second divergence is finality, and it's a good divergence. Linea produces blocks quickly at the sequencer, but a block is only truly final once its validity proof is verified on Ethereum. That gives Linea two useful properties compared to optimistic rollups:
- No multi-day challenge window. An optimistic rollup like Arbitrum or Base makes you wait ~7 days for a trustless L1 withdrawal because someone might dispute the state. A validity proof has nothing to dispute — once it's verified, the state is settled. This is the core ZK-vs-optimistic distinction from soft vs hard finality.
- The
finalizedblock tag is your anchor. When you need certainty — bridging value, crediting a deposit, settling something irreversible — read against thefinalizedtag rather thanlatest, and you're reading L1-proven state.
One caveat that trips people up: the finalized tag only reflects true L1 finalization on a Linea-aware node. Some generic endpoints alias finalized to the chain head, which quietly defeats the purpose. If your withdrawal logic depends on real finality, confirm your endpoint reports a finalized height that lags latest — that gap is the proof-verification pipeline, and it's supposed to be there.
Indexing and events
Nothing exotic here — eth_getLogs and log subscriptions work as on any EVM chain. Two habits carry over: respect getLogs range caps when backfilling, and key your indexed records on (txHash, logIndex) rather than block number so a reorg near the sequencer head can't corrupt your data. The mechanics are the same as handling chain reorgs, and for certainty-sensitive reads, anchor to finalized as above.
The Consensys distribution angle
Linea's quieter advantage is reach. Because Consensys builds MetaMask, Linea is frequently a first-class network in the wallet flows your users already run, which lowers the friction of getting them onto your L2. It doesn't change how you build — the RPC is standard — but it's a real reason Linea shows up in a lot of consumer-facing apps.
The short version
Linea is an easy chain to build on and a slightly nuanced one to build well on. It's an EVM-equivalent zkEVM, so eth_* and your tooling just work. Two things deserve attention: use linea_estimateGas for pricing instead of assuming mainnet gas habits, and treat the finalized tag as your finality anchor — validity proofs mean no 7-day exit window, but only a Linea-aware endpoint reflects real L1 finalization.
Get a Linea endpoint — and 60-plus other chains behind one consistent URL format — on the SwiftNodes Linea RPC page. There's a free tier to start; sign up and point your client at https://rpc.swiftnodes.io/rpc/linea?key=YOUR_API_KEY.
Related posts
- Robinhood Chain RPC: Tokenized Stocks on an Arbitrum Orbit L2
Robinhood Chain is a new Arbitrum Orbit L2 built for tokenized stocks and real-world assets. Here's how to connect, what stays standard EVM, and the one thing that isn't.
- Mantle RPC: Endpoints, EigenDA, and What's Different
Mantle looks like a standard EVM L2 until two things trip you up: gas is paid in MNT, not ETH, and data availability runs through EigenDA instead of Ethereum calldata. Here's what that means for your RPC calls, plus the Mantle endpoints to point at.
- What Is a Sequencer? How L2 Transactions Get Ordered
On an Ethereum L2, a single component decides the order your transaction lands in and how fast it confirms: the sequencer. Here's what it actually does, why nearly every rollup runs a centralized one today, and what that means when you're reading L2 state over RPC.