cfx_call - Conflux

Virtually calls a contract, returns the output data. The transaction will not be added to the blockchain.

Parameters

  • Object - a call request object:
    • from: BASE32 - (optional, default: random address) Address of sender.
    • to: BASE32 - (optional, default: null for contract creation) Address of receiver.
    • gasPrice: QUANTITY - (optional, default: 0) Gas price provided by the sender in Drip.
    • gas: QUANTITY - (optional, default: 500000000) Gas provided by the sender.
    • value: QUANTITY - (optional, default: 0) Value transferred in Drip.
    • data: DATA - (optional, default: 0x) The data send along with the transaction.
    • nonce: QUANTITY - (optional, default: 0) The number of transactions made by the sender prior to this one.
  • QUANTITY|TAG - (optional, default: "latest_state") Integer epoch number, or the string "latest_state", "latest_confirmed", "latest_checkpoint" or "earliest", see the epoch number parameter

Returns

DATA, Bytes - The output data, or an execution error.


Example

Request

curl -X POST \
--data '{"jsonrpc":"2.0","method":"cfx_call","params": [{"from":"cfx:type.user:aarc9abycue0hhzgyrr53m6cxedgccrmmyybjgh4xg","to":"cfx:type.contract:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp","data":"0xa6f2ae3a","gasPrice":"0x2540be400","nonce":"0x0"}],"id":1}' \
-H "Content-Type: application/json" \
https://cfx-core.unifra.io/v1/ad2eb3c7a9404cc6a35a6641eaf70577 


Result

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32015,
        "message": "Transaction reverted",
        "data": "0x"
    },
    "id": 0
}
Language
URL
Click Try It! to start a request and see the response here!