Skip to main content

eth_estimateGas

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

Params

(2)

1. tx (required)

from
any
to
any
gas
any
maxFeePerGas
string or null
maxPriorityFeePerGas
string or null
value
any
input
any
data
any
nonce
any
chainId
any
accessList
any

2. block (required)

(any of)
integer
>= 0

Result

(Quantity)
integer
>= 0

Example

Request

await window.ethereum.request({
"method": "eth_estimateGas",
"params": [
{
"accessList": null,
"chainId": null,
"data": null,
"from": null,
"gas": null,
"input": null,
"maxFeePerGas": "0x0",
"maxPriorityFeePerGas": "0x0",
"nonce": null,
"to": null,
"value": null
}
]
});

Result

null

Params

tx

block


Request

await window.ethereum.request({
"method": "eth_estimateGas",
"params": [
null,
null
]
});