Skip to main content

eth_call

Overview

The 'eth_call' method executes a new message call immediately without creating a transaction on the blockchain. This method is useful for querying data from the Ethereum blockchain without making any changes to the state.

Request

curl --request POST \
--url https://ethereum-mainnet-geth-archive.node.coinapi.io \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY" \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x00",
"gasPrice": "0x09184e72a000",
"value": "0x00",
"data": "0x"}
]
}'

Gas Parameter Limitation

To ensure the stability of our platform and prevent potential abuse, the 'gas' parameter in "eth_estimateGas" and this "eth_call" method is capped at 10x (1000%) the current block gas limit.

Request Parameters

  • "from": 20 bytes - [ Required ] Address the transaction is sent from.
  • "to": 20 bytes - Address the transaction is directed to.
  • 'gas': Hexadecimal value of the gas provided for the transaction execution. While 'eth_call' consumes zero gas, this parameter may be needed by some executions.
  • 'gasPrice': Hexadecimal value of the gasPrice used for each paid gas.
  • 'maxPriorityFeePerGas': Maximum fee, in Wei, the sender is willing to pay per gas above the base fee. (Relevant for EIP-1559 transactions)
  • 'maxFeePerGas': Maximum total fee (base fee + priority fee), in Wei, the sender is willing to pay per gas. (Relevant for EIP-1559 transactions)
  • 'value': Hexadecimal of the value sent with this transaction.
  • 'data': Hash of the method signature and encoded parameters. Refer to the Ethereum contract ABI specification for more details.
  • 'block parameter': [ Required ] A hexadecimal block number, or the string 'latest', 'earliest' or 'pending'.

Response

{
"jsonrpc": "2.0",
"id": 1,
"result": "0xb1770efb14906e509893b6190359658208ae64d0c56e22f748a1b0869885559e"
}

The returned value of the executed contract. If this call causes the EVM to execute a ''REVERT'' operation, an error response is returned with the revert reason pre-decoded as a string.