JSON-RPCMethods
eth_estimateGas: parameters, returns and CU
Estimate the gas limit a transaction would need.
Summary
Estimate the gas limit a transaction would need.
Compute units (CU) and pricing
CU per call
20 CU
Price per 1M calls (USD)
$2.00
Parameters
| Parameter | Type | Description |
|---|---|---|
transaction | object | Transaction call object that may include from, to, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, value and data/input; it is only simulated and changes no on-chain state. Quantity fields value, gas, gasPrice, maxFeePerGas and maxPriorityFeePerGas encode nonnegative integers minimally in hex: 0x0 is zero and 0x1 is one; 0x, 0x00 and 0x01 are not valid Quantity. data/input is complete-bytes Data: 0x is empty, 0x00 is one zero byte, 0x0001 is two bytes, and leading zeros in Data must be preserved. Never treat addresses, hashes, signatures or arbitrary 0x fields as Quantity. |
blockParameter | QUANTITY|TAG | Optional block number or tag for the estimate: latest or pending; safe, finalized and earliest return -32011 (not billed); defaults to the latest block. |
Returns
- Type:
QUANTITY - Description: Estimated gas amount as a 0x-prefixed hexadecimal quantity.
Notes
The estimate runs against the state of the given block; if the call would revert, clients normally return an error instead of a number.
Request example
export BLOCKVECTRA_API_KEY=rgw_your_api_key
curl -X POST "https://api.blockvectra.com/v1/robinhood_mainnet" \
-H 'Content-Type: application/json' \
-H "x-api-key: $BLOCKVECTRA_API_KEY" \
-d '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [
{
"to": "0x0000000000000000000000000000000000000000",
"data": "0x"
},
"latest"
],
"id": 1
}'Supported chains
Available on all 29 supported chains.
Related references
Last updated: