eth_call
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.
Parameters
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.value
[optional] hexadecimal value of the value sent with this transaction.
Request
The following example shows the balanceOf
function querying an ERC20 token.
Response
Return the contract execution result.
Last updated