Address Balance

What is an address balance?

In this guide, we will explain how to get the balance of an address on a blockchain network. The balance searched for is the number of native tokens of the blockchain assigned to this address.

For example, you will receive your ETH balance for an address from Ethereum, or you will receive your XRP balance for an address on the XRP Ledger.

Prerequisites

Call the endpoint

Replace <address> with the address whose native token balance is to be determined:

/v2/autoexecution/search/address/balance/<address>

For example, to get the balance of address 0x68cb826D4f8960b2c51025bE03798691ED0Ce4E7.

In the request body, pass the technology and network in which the address balance is to be checked and add the addressId as a path parameter then send the request.

curl --request POST \
     --url https://api.sandbox.overledger.io/v2/autoexecution/search/address/balance/0x68cb826D4f8960b2c51025bE03798691ED0Ce4E7 \
     --header 'Authorization: Bearer token' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "location": {
    "technology": "ethereum",
    "network": "ethereum sepolia testnet"
  }
}
'

If the request is successful, you would receive a response with the address balance as shown below:

{
    "preparationAddressBalanceSearchResponse": {
        "requestId": "ec927282-6400-4fc6-bc96-10602a100e89",
        "gatewayFee": {
            "amount": "0",
            "unit": "QNT"
        }
    },
    "executionAddressBalanceSearchResponse": {
        "balances": [
            {
                "unit": "ETH",
                "amount": "0.190616207727361569"
            }
        ],
        "timestamp": "1709949864",
        "addressId": "0x68cb826D4f8960b2c51025bE03798691ED0Ce4E7"
    }
}

The response above shows that address 0x68cb826D4f8960b2c51025bE03798691ED0Ce4E7 owns 0.190616207727361569 ETH.