Estimates the amount of gas required to execute a transaction. The estimate may be higher than the gas actually used at execution time.
Parameters
The transaction object to estimate gas for. Show Transaction object fields
The 20-byte address the transaction is sent from. Optional.
The 20-byte destination address. Required for contract calls; omit for contract deployments.
Gas limit for the estimate. Optional.
Gas price in wei for legacy transactions. Optional.
EIP-1559 maximum total fee per gas. Optional.
EIP-1559 maximum priority fee per gas. Optional.
ETH value to send with the transaction in wei. Optional.
ABI-encoded call data. Optional.
Optional block to estimate against. Defaults to latest.
Returns
The estimated gas amount as a hexadecimal integer.
Flashblocks Behavior
On a Flashblocks-aware endpoint , use "pending" as the block parameter to query preconfirmed state — data available up to 200ms before the next full block is sealed.
Estimates gas against the latest preconfirmed Flashblock state. Use "pending" to get an estimate based on the most current state, reducing the chance of reverts due to stale state.
cURL (preconfirmed state)
curl https://mainnet-preconf.base.org \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"from":"0xd3CdA913deB6f4967b2Ef66ae97DE114a83bcc01","to":"0x4200000000000000000000000000000000000006","value":"0x2c68af0bb14000"},"pending"],"id":1}'
Example
{
"jsonrpc" : "2.0" ,
"method" : "eth_estimateGas" ,
"params" : [
{
"from" : "0xd3CdA913deB6f4967b2Ef66ae97DE114a83bcc01" ,
"to" : "0x4200000000000000000000000000000000000006" ,
"value" : "0x2c68af0bb14000"
}
],
"id" : 1
}
Errors
Code Message Description -32000execution reverted The transaction would revert. The error data may contain a revert reason.