Skip to main content

eth_estimateGas

POST

Estimates the gas required to execute a transaction. Estimates gas only; does not broadcast the transaction.
param[0]
callObjectobjectrequired
Call object for simulating a transaction. May include:
  • from: Sender address as a string.
  • to: Recipient address as a string.
  • gas: Gas limit as a hex string. Use 0x0 for smart contract calls.
  • gasPrice: Gas price per unit as a hex string.
  • value: Transaction value.
  • data: Method signature hash. See ABI for reference.
fromstring
The transaction sender (from) address as a string.
tostring
The transaction recipient (to) address as a string.
gasstring
The gas limit for the transaction as a hex string. For smart contract calls, use 0x0 since no gas is consumed.
gasPricestring
The gas price per unit as a hex string.
valuestring
The value (amount) for the transaction.
datastring
The method signature hash of the call. See ABI for reference.
Responses
codestringrequired
Code identifying the cause of the failed request.
messagestringrequired
Detailed message including the name and value of the invalid parameter.
{
"code": "ERROR_CODE",
"message": "Unauthorized"
}
cURL
curl -X POST 'https://ethereum-mainnet.nodit.io' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: nodit-demo' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_estimateGas",
"params": [
{
"from": "0xc90d3Ac75D1D36dF0b0a229E73D8409FB7F3c4ab",
"to": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"value": "0x186a0",
"data": "0x70a08231000000000000000000000000d8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}
]
}'