This is the common JSON-RPC method. It is used to read the data in the smart contract in the blockchain. Because it is a read-only method, the call does not consume any gas fee.

We can call any function of the smart contract using the eth_call method, which returns data in hexadecimal format.

eth_call is used to call read-only functions of smart contracts. for example: call the balanceOf function of the ERC20 token contract.


  1. Object - [required] transaction call object

    • from [required] The address the transaction is sent from.

    • to [required] The address the transaction is directed to.

    • gas [optional] hexadecimal value of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.

    • gasPrice [optional] hexadecimal value of the gasPrice used for each paid gas.

    • maxPriorityFeePerGas [optional] Maximum fee, in Wei, the sender is willing to pay per gas above the base fee. See EIP-1559 transactions。

    • maxFeePerGas [optional] Maximum total fee (base fee + priority fee), in Wei, the sender is willing to pay per gas. See EIP-1559 transactions。

    • value [optional] hexadecimal value of the value sent with this transaction.

    • data [optional] Hash of the method signature and encoded parameters. See the Ethereum ABI specification.

  2. Block-Number - [required] a hexadecimal block number, or the string latest, earliest or pending. See the default block parameter.


The following example shows the balanceOf function querying an ERC20 token.

curl \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc": "2.0", "id": 1, "method": "eth_call", "params": [{"from":"0xff1231b8b8c3d87158927f21bb1d4be64ce20d08","to":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","data":"0x70a08231000000000000000000000000ff1231b8b8c3d87158927f21bb1d4be64ce20d08"},"latest"]}'


Return the contract execution result.

  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x00000000000000000000000000000000000000000000000000000004a817c800"

Last updated