eth_call - AVAX

Example code for the eth_call JSON-RPC method. Complete guide on how to use eth_call JSON-RPC in GetBlock Web3 documentation.

Executes a read-only call against C-Chain contract state without committing a transaction. Use it to query contract data through view/pure functions or to simulate state-changing calls without paying gas.

Parameters

Parameter
Type
Required
Description

callObject

object

Yes

Transaction-shaped object with to, data, and optional from, gas, gasPrice, value

blockParameter

string

Yes

Block number in hex, or block tag

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/ext/bc/C/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_call",
    "params": [
        {
            "to": "0x9e7c5e3e3a3b8e1aa0e2d4c7f9d4b0c8b8d5f1a2",
            "data": "0x70a08231000000000000000000000000d85498dbeaeb1df24be52eed4f52eac2fbd56245"
        },
        "latest"
    ],
    "id": "getblock.io"
}'

Response Example

Response Parameters

Field
Type
Description

result

string

ABI-encoded return value of the called function (hex)

Use Cases

  • Reading ERC-20 balances via balanceOf

  • Querying DEX pool reserves and prices (Trader Joe, Pangolin)

  • Simulating swaps and complex multi-call sequences

  • Reading NFT ownership and metadata

Error Handling

Status Code
Error Message
Cause

404

Not found

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

429

Too Many Requests

Rate limit exceeded for your plan

-32000

Execution reverted

The contract call reverted; check the data field for the revert reason

SDK Integration

Last updated

Was this helpful?