eth_getBalance - Optimism
eth_getBalance. Retrieves the balance of an address at a specified block
eth_getBalance - optimism [Value: 11CU]
This method is essential for determining an account's available funds
Use cases
- Check account balance before sending a transaction
- Verify wallet balance for automated payments processing
- Monitor account balance changes for security alerts
Constraints
- Requires a valid account address
- Node must be synchronized with the latest state
- Network latency may delay balance retrieval
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key
Language
Request
Examples
curl --request POST \
--url https://optimism.drpc.org \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"params": [
"0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8",
"latest"
],
"method": "eth_getBalance"
}
'
Response
200
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1"
}
Request params
idinteger
jsonrpcstring
methodstring
object
addressstring
The address to query the balance for.
blockNumberstring
The block number or tag ("latest", "earliest", "pending") at which to get the balance.
- latest [default] - The most recent block in the blockchain (default).
- safe - A block that has been validated by the beacon chain.
- finalized - a block confirmed by over two-thirds of validators
- earliest - A block approved by more than two-thirds of the validators.
- pending - Transactions that have been broadcast but not yet included in a block.
Response
200
Response params
object
idinteger
jsonrpcstring
resultstring
The balance of the account in wei, returned as a hexadecimal string.