post https://polygon-mainnet-rpc.allthatnode.com:8545/
Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.
Parameters
Object
- The transaction call objectfrom
:DATA
, 20 Bytes - (optional) The address the transaction is sent from.to
:DATA
, 20 Bytes - The address the transaction is directed to.gas
:QUANTITY
- (optional) Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.gasPrice
:QUANTITY
- (optional) Integer of the gasPrice used for each paid gasvalue
:QUANTITY
- (optional) Integer of the value sent with this transactiondata
:DATA
- (optional) Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI in the Solidity documentation.
QUANTITY
|TAG
- integer block number, or the string "latest", "earliest" or "pending", see the default block parameter
curl --request POST \
--url https://polygon-mainnet-archive.allthatnode.com/8U3JLUhzIDg3GShvy9hkCCSYkLGc11kj \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [
{
"from": "0x014e32b21c634259b1a281ceae50ba88979cd084",
"to": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
"data": "0x095ea7b3000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c800000000000000000000000000000000000000000000000000925f2e84bf0000"
},
"latest"
]
}
'
Returns
QUANTITY
- the amount of gas used.
{"jsonrpc":"2.0","id":1,"result":"0x7268"}