Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

getAccountInfo - Bitcoin Cash

Example code for the getAccountInfo WebSocket method. Complete guide on how to use the getAccountInfo WebSocket method in the GetBlock Web3 documentation.

Returns balance and transaction data for an address, extended public key, or descriptor over WebSocket. This is the WebSocket form of the REST api/v2/address endpoint.

Parameters

Parameter
Type
Required
Description

descriptor

string

Yes

Address, extended public key, or descriptor to query

details

string

No

Detail level: basic, txids, txslight, or txs. Default txids

page

integer

No

1-based page index for transaction history

pageSize

integer

No

History items per page

from

integer

No

First block height to include

to

integer

No

Last block height to include

gap

integer

No

Derivation gap limit for xpub queries

Message

wscat -c wss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>

# then send:
{
    "id": "getblock.io",
    "method": "getAccountInfo",
    "params": {
        "descriptor": "bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a",
        "details": "txids",
        "page": 1,
        "pageSize": 1000
    }
}

Response

Response Fields

Field
Type
Description

address

string

The queried address or descriptor

balance

string

Confirmed balance in satoshis

totalReceived

string

Total received in satoshis

totalSent

string

Total sent in satoshis

unconfirmedBalance

string

Unconfirmed balance in satoshis

unconfirmedTxs

integer

Number of unconfirmed transactions

txs

integer

Number of confirmed transactions

txids

array

Transaction ids, present when details is txids

CashAddr (bitcoincash:q...) and legacy Base58 (1...) address formats are both accepted. The response echoes the address in the format used in the request.

Use Cases

  • Balance Display: Show the confirmed and unconfirmed balance of an account

  • History Pages: Page through an account's transactions

  • Payment Detection: Read an address balance after a deposit

  • Reconciliation: Compare indexed totals against local bookkeeping

Error Handling

Error
Message
Description

error

Invalid address

The descriptor is malformed

403 / RBAC: access denied

Access denied

The GetBlock access token is missing or incorrect

Last updated

Was this helpful?