blockchainaddressgetbalance

Rostrum Electrum for Bitcoin Cash

Overview

The blockchain.address.get_balance method retrieves the confirmed and unconfirmed balances of a Bitcoin Cash address. This method provides crucial data for wallet applications and services that require up-to-date balance information.

Parameters

NameTypeRequiredDescription
addressstringYesThe Bitcoin Cash address in Cash Address or legacy format.
filterstringNoDetermines which UTXOs are included in the balance calculation. Options are include_tokens, tokens_only, exclude_token. Default is include_tokens.

Returns

The response includes both confirmed and unconfirmed balances:

FieldDescription
confirmedThe confirmed balance of the address in satoshis.
unconfirmedThe unconfirmed balance of the address in satoshis.

Example Result

{
  "confirmed": 450000000,
  "unconfirmed": 50000000
}

Request Example

curl --location 'https://api.tatum.io/v3/blockchain/node/rostrum-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
    "method": "blockchain.address.get_balance",
    "params": ["bchtest:qp3hnqdkvqxfzvcj7xqm8sb4cs4mq856vsk5nx9h2w", "include_tokens"],
    "id": 1,
    "jsonrpc": "2.0"
}'
// yarn add @tatumio/tatum

import { TatumSDK, RostrumElectrum, Network } from '@tatumio/tatum'

const tatum = await TatumSDK.init<RostrumElectrum>({ network: Network.ROSTRUM_MAINNET })

const balance = await tatum.rpc.getAddressBalance({
  address: 'bchtest:qp3hnqdkvqxfzvcj7xqm8sb4cs4mq856vsk5nx9h2w',
  filter: 'include_tokens',
})

console.log(balance)

await rostrum.destroy() // Destroy Tatum SDK - needed for stopping background jobs