Optimism RPC endpoint

Optimism mainnet JSON-RPC over HTTPS, with a free daily tier. Chain ID is 10 (0xa).

Chain ID

10

0xa

Network

mainnet

Free tier

10,000

requests/day per account · 10 req/s

Endpoints

HTTPPOST JSON-RPC · key in the URL path

texttext
https://ethras.org/v1/optimism/<YOUR_API_KEY>

WebSocketnot available on this network

WebSocket is not available on Optimism yet. Use HTTPS polling.

First call: eth_chainId

curl

bashbash
curl -s https://ethras.org/v1/optimism/<YOUR_API_KEY> \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'

ethers v6

tsts
// ethers v6
import { JsonRpcProvider } from 'ethers'
const provider = new JsonRpcProvider('https://ethras.org/v1/optimism/<YOUR_API_KEY>')
console.log((await provider.getNetwork()).chainId) // 10n

viem

tsts
// viem
import { createPublicClient, http } from 'viem'
const client = createPublicClient({ transport: http('https://ethras.org/v1/optimism/<YOUR_API_KEY>') })
console.log(await client.getChainId()) // 10

Response

jsonjson
{
"jsonrpc": "2.0",
"id": 1,
"result": "0xa"
}

Available methods

Frequently asked questions

What is the Optimism RPC endpoint format?

Send JSON-RPC POST requests to https://ethras.org/v1/optimism/<YOUR_API_KEY>. The API key is part of the URL path rather than a header, so keep it in a backend or an environment variable and never in client-side code.

How many requests can I make for free?

The Free plan allows 10,000 requests per day and 10 requests per second per account — all keys and all chains share the same pool. It resets at 00:00 UTC; when the pool is used up, keys pause until the reset.

Does Optimism support WebSocket?

WebSocket is not available on Optimism yet. Use HTTPS polling; the WebSocket topic covers the chains where subscriptions are enabled.

WebSocket subscriptions

What do common errors mean?

HTTP 429 means the account exceeded its requests-per-second limit. When the daily pool is used up, keys stop working until 00:00 UTC and requests fail with the gateway's "api-key not found" error. The error reference lists each code with a real response sample.