getaddressbalance - TON

Example code for the getaddressbalance JSON-RPC method. Сomplete guide on how to use getaddressbalance JSON-RPC in GetBlock.io Web3 documentation.

This method returns the balance of a TON address denominated in nanotons. Divide the result by 1,000,000,000 to obtain TON. This is the cheapest read-only call for balance display.

Parameters

Parameter
Type
Required
Description

address

string

Yes

Address to query in any form

seqno

integer

No

Masterchain seqno at which to read state. Defaults to the latest block

Request Example

REST (GET):

curl --location --request GET 'https://go.getblock.io/<ACCESS-TOKEN>/getAddressBalance?address=EQDtFpEwcFAEcRe5mLVh2N6C0x-_hJEM7W61_JLnSF74p4q2' \
--header 'Content-Type: application/json'

JSON-RPC (POST):

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "getAddressBalance",
    "params": {
        "address": "EQDtFpEwcFAEcRe5mLVh2N6C0x-_hJEM7W61_JLnSF74p4q2"
    },
    "id": "getblock.io"
}'

Response Example

Response Parameters

Field
Type
Description

ok

boolean

Whether the request succeeded

result

string

Balance in nanotons (string-encoded integer to preserve precision)

id

string

Request identifier echoed back

jsonrpc

string

JSON-RPC protocol version (2.0)

Use Cases

  • Wallet balance display

  • Pre-flight check before submitting a transfer

  • Portfolio tracking applications

  • Indexers monitoring account activity

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

422

Validation Error

Request parameters are missing or malformed

429

Too Many Requests

Rate limit exceeded for your plan

504

Lite Server Timeout

Upstream TON liteserver timed out

SDK Integration

Last updated

Was this helpful?