cfx_estimateGasAndCollateral
Return estimated gas and collateral usage.
- CURL
curl --request POST \
--url https://main.confluxrpc.com \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"params": [null,null],
"method": "cfx_estimateGasAndCollateral"
}'
Params
request required
The MAX_GAS_CALL_REQUEST is used as max value of cfx_call or cfx_estimate's gas value to prevent call_virtual consumes too much resource. The tx_pool will reject the tx if the gas is larger than half of the block gas limit. which is 30_000_000 before 1559, and 60_000_000 after 1559.pub const MAX_GAS_CALL_REQUEST: u64 = 15_000_000;
type : object
accessList accessList
type : arrayitems[x]CfxAccessListItemtype : 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 :^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$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)$storageLimit storageLimit
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,15}|0)$to to
type : stringPattern :^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$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)$
epoch_number optional
Represents rpc api epoch number param.
oneOf
- U64
- string
type : string
Pattern :
^0x([1-9a-f][0-9a-f]{0,15}|0)$type : string
Possible values :
earliestlatest_checkpointlatest_finalizedlatest_confirmedlatest_statelatest_mined
Result
Schema
type : object
gasLimit gasLimit
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$gasUsed gasUsed
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$storageCollateralized storageCollateralized
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,15}|0)$