Optimism
Optimism
Optimism
Free tier covers personal projects. Pay-as-you-go scales without a card.
eth_gasPrice returns the node's suggested legacy gas price for OP Mainnet, expressed in ETH wei. It is a single combined number useful for a quick read of current L2 fee conditions or for filling the gasPrice field of a type-0 transaction. Because OP Mainnet supports EIP-1559, this value is derived from the base fee plus a tip and tends to overestimate for type-2 transactions. Query https://optimism.therpc.io/YOUR_API_KEY (chain ID 10, 0xa) to fetch it.
gasPrice field when constructing a legacy (type-0) transaction for tooling that doesn't speak EIP-1559.eth_feeHistory percentiles to cross-check your OP Mainnet fee estimate.This method takes no parameters. Pass an empty array [].
| Type | Description |
|---|---|
| string (hex) | Hex-encoded gas price in wei (e.g. "0x4a817c800" = 20 gwei). |
Try it live in the Optimism playground.
| Code | Message | Cause |
|---|---|---|
-32603 | Internal error | Node could not estimate current gas price. |
eth_maxPriorityFeePerGas plus eth_feeHistory when building type-2 transactions.