Pre-alphaWork in progress
Skip to content

eth_estimateGas ​

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.

Ethereum specification · All supported methods

Parameters ​

Parameters are positional, in the order below.

ParameterTypeRequiredDescription
TransactionTransaction objectYesTransaction fields for the call.
BlockBlock number, tag, or EIP-1898 hash selectorNoThe state is the one after the block has been executed.

Transaction fields ​

FieldMeaning
fromSender address used during execution
toDestination address; omit for contract creation where supported
data or inputEncoded call data or contract creation code; use one field
valueValue transferred in wei, as a hexadecimal quantity
gasGas allowance for the simulation, as a hexadecimal quantity
gasPriceLegacy gas price in wei; use instead of EIP-1559 fee fields
maxFeePerGas, maxPriorityFeePerGasEIP-1559 fee limits in wei, where applicable
accessListAddresses and storage keys supplied for execution

Return value ​

The estimated execution gas as a hexadecimal quantity. It is an estimate, not a guarantee that a later transaction will succeed.

Example ​

Replace <gateway-url> with your gateway base URL and <service-url> with the chain’s service path, such as service/ethereum.

sh
curl -X POST "<gateway-url>/<service-url>" \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_estimateGas","params":[{"from":"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73","to":"0x44aa93095d6749a706051658b970b941c72c1d53","value":"0x1"}]}'

Illustrative response; values depend on the selected network and request:

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x5208"
}

Direct behavior ​

State at the network head and its 128 preceding blocks is available through the recent service. Older state requests are automatically routed to providers with archive state.

Requests using latest follow Direct’s reference-block rules. The selected reference is preserved during recovery; separate requests can see a newer reference.

For providers ​

Support the recent-state window and the covered EIP-1898 selectors, including requireCanonical. Historical requests require verified archive state.

See provider qualification for checks and continued eligibility.

Unstoppable Infrastructure.