Optimism gas estimate
Estimate the gas a transaction would use on Optimism (eth_estimateGas) and what it would cost at the current gas price, in gas units, gwei and ETH. Give to, plus value in ETH and calldata for a contract call, and the sender when the call depends on it. Use before sending a transaction or to price a batch; for the gas price alone use op_gas. A transaction that would revert is 422 with the reason, uncharged.
Inputs
| Name | Type | Description |
|---|---|---|
to (required) | string | 0x recipient or contract address |
from | string | 0x sender address (default: an empty address) |
value | string | Amount of ETH to send, in ETH (default 0) |
data | string | Optional 0x calldata for a contract call |
Request
Over HTTP, with a card key from /credits:
curl -H "Authorization: Bearer adt_…" "https://agent-data-tools.revmesh2074.workers.dev/op/estimate-gas?to=0x000000000000000000000000000000000000dEaD"
Or one of your 25 free calls, no key:
curl "https://agent-data-tools.revmesh2074.workers.dev/op/estimate-gas?to=0x000000000000000000000000000000000000dEaD&trial=1"
Without a key, the same URL answers 402 Payment Required with x402 and MPP terms, so an agent with a wallet pays per call in USDC (Base, Polygon, Arbitrum or Solana over x402; Base or Tempo over MPP) and retries.
Example result
{
"chain": "Optimism",
"chainId": 10,
"to": "0x000000000000000000000000000000000000dEaD",
"from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"value": "0",
"gas": "21000",
"gasPriceGwei": "0.012",
"cost": "0.000000252",
"symbol": "ETH",
"block": 123456789
}
From an AI agent (MCP)
Add the MCP server to Claude, Cursor or any MCP client. This tool is op_estimate_gas, and the first 25 successful calls are free:
https://agent-data-tools.revmesh2074.workers.dev/mcp