eth_call

Execute a call without creating a transaction.

Description

Executes a new message call immediately without creating a transaction on the blockchain. eth_call is the most common method for reading data from smart contracts deployed on HyperEVM — checking token balances, reading contract state, simulating transactions before sending them.

Parameters

The method accepts two parameters: a transaction object and a block parameter.

Field

Required

Description

to

Yes

The contract address to call

data

Yes

ABI-encoded function call data

from

No

Address the call is sent from. Useful when the contract checks msg.sender

gas

No

Gas limit for the call. Defaults to a high value

gasPrice

No

Gas price in wei. Not relevant for read-only calls but accepted

value

No

Wei value to send with the call. Usually 0 for reads

The second parameter is the block parameter (required): use "latest" for current state, a hex block number like "0x1a2b3c", or "pending".

Request example

Call the balanceOf function on an ERC-20 contract:

curl -X POST https://rpc.hyperpc.app/YOUR-ENDPOINT-ID \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_call",
    "params": [{
      "to": "0xCONTRACT_ADDRESS",
      "data": "0x70a08231000000000000000000000000WALLET_ADDRESS"
    }, "latest"],
    "id": 1
  }'
curl -X POST https://rpc.hyperpc.app/YOUR-ENDPOINT-ID \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_call",
    "params": [{
      "to": "0xCONTRACT_ADDRESS",
      "data": "0x70a08231000000000000000000000000WALLET_ADDRESS"
    }, "latest"],
    "id": 1
  }'
curl -X POST https://rpc.hyperpc.app/YOUR-ENDPOINT-ID \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_call",
    "params": [{
      "to": "0xCONTRACT_ADDRESS",
      "data": "0x70a08231000000000000000000000000WALLET_ADDRESS"
    }, "latest"],
    "id": 1
  }'

The data field encodes the function selector 0x70a08231 (first 4 bytes of the keccak256 hash of balanceOf(address)) followed by the address parameter padded to 32 bytes.

Response

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

The result is the ABI-encoded return value. For balanceOf, this is a uint256 representing the token balance. Decode it using your preferred library.

Using with ethers.js

import { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider(
  'https://rpc.hyperpc.app/YOUR-ENDPOINT-ID'
);

const erc20Abi = ['function balanceOf(address) view returns (uint256)'];
const contract = new ethers.Contract(tokenAddress, erc20Abi, provider);
const balance = await contract.balanceOf(walletAddress);

console.log('Balance:', ethers.formatUnits(balance, 18));
import { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider(
  'https://rpc.hyperpc.app/YOUR-ENDPOINT-ID'
);

const erc20Abi = ['function balanceOf(address) view returns (uint256)'];
const contract = new ethers.Contract(tokenAddress, erc20Abi, provider);
const balance = await contract.balanceOf(walletAddress);

console.log('Balance:', ethers.formatUnits(balance, 18));
import { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider(
  'https://rpc.hyperpc.app/YOUR-ENDPOINT-ID'
);

const erc20Abi = ['function balanceOf(address) view returns (uint256)'];
const contract = new ethers.Contract(tokenAddress, erc20Abi, provider);
const balance = await contract.balanceOf(walletAddress);

console.log('Balance:', ethers.formatUnits(balance, 18));

Error codes

Code

Name

Description

3

Execution reverted

The contract reverted the call. Check the data field in the error for the revert reason

-32000

Invalid input

Missing or malformed parameters. Verify the to address and data encoding

-32602

Invalid params

Wrong parameter types or count

Cost

2 CU per call. eth_call is one of the most frequently used methods — monitor your CU usage if you are making high-volume reads.

Notes

eth_call does not consume gas on the network and does not modify state. It is purely a local execution against the specified block's state. Results are deterministic — calling the same method against the same block will always return the same result.

For time-sensitive applications like trading bots, always use "latest" as the block parameter to read the most current state. Response times on HypeRPC for eth_call are typically under 2ms from the JP region.

Home

/

Introduction

On this page

EVM JSON-RPC

/

eth_call

EVM JSON-RPC

/

eth_call