This is a documentation resource, not an API subscription service. Requests in the examples go to Blockstream’s external Esplora API. No requests run automatically, and no API keys or wallet connections are collected here.
Know the network
Keep mainnet and testing data separate in configuration, caches, logs, and the interface.
Explore this topicKeep units explicit
Treat satoshis, BTC, virtual bytes, and fee rates as different quantities throughout your code.
Explore this topicHandle unknown honestly
A timeout, missing record, and zero balance are not interchangeable outcomes.
Explore this topicA small endpoint reference
These read-only paths use https://blockstream.info/api as the Bitcoin mainnet base. Confirm current behavior, pagination, and service policies in the provider’s documentation.
Read the official Esplora API contract (opens in a new tab)
Esplora transaction amounts use satoshis. Do not assume every field in every other Bitcoin interface uses the same units. Confirmation targets are estimates, not deadlines.
| GET path | Purpose |
|---|---|
/blocks/tip/height | Current height, returned as plain text. |
/tx/:txid | Transaction inputs, outputs, fee, and status. |
/tx/:txid/status | Transaction confirmation status. |
/address/:address | Address statistics, not a whole-wallet total. |
/fee-estimates | Estimated sat/vB rates by target blocks. |
Fetch a height. Preserve the context.
The sample validates a plain-text response and includes an observation time. It is not a complete production client.
// Read-only example for your own application; not executed on this page.
async function getBitcoinTipHeight() {
const response = await fetch(
"https://blockstream.info/api/blocks/tip/height",
{ signal: AbortSignal.timeout(15000), cache: "no-store" }
);
if (!response.ok) {
throw new Error(`Provider returned HTTP ${response.status}`);
}
const raw = (await response.text()).trim();
if (!/^\d+$/.test(raw)) throw new Error("Unexpected height response");
const height = Number(raw);
if (!Number.isSafeInteger(height)) throw new Error("Unsafe height value");
return { network: "bitcoin-mainnet", height, observedAt: new Date().toISOString() };
}
// Add application-specific error handling, rate limits, and privacy review.