Skip to main content

eth_createAccessList

Overview

The 'eth_estimateGas' method generates and returns an estimate of how much gas is necessary for a transaction to complete. It's important to note that this transaction will not be added to the blockchain. The estimate might be significantly more than the actual gas used due to various reasons, including EVM mechanics and node performance.

Gas Parameter Limitation

To ensure the optimal performance and security of our API, the gas parameter in the eth_estimateGas method (as well as in eth_call) is capped at 10 times (1000%) the current block gas limit. If you're testing this in a local environment (e.g., ganache, besu, geth), you can replicate this behavior using the rpc.gascap command-line option.

Request

curl --request POST \
--url https://ethereum-mainnet-geth-archive.node.coinapi.io \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [
{
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x00",
"gasPrice": "0x09184e72a000",
"value": "0x00",
"data": "0x"
},
{
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x00",
"gasPrice": "0x09184e72a000",
"value": "0x00",
"data": "0x"
}
]
}
'

Request Parameters

  • block number: [required] A string representing a block number, or one of the string tags: 'latest', 'earliest', or 'pending'.

  • TRANSACTION CALL OBJECT [required]:

    • 'from': [optional] 20 Bytes - The address the transaction originates from.
    • 'to': 20 Bytes - The destination address of the transaction.
    • 'gas': [optional] Hexadecimal value representing the gas provided for the transaction execution. While eth_estimateGas consumes no gas, this parameter might be needed in certain scenarios.
    • 'gasPrice': [optional] Hexadecimal value of the gas price for each unit of gas.
    • 'maxPriorityFeePerGas': [optional] Maximum fee, in Wei, the sender is willing to pay per gas above the base fee.
    • 'maxFeePerGas': [optional] Maximum total fee (base fee + priority fee), in Wei, the sender is willing to pay per gas.
    • 'value': [optional] Hexadecimal value of the amount sent with the transaction.
    • 'data': [optional] Hash of the method signature and encoded parameters.

    If no gas limit is specified, the system uses the block gas limit from the pending block as an upper bound. This means the returned estimate might not be sufficient if the required gas exceeds the pending block gas limit.

Response

{
"jsonrpc": "2.0",
"id": 1,
"result": "0xb1770efb14906e509893b6190359658208ae64d0c56e22f748a1b0869885559e"
}

A hexadecimal representation of the estimated gas for the provided transaction.

If the call results in an EVM REVERT operation, an error response is returned with the revert reason pre-decoded as a string