eth_estimateGas

OptimismC1

Simulates a transaction to estimate the gas required for it to succeed. Useful before signing to set a safe gas limit; the call reverts (with reason) if the transaction would fail.

Endpoint
POST https://api.1st-node.com/v1/optimism/rpc

Parameters

NameTypeDescription
callObjectObjectThe transaction fields to estimate for.
blockQUANTITY | TAGOptional state to estimate against.

Returns

QUANTITY — the estimated gas amount, hex-encoded.

Request

curl https://api.1st-node.com/v1/optimism/rpc \
  -H "Authorization: Bearer $ONE_KEY" \
  -H "content-type: application/json" \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_estimateGas",
  "params": [{ "to": "0xdac17f…", "data": "0xa9059cbb…" }]
}'
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_estimateGas",
  "params": [{ "to": "0xdac17f…", "data": "0xa9059cbb…" }]
}

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xcb28"
}
More transactions methods on Optimism

Optimism API

Пополнили, получили ключ, запустили.

Полное самообслуживание. Оплата криптой или картой. Тарификация в кредитах — тяжёлые примитивы дороже, простые дёшевы.

Получить API-ключ