eth_estimateGas
Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.
Parameters
Transaction(object)requiredTransaction object generic to all types
Block(object)Block number or tag
Returns
hex encoded unsigned integer
Example request
await provider.request({
method: "eth_estimateGas",
params: [
{
"from": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
"to": "0x44aa93095d6749a706051658b970b941c72c1d53",
"value": "0x1"
},
null
]
});
Example response
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x5208"
}