Skip to content

eth_estimateGas ​

served · same as reth

Returns an estimate of the gas that a transaction needs.

When to use ​

Use it to set the gas field of a transaction before you sign and send it.

Example ​

bash
curl -s -X POST -H 'Content-Type: application/json' \
  --data '{"jsonrpc": "2.0", "id": 1, "method": "eth_estimateGas", "params": [{"to": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "data": "0x18160ddd"}, "0x18facad"]}' \
  http://127.0.0.1:8547
json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_estimateGas",
  "params": [
    {
      "to": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "data": "0x18160ddd"
    },
    "0x18facad"
  ]
}

Response ​

Live mainnet, block 26193069, 2026-10-14. Checked against reth 2.7: equal.

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x7987"
}

Full response

Parameters ​

NameTypeRequiredMeaning
callobject, see Transaction call objectyesThe transaction to estimate. All fields are optional.
blockblock number in hex, or a tag, see Block parameternoThe block whose state the estimate uses. The head or one of the 128 blocks before it. Default: latest.
stateOverridesobject, see State overridenoChanges to the state before the estimate.
blockOverridesobject, see Block overridenoChanges to the block fields of the estimate, for example the gas limit.

The main fields of call. The Transaction call object page has all of them.

FieldTypeMeaning
fromaddressThe sender. Default: the zero address.
toaddressThe contract or account to call. Leave it out to deploy the code in input.
gashex numberThe gas limit. Default: the gas cap of the node (--rpc-gascap, 50 000 000). A larger value gets the gas cap.
valuehex number, weiThe ether to send with the call. Default: 0.
inputhex dataThe call data: the function selector and the arguments. data is also accepted. If both are present and not equal, the call gives -32602, as in reth. eth_simulateV1 then uses input.

Returns ​

The gas as a hex number, for example 0x5208 (21 000) for a plain transfer.

Notes and limits ​

  • The node uses the algorithm of reth. It runs the call more than once and searches for the lowest gas limit that works.
  • The runs of one estimate read each account, storage slot and code from the database one time. They also share the jump analysis of the code. Thus the later runs are faster. The answer does not change.
  • The search stops when the bounds are within 1.5 %. So the estimate can be up to 1.5 % above the exact minimum.
  • A plain transfer to an account without code returns 21 000 after one run.
  • The upper bound is the gas limit of the block, or the gasLimit block override. Since the Osaka fork, the upper bound is at most 16 777 216 (EIP-7825).

Errors ​

CodeMessageWhen
3execution reverted: <reason>The transaction reverts with any gas limit.
-32000gas required exceeds allowance (N)The transaction needs more gas than the upper bound or the sender can pay for.
-32003out of gas: gas required exceeds: NThe transaction runs out of gas at the upper bound.
-32003insufficient funds for gas * price + value: have X want YThe value is above the balance. The call has a gas price.
-32000max fee per gas less than block base feemaxFeePerGas is below the base fee. When maxFeePerGas and the tip are both 0, this error does not occur.
-32003max priority fee per gas higher than max fee per gasmaxPriorityFeePerGas is above maxFeePerGas.
-32602both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specifiedThe call has gasPrice and also an EIP-1559 or blob fee field.
-32003blob transaction missing blob hashesThe call has maxFeePerBlobGas but no blob hashes, or blobVersionedHashes is empty.
-32602Invalid paramsA fee value is larger than 128 bits. data gives the value and its column.
-32602Invalid paramsA parameter is missing or does not parse. data has the text of reth, with the position.

Compared with reth ​

The same algorithm as reth (crates/rpc/rpc-eth-api, estimate.rs): the same bounds, the same 1.5 % stop rule and the same errors.

The live example above gives the same answer on Cinder and on reth 2.7.

Speed against reth ​

ERC-20 transfer1.03x faster
Cinder0.43 ms
reth0.45 ms
Median, reth 2.7, 2026-10-17. Shorter is better.

eth_call, eth_createAccessList, eth_gasPrice.

Schema (OpenRPC) ​

The official specification: eth_estimateGas in ethereum/execution-apis.

