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
transaction
object
Yes
Transaction call object.
block
string
Yes
Block parameter (only "latest" supported).
Transaction Object
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"
}'import axios from 'axios';
const data = JSON.stringify({
"jsonrpc": "2.0",
"method": "eth_call",
"params": [{
"to": "0xContractAddress",
"data": "0x70a08231000000000000000000000000AddressHere"
}, "latest"],
"id": "getblock.io"
});
const config = {
method: 'post',
url: 'https://go.getblock.io/<ACCESS-TOKEN>/',
headers: {
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then(response => console.log(JSON.stringify(response.data)))
.catch(error => console.log(error));Response
Response Parameters
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
-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?