eth_call - Polygon
Example code for the eth_call json-rpc method. Сomplete guide on how to use eth_call json-rpc in GetBlock.io Web3 documentation.
Parameters
Parameter
Type
Required
Description
Transaction Object
Field
Type
Required
Description
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": "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0",
"data": "0x70a082310000000000000000000000005aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"
}, "latest"],
"id": "getblock.io"
}'import axios from 'axios';
const url = 'https://go.getblock.io/<ACCESS-TOKEN>/';
const payload = {
jsonrpc: '2.0',
method: 'eth_call',
params: [{
to: '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0',
data: '0x70a082310000000000000000000000005aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed'
}, 'latest'],
id: 'getblock.io'
};
axios.post(url, payload, {
headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log('Result:', response.data.result))
.catch(error => console.error(error));Response
Response Parameters
Field
Type
Description
Use Case
Example: Reading ERC-20 Token Balance
Error Handling
Status Code
Error Message
Cause
Web3 Integration
Last updated
Was this helpful?