getaddressbalance - Zcash

This method returns the total transparent balance of one or more addresses. A Zcash extension over Bitcoin Core (which doesn't natively index addresses), available on Zebra when address indexing is enabled. Transparent addresses only — shielded balances (Sapling, Orchard) are private by design and cannot be queried via public RPC.

Parameters

ParameterTypeRequiredDescription
addresses_or_objectobject or arrayYesEither an object {"addresses": [...]} or a bare array of address strings

Address Object

FieldTypeRequiredDescription
addressesarray of stringYesTransparent addresses (t1/t3) to sum balances for

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "getaddressbalance",
    "params": [
        {
            "addresses": [
                "t1KfwsnwJeNRVjQGBDZhwKskpQbih2qx5Ua",
                "t1XQZdZMnzXBcL8yx2PR27dSNrqctgwLgux"
            ]
        }
    ],
    "id": "getblock.io"
}'

example.js

javascriptconst axios = require('axios');

const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    method: 'getaddressbalance',
    params: [
        {
            "addresses": [
                "t1KfwsnwJeNRVjQGBDZhwKskpQbih2qx5Ua",
                "t1XQZdZMnzXBcL8yx2PR27dSNrqctgwLgux"
            ]
        }
    ],
    id: 'getblock.io'
}, {
    headers: { 'Content-Type': 'application/json' }
});

console.log(response.data.result);

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'getaddressbalance',
        'params': [
            {
                "addresses": [
                    "t1KfwsnwJeNRVjQGBDZhwKskpQbih2qx5Ua",
                    "t1XQZdZMnzXBcL8yx2PR27dSNrqctgwLgux"
                ]
            }
        ],
        'id': 'getblock.io'
    }
)

print(response.json())

example.rs

rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "getaddressbalance",
            "params": [
                {
                    "addresses": [
                        "t1KfwsnwJeNRVjQGBDZhwKskpQbih2qx5Ua",
                        "t1XQZdZMnzXBcL8yx2PR27dSNrqctgwLgux"
                    ]
                }
            ],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "result": {
        "balance": 14004247856321,
        "received": 749043876248469
    },
    "id": "getblock.io"
}

Response Parameters

ParameterTypeDescription
balanceintegerCurrent unspent balance in zatoshi (1 ZEC = 10^8 zat)
receivedintegerTotal amount ever received in zatoshi (including already-spent outputs)

Use Cases

  • Wallet Balance Display: Show a transparent balance for one or many addresses in a wallet UI
  • Aggregated Balance Tracking: Sum balances across a family of addresses in one call
  • Explorer Address Pages: Display current balance and lifetime received amounts on address detail pages
  • Custody System Reconciliation: Query balances for all custody addresses in bulk

Error Handling

Error CodeMessageDescription
-8Invalid addressOne or more addresses are malformed or not transparent
-32602Invalid paramsRequest structure is malformed
-32603Internal errorNode failed to look up address balances (may indicate address indexing is disabled)