Browse transaction history
To inspect the transaction history of a wallet address, connect to a network and call .addressHistory(). This returns paginated past transactions involving the address, including sent and received amounts, transaction IDs, and block heights.
Example usage
import { importWallet, ChainGate } from 'chaingate'
const wallet = importWallet({ phrase: 'some bip39 phrase ...' })
const cg = new ChainGate({ apiKey: 'your-api-key' })
const bitcoin = cg.connect(cg.networks.bitcoin, wallet)
const history = await bitcoin.addressHistory()
for (const tx of history) {
console.log('TXID:', tx.txid)
console.log('Amount:', tx.amount)
console.log('Block Height:', tx.height)
console.log('---')
}
Pagination
Pass an optional page cursor to addressHistory(page):
// Fetch the next page of transaction history
const nextPage = await bitcoin.addressHistory('next-page-cursor')
Use pagination to browse through large address histories.
Different address index
For HD wallets, check history at a specific address index:
const history = await bitcoin.addressHistory(undefined, { index: 1 })
What the history includes
Each transaction in the history contains:
- Transaction ID (
txid) — The hash of the transaction. - Amount — The value transferred.
- Block Height (
height) — The block number where the transaction was confirmed.
Key points
- Per-network: Call
addressHistory()on a specific network connector. - Paginated: Supports optional paging via a cursor string.
- HD wallets: Use
{ index }to check history for different addresses. - Confirmed transactions: Entries include block height. Unconfirmed transactions may have
height = null.