Parameter Transaction: object
json
{
  "additionalProperties": false,
  "properties": {
    "accessList": {
      "description": "EIP-2930 access list",
      "items": {
        "additionalProperties": false,
        "properties": {
          "address": {
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "title": "hex encoded address",
            "type": "string"
          },
          "storageKeys": {
            "items": {
              "pattern": "^0x[0-9a-f]{64}$",
              "title": "32 byte hex value",
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "address",
          "storageKeys"
        ],
        "title": "Access list entry",
        "type": "object"
      },
      "title": "accessList",
      "type": "array"
    },
    "authorizationList": {
      "description": "EIP-7702 authorization list",
      "items": {
        "properties": {
          "address": {
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "title": "hex encoded address",
            "type": "string"
          },
          "chainId": {
            "description": "Chain ID on which this transaction is valid",
            "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
            "title": "chainId",
            "type": "string"
          },
          "nonce": {
            "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
            "title": "nonce",
            "type": "string"
          },
          "r": {
            "pattern": "^0x(0|[1-9a-f][0-9a-f]{0,63})$",
            "title": "r",
            "type": "string"
          },
          "s": {
            "pattern": "^0x(0|[1-9a-f][0-9a-f]{0,63})$",
            "title": "s",
            "type": "string"
          },
          "yParity": {
            "description": "The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature",
            "pattern": "^0x([0-9a-fA-F]?){1,2}$",
            "title": "yParity",
            "type": "string"
          }
        },
        "required": [
          "chainId",
          "nonce",
          "address",
          "yParity",
          "r",
          "s"
        ],
        "type": "object"
      },
      "title": "authorizationList",
      "type": "array"
    },
    "blobVersionedHashes": {
      "description": "List of versioned blob hashes associated with the transaction's EIP-4844 data blobs.",
      "items": {
        "pattern": "^0x[0-9a-f]{64}$",
        "title": "32 byte hex value",
        "type": "string"
      },
      "title": "blobVersionedHashes",
      "type": "array"
    },
    "blobs": {
      "description": "Raw blob data.",
      "items": {
        "pattern": "^0x[0-9a-f]*$",
        "title": "hex encoded bytes",
        "type": "string"
      },
      "title": "blobs",
      "type": "array"
    },
    "chainId": {
      "description": "Chain ID that this transaction is valid on.",
      "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
      "title": "chainId",
      "type": "string"
    },
    "from": {
      "pattern": "^0x[0-9a-fA-F]{40}$",
      "title": "from address",
      "type": "string"
    },
    "gas": {
      "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
      "title": "gas limit",
      "type": "string"
    },
    "gasPrice": {
      "description": "The gas price willing to be paid by the sender in wei",
      "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
      "title": "gas price",
      "type": "string"
    },
    "input": {
      "pattern": "^0x[0-9a-f]*$",
      "title": "input data",
      "type": "string"
    },
    "maxFeePerBlobGas": {
      "description": "The maximum total fee per gas the sender is willing to pay for blob gas in wei",
      "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
      "title": "max fee per blob gas",
      "type": "string"
    },
    "maxFeePerGas": {
      "description": "The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei",
      "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
      "title": "max fee per gas",
      "type": "string"
    },
    "maxPriorityFeePerGas": {
      "description": "Maximum fee per gas the sender is willing to pay to miners in wei",
      "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
      "title": "max priority fee per gas",
      "type": "string"
    },
    "nonce": {
      "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
      "title": "nonce",
      "type": "string"
    },
    "to": {
      "oneOf": [
        {
          "title": "Contract Creation (null)",
          "type": "null"
        },
        {
          "pattern": "^0x[0-9a-fA-F]{40}$",
          "title": "Address",
          "type": "string"
        }
      ],
      "title": "to address"
    },
    "type": {
      "pattern": "^0x([0-9a-fA-F]?){1,2}$",
      "title": "type",
      "type": "string"
    },
    "value": {
      "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
      "title": "value",
      "type": "string"
    }
  },
  "title": "Transaction object generic to all types",
  "type": "object"
}
Parameter Block: Block number or Block tag
json
{
  "oneOf": [
    {
      "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
      "title": "Block number",
      "type": "string"
    },
    {
      "description": "`earliest`: The lowest numbered block the client has available; `finalized`: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; `safe`: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; `latest`: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions; `pending`: A sample next block built by the client on top of `latest` and containing the set of transactions usually taken from local mempool. Before the merge transition is finalized, any call querying for `finalized` or `safe` block MUST be responded to with `-39001: Unknown block` error",
      "enum": [
        "earliest",
        "finalized",
        "safe",
        "latest",
        "pending"
      ],
      "title": "Block tag",
      "type": "string"
    }
  ],
  "title": "Block number or tag"
}
Result: string
json
{
  "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
  "title": "hex encoded unsigned integer",
  "type": "string"
}