eth_estimateGas
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.
- CURL
curl --request POST \
--url https://evm.confluxrpc.com \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"params": [null,null],
"method": "eth_estimateGas"
}'
Params
transaction required
Call request
type : object
accessList accessList
type : arrayitems[x]
AccessListItemtype : objectaddress address
type : stringPattern :^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
storageKeys storageKeys
type : arrayitems[x]
H256type : stringPattern :^0x[0-9,a-f,A-F]{64}$
data data
type : stringPattern :^0x[0-9a-f]*$
from from
type : stringPattern :^0x[0-9,a-f,A-F]{40}$
gas gas
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
gasPrice gasPrice
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
maxFeePerGas maxFeePerGas
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
maxPriorityFeePerGas maxPriorityFeePerGas
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
nonce nonce
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
to to
type : stringPattern :^0x[0-9,a-f,A-F]{40}$
transactionType transactionType
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,15}|0)$
value value
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
block optional
Block Number or Tags
oneOf
- U64
- BlockHash
- BlockNumber
- string
type : string
Pattern :
^0x([1-9a-f][0-9a-f]{0,15}|0)$
type : object
blockHash string required
type : stringPattern :^0x[0-9,a-f,A-F]{64}$
requireCanonical boolean
type : boolean
type : object
blockNumber string required
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,15}|0)$
type : string
Possible values :
earliest
latest
pending
Result
Schema
type : string
Pattern :
^0x([1-9a-f][0-9a-f]{0,63}|0)$