eth_call - HyperEVM

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

This method executes a new message call immediately without creating a transaction on the blockchain.

Parameters

Parameter
Type
Required
Description

transaction

object

Yes

Transaction call object.

block

string

Yes

Block parameter (only "latest" supported).

Transaction Object

Field
Type
Required
Description

from

string

No

Sender address.

to

string

Yes

Contract address to call.

gas

string

No

Gas limit (hex).

gasPrice

string

No

Gas price (hex).

value

string

No

Value to send (hex).

data

string

No

Encoded function call data.

Request

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

Response

Response Parameters

Field
Type
Description

result

string

Return data from the contract call (hex).

Use Case

The eth_call method is essential for:

  • Reading smart contract state

  • Token balance queries (ERC-20 balanceOf)

  • Price feed lookups

  • Simulating transactions before sending

  • DeFi protocol integrations

Error Handling

Error Code
Message
Cause

-32602

Invalid params

Invalid transaction object.

-32603

Internal error

Contract execution error.

3

Execution reverted

Contract reverted the call.

Web3 Integration

Last updated

Was this helpful?