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
| Parameter | Type | Required | Description |
|---|---|---|---|
addresses_or_object | object or array | Yes | Either an object {"addresses": [...]} or a bare array of address strings |
Address Object
| Field | Type | Required | Description |
|---|---|---|---|
addresses | array of string | Yes | Transparent 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
| Parameter | Type | Description |
|---|---|---|
balance | integer | Current unspent balance in zatoshi (1 ZEC = 10^8 zat) |
received | integer | Total 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 Code | Message | Description |
|---|---|---|
| -8 | Invalid address | One or more addresses are malformed or not transparent |
| -32602 | Invalid params | Request structure is malformed |
| -32603 | Internal error | Node failed to look up address balances (may indicate address indexing is disabled) |