Blockbook
- provider
- create("blockbook")
- auth
- none
- chains
- Bitcoin Gold
- capabilities
- balance, history, tx detail, utxos, block
- endpoint
- btgexplorer.com
- default chain
- bitcoingold
Address it
import { Blockbook } from "@agntn/explorers/providers/blockbook";
const btg = new Blockbook(); // or create("blockbook")
await btg.getBalance("GNiT8AiCaMYPYW9uSgmq2qUsVjNgh1kdty", "bitcoingold");
await btg.getTxHistory("GNiT8AiCaMYPYW9uSgmq2qUsVjNgh1kdty", "bitcoingold", { limit: 10 });
One chain, no key. Blockbook is the indexer Trezor wrote for its wallet, and btgexplorer.com runs a public instance of it for Bitcoin Gold. baseUrl is the explorer root, the part before /api/v2, https://btgexplorer.com by default. There's no published limit and no key to raise one, so for anything heavy point baseUrl at your own Blockbook. Any other chain is an UnsupportedChainError. An address Bitcoin Gold doesn't take, a Bitcoin 1... one for example, fails before a request goes out.
What it reads
| Operation | Route |
|---|---|
| balance | /api/v2/address/{address}?details=basic |
| history | /api/v2/address/{address}?details=txs |
| one transaction | /api/v2/tx/{txid} |
| unspent outputs | /api/v2/utxo/{address} |
| block | /api/v2/block/{height} |
No gas and no tokens. /api/v2/estimatefee quotes BTG per kilobyte straight from the node, and nothing else in this library speaks that unit, so gas stays unsupported rather than converted into something that looks like sat/vB.
Gotchas
- Blockbook resolves every input to the address and the amount it spends. So the sender and the fee come with the transaction itself, one request per page, no parent lookups like on WhatsOnChain.
- Seen from an address, a transaction is a send when one of its inputs spent from that address. Then
valueis what went to everyone else andtois the first of them. Otherwise it's a receive andvalueis what landed on the address. - Ask for a page past the end and Blockbook answers with the last page, not an empty one. The provider checks the page number it got back and returns
[], so a loop over pages ends where it should. - History comes newest first and only that way.
sort: "asc"throws instead of quietly giving you the wrong order.startBlockandendBlockwork, they go out as Blockbook'sfromandto. limitup to 100. A page carries full transactions, every input and its script, so 100 rows of a busy pool address are about 1.4 MB.- A transaction still in the mempool reads as
pendingat block 0. - Balance comes with
fundedandspenttotals and the signedunconfirmeddelta. No block height, the endpoint doesn't send one, soblockNumberstays null. - Unspent outputs come with the height and without the block hash, so
blockHashstays null. Unconfirmed ones are in the list withconfirmed: false. - A missing transaction or block is a 400 with the reason inside, which the provider turns into
NotFoundError. Any other reason travels in the message of a plainExplorerError. - OP_RETURN outputs never become the recipient. Their payloads stay in
rawand don't get decoded intoopReturnthe way Mempool does it. - A block has an empty
minerand gas fields of"0", like every other chain without gas. - The Explorer has no live feed for Bitcoin Gold. Search works, the hub says there's no tip.
Where it lives
src/providers/blockbook.ts.
WhatsOnChain
Bitcoin SV through WhatsOnChain. Balances, history, unspent outputs, transactions and blocks. Satoshis. Three requests a second without a key.
Chains
The 29 chains the built-in providers serve. Which provider answers for each and which operations any of them cover. Read from the registry and not typed in.