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.
| Parameter | Type | Required | Description |
|---|---|---|---|
Transaction | Transaction object | Yes | Transaction fields for the call. |
Block | Block number, tag, or EIP-1898 hash selector | No | The state is the one after the block has been executed. |
Transaction fields
| Field | Meaning |
|---|---|
from | Sender address used during execution |
to | Destination address; omit for contract creation where supported |
data or input | Encoded call data or contract creation code; use one field |
value | Value transferred in wei, as a hexadecimal quantity |
gas | Gas allowance for the simulation, as a hexadecimal quantity |
gasPrice | Legacy gas price in wei; use instead of EIP-1559 fee fields |
maxFeePerGas, maxPriorityFeePerGas | EIP-1559 fee limits in wei, where applicable |
accessList | Addresses 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.