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.
IDblockchair03 / 19BLOCKCHAIR_API_KEY
Provider

Blockchair

  • bitcoin
  • bitcoincash
  • litecoin
  • dogecoin
  • ethereum
  • ecash
  • zcash
Chains
7
Auth
optional
Operations
4 of 10
served 4 / 10

Operations

  • balancegetBalanceserved
  • historygetTxHistoryserved
  • tx detailgetTxDetailserved
  • utxosgetUtxosabsent
  • pubkeygetPubkeyabsent
  • contractgetContractInfoabsent
  • tokensgetTokenBalancesabsent
  • transfersgetTokenTransfersabsent
  • gasgetGasDataabsent
  • blockgetBlockInfoserved

Access

Createcreate("blockchair")
Import@agntn/explorers/providers/blockchair
Hostapi.blockchair.com
Statusproviders on the docs worker

Address it

ts
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-cash in the URL, not the bitcoincash key. Its address dashboard takes CashAddr with or without the bitcoincash: prefix, and the old 1... form too.
  • Litecoin amounts are litoshis at eight decimals, under the plain litecoin slug. 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 0 and fee 0, so a zero fee there tells you nothing.
  • The dashboard answer carries context.state, the chain height when it was built, and that's what Balance.blockNumber shows. Every other provider's balance endpoint says nothing about a block.
  • funded and spent are 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 RateLimitError carrying Blockchair's own reason, so an automatic read moves on to the next backend. Without a key, a blocked IP also gets told that BLOCKCHAIR_API_KEY lifts 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 AuthError with that reason instead, and an automatic read stops there like it does for any other bad key.

Where it lives

src/providers/blockchair.ts.