Providers
Blockchair
One dashboard API for Bitcoin, Bitcoin Cash, Litecoin, Dogecoin, Ethereum, eCash and Zcash. Works without a key and ranks higher with one. The only one that names the block a balance was read at.
Provider
Blockchair
- bitcoin
- bitcoincash
- litecoin
- dogecoin
- ethereum
- ecash
- zcash
- Chains
- 7
- Auth
- optional
- Operations
- 4 of 10
served 4 / 10
Operations
- balance
getBalanceserved - history
getTxHistoryserved - tx detail
getTxDetailserved - utxos
getUtxosabsent - pubkey
getPubkeyabsent - contract
getContractInfoabsent - tokens
getTokenBalancesabsent - transfers
getTokenTransfersabsent - gas
getGasDataabsent - block
getBlockInfoserved
Access
- Create
create("blockchair") - Import
@agntn/explorers/providers/blockchair - Host
api.blockchair.com - Statusproviders on the docs worker
Address it
const blockchair = await create("blockchair"); // BLOCKCHAIR_API_KEY is optional
await blockchair.getBalance("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "bitcoin");
The key is optional. Set BLOCKCHAIR_API_KEY and Blockchair joins the configured tier of provider selection; leave it unset and it stays a keyless candidate that shows up in the fallback pass, behind the providers that need no key, so after Mempool and Blockstream on Bitcoin, after Haskoin on Bitcoin Cash, after eCash Explorer for eCash history and blocks and after Mempool on Litecoin.
What it reads
/{chain}/dashboards/address/:address for balance and history, /{chain}/dashboards/transaction/:hash for one transaction, /{chain}/dashboards/blocks/:number for a block. Balances, history, details and blocks; no contracts, tokens, gas or unspent outputs.
Gotchas
- The data format differs between the UTXO chains and Ethereum, and the provider maps both. eCash amounts are satoshis at two decimals, so 100 satoshis is 1 XEC. Yes, two.
- Bitcoin Cash sits under
bitcoin-cashin the URL, not thebitcoincashkey. Its address dashboard takes CashAddr with or without thebitcoincash:prefix, and the old1...form too. - Litecoin amounts are litoshis at eight decimals, under the plain
litecoinslug. Without a key it's the second stop for Litecoin. When litecoinspace.org is down, a balance, history, transaction or block read lands here. Unspent outputs and fees have nowhere else to go. - Zcash amounts are zatoshis at eight decimals, and they count the transparent side only. A shielded address has no public balance or history, and Blockchair reports a fully shielded transaction with value
0and fee0, so a zero fee there tells you nothing. - The dashboard answer carries
context.state, the chain height when it was built, and that's whatBalance.blockNumbershows. Every other provider's balance endpoint says nothing about a block. fundedandspentare the address's cumulative received and spent totals, in satoshis.- UTXO transactions decode OP_RETURN from each output's
script_hex. History gets it too, since every history row is a transaction dashboard read anyway. - Blockchair has its own status codes for "too much": 402 and 435 to 437 for a spent limit, 430 and 434 when it has blocked your IP outright. The provider reads all of them as a
RateLimitErrorcarrying Blockchair's own reason, so an automatic read moves on to the next backend. Without a key, a blocked IP also gets told thatBLOCKCHAIR_API_KEYlifts the block. - A key Blockchair doesn't know comes back as 402 too, with "Invalid API token" as the reason. Waiting won't fix that, so the provider throws an
AuthErrorwith that reason instead, and an automatic read stops there like it does for any other bad key.
Where it lives
src/providers/blockchair.ts.