eth_getBalance - HyperEVM
Example code for the eth_getBalance JSON RPC method. Сomplete guide on how to use eth_getBalance JSON RPC in GetBlock Web3 documentation.
This method returns the account balance at the specified address.
Parameters
Parameter
Type
Required
Description
address
string
Yes
The address to check balance.
block
string
Yes
Block parameter (only "latest" supported).
Request
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0x742d35Cc6634C0532925a3b844Bc9e7595f5bE21", "latest"],
"id": "getblock.io"
}'import axios from 'axios';
const data = JSON.stringify({
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0x742d35Cc6634C0532925a3b844Bc9e7595f5bE21", "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
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": "0x56bc75e2d63100000"
}Response Parameters
Field
Type
Description
result
string
Hexadecimal balance in wei.
Use Case
The eth_getBalance method is essential for:
Wallet balance displays
Transaction validation (sufficient funds)
Portfolio tracking applications
Payment verification systems
DeFi protocol integrations
Error Handling
Error Code
Message
Cause
-32602
Invalid params
Invalid address format.
-32603
Internal error
Node issue.
Last updated
Was this helpful?