cfx_call
Call contract, returning the output data.
- 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_call"
}'
Params
tx 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)$
block_hash_or_epoch_number optional
Schema
type : any
Always valid
Result
Schema
type : string
Pattern :
^0x[0-9a-f]*$