Optimism RPC: The Chain That Became a Template
Most layer-2s are chains. Optimism is a chain and a template. OP Mainnet (chain ID 10, public mainnet since December 2021) is one of the oldest and most battle-tested optimistic rollups — and its codebase, the OP Stack, is what Base, Zora, opBNB, Unichain, and Soneium are built on. The practical consequence for developers: what you learn building against Optimism's RPC transfers across the whole family. Here's the map.
The essentials
Optimism mainnet is chain ID 10, an optimistic rollup on Ethereum with:
- ETH as the gas token — no new native asset to hold for fees.
- 2-second blocks (verified live while writing this), with transactions ordered by a sequencer that gives you instant soft confirmations; hard finality follows Ethereum's. The sequencer is operated by OP Labs today, with decentralization an explicit roadmap item.
- Fault proofs live since June 2024 — the optimistic-rollup dispute mechanism that lets anyone challenge an invalid state claim on Ethereum, rather than trusting an upgrade delay alone.
- A standard EVM execution environment — Solidity, viem, ethers, Foundry, and the usual
eth_*surface apply directly.
Connecting is boilerplate:
import { createPublicClient, http, defineChain } from "viem";
const optimism = defineChain({
id: 10,
name: "OP Mainnet",
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
rpcUrls: { default: { http: ["https://rpc.swiftnodes.io/rpc/optimism?key=YOUR_API_KEY"] } },
});
const client = createPublicClient({ chain: optimism, transport: http() });
await client.getBlockNumber(); // just works
Fees are two layers — and estimation already knows
This is the one place Optimism differs from Ethereum in a way you'll notice. Every transaction pays two components:
- An execution fee — ordinary EIP-1559 gas for running your transaction on the rollup. This part is minuscule: the base fee we sampled this morning was ~0.000001 gwei.
- An L1 data fee — the cost of posting your transaction's data to Ethereum (as blobs, since the 2024 upgrades). For calldata-heavy transactions, this component dominates.
The good news: you don't compute either by hand. eth_estimateGas returns an all-in figure — if the number looks larger than a naive 21,000-plus-calldata guess, that's the L1 data fee folded in at current prices, by design. eth_gasPrice likewise returns a combined price. Normal estimation flows with your usual buffer work unchanged (gas estimation basics apply as-is).
The OP Stack: skills that carry
Because the same codebase runs the family, an integration built for OP Mainnet is mostly configuration when it moves sideways:
- Same RPC surface — 2-second blocks, the same two-layer fee shape, optimistic-rollup semantics with each chain's own sequencer and proof setup.
- Same tooling story — viem/ethers chain definitions differ per network, but your indexer logic, subscription patterns, and receipt handling don't.
- Same operational habits — WebSocket subscriptions over polling at 2-second cadence (reorg and reconnection habits transfer), log range discipline unchanged.
SwiftNodes serves the family under one key — Optimism, Base, Zora, opBNB, Unichain, and Soneium — so a multi-chain product can treat the OP Stack family as one integration target with per-chain endpoints.
The one rough edge: traces are uneven
If there's a caveat on Optimism, it's the Parity trace namespace. The OP Stack's standard surface doesn't include trace_* methods, and where traces do appear they're often gated upstream — probing OP Mainnet through our routing this morning, archive-flavored queries returned provider gate messages rather than data. The honest pattern: check per-method, per-chain, and re-check — support genuinely varies by upstream mix. Our weekly auto-probed matrix does exactly that, with per-method detail pages like trace_filter and trace_transaction (and the longer treatment in our trace field guide).
Everything else is the standard EVM you expect: receipts, logs, subscriptions, and the usual error-code taxonomy when something rejects. Historical state (balances and receipts at old blocks) needs archive routing — on SwiftNodes that's &archive=1 on paid plans.
What carries over unchanged
eth_call,eth_getBalance,eth_getLogs,eth_getTransactionReceipt,eth_estimateGas,eth_sendRawTransaction,eth_subscribe— all standard behavior.- EIP-1559 fields and estimation flows (all-in numbers, buffer as usual).
- Solidity bytecode deploys as-is; the toolchain is untouched.
- WebSocket subscriptions are the right default at 2-second blocks.
- Cross-check method support in the live matrix rather than a feature table — especially for traces and debug methods.
The short version
Optimism (chain ID 10) is a mature optimistic rollup — ETH gas, 2-second blocks, fault proofs live since 2024 — and the origin of the OP Stack that powers Base, Zora, opBNB, Unichain, and Soneium. Fees come in two layers (a tiny execution base fee plus the L1 data fee), but eth_estimateGas returns an all-in figure so normal estimation flows work unchanged. The one thing to verify rather than assume is trace/debug method support, which varies by upstream. Everything else is standard EVM — and every skill transfers sideways across the Superchain family.
Shipping on OP Mainnet or its siblings? A flat-rate Optimism RPC endpoint gives you chain 10 over HTTP and WebSocket, load-balanced across upstreams, with the rest of the OP Stack family — and 75+ chains total — under the same key. Grab a free key and point your stack at:
https://rpc.swiftnodes.io/rpc/optimism?key=YOUR_API_KEY
wss://rpc.swiftnodes.io/ws/optimism?key=YOUR_API_KEY
John Sullivan covers RPC infrastructure, node operations, and multi-chain development at SwiftNodes — what it actually takes to keep endpoints fast, fresh, and reliable across EVM and non-EVM networks.
Related posts
- Fraxtal RPC: The OP Stack Chain That Doesn't Use ETH for Gas
Fraxtal is Frax Finance's OP Stack L2 (chain ID 252) with two twists most Superchain L2s don't have: gas is paid in FRAX, not ETH, and its Flox system pays contract developers FXTL points for the gas their users spend. It's standard EVM (viem/ethers/foundry work), with ~2s blocks and the usual ~7-day OP Stack withdrawal window. Here's the developer map.
- Unichain RPC: Uniswap's L2 for Developers
Unichain is Uniswap's own L2 — an OP Stack rollup on the Optimism Superchain, purpose-built for DeFi with ~1s blocks. It speaks standard eth_* JSON-RPC, so viem and ethers just work. Here's the chain ID, what carries over from Ethereum, and the Superchain and finality details that actually matter.
- Scroll RPC: The zkEVM That Runs Ethereum Bytecode Unchanged
Scroll is a bytecode-equivalent zkEVM rollup (chain ID 534352) — it targets opcode-level equality with Ethereum, so your existing contracts, audits, and tooling work with zero changes, while ZK validity proofs give ~1-hour hard finality instead of the 7-day optimistic window. Standard eth_* (viem/ethers/foundry). Here's the developer map, including how it differs from zkSync Era.