Educational API

Six thin chain-stats endpoints for browser-side educational embeds. Block tip, halving countdown, mempool summary, supply, difficulty, USD spot. CORS-open, no auth, no rate limit. Built for embedding live data into teaching content without infrastructure on your end.

Best-effort, not SLA. These endpoints return HTTP 200 with stale: true if the upstream node hiccups; consumers should display "last updated X ago" rather than failing. If you need real-time, audited, paid feeds, see Fee Pressure API.

Endpoints

GET https://chainquery.com/api/edu/tip
GET https://chainquery.com/api/edu/halving
GET https://chainquery.com/api/edu/mempool-summary
GET https://chainquery.com/api/edu/supply
GET https://chainquery.com/api/edu/difficulty
GET https://chainquery.com/api/edu/price

No auth header. Access-Control-Allow-Origin: * on every response. Cache-Control set with a stale-while-revalidate=120 hint so well-behaved consumers can use a stale cached body while a background refresh runs.

Common envelope

{
  "schema_version": "1",
  "ts_utc":          "2026-05-13T18:42:01.234Z",
  "data_age_sec":    12,
  "stale":           false,
  "data":            { ... }
}

stale: true means "we couldn't refresh from the node; serving last-good data; consumer should display a 'last updated X ago' note rather than failing." Treat stale: true as a hint, not an error. data may be null if no cache exists yet (cold start mid-outage); render gracefully.

Example: live block tip

$ curl -s https://chainquery.com/api/edu/tip | jq '.data | {height, miner_coinbase_tag, tx_count}'
{
  "height": 949256,
  "miner_coinbase_tag": "< OCEAN.XYZ >",
  "tx_count": 528
}

Endpoint summary

EndpointRefreshBackend
/tip 15s bitcoind getblockchaininfo + getblock + coinbase decode
/halving 60s countdown to halving 5, full halvings history; reward bit-shifts from block subsidy schedule
/mempool-summary 20s getmempoolinfo + getrawmempool true bucketed into 6 fee bands + estimatesmartfee for 1/3/6-block targets
/supply 5 min Latest gettxoutsetinfo snapshot from our 6-hourly cache; current subsidy + annual inflation derived
/difficulty 60s Current epoch start getblockheader; estimated_change_pct from observed block rate, clamped to retarget bounds
/price 60s Passthrough to mempool.space/api/v1/prices; falls back to data: null, stale: true if upstream is down

Contract guarantees

  • HTTP 200 always — never 5xx. Failure mode is stale: true.
  • Access-Control-Allow-Origin: * on every response. Safe to call from any browser origin.
  • The envelope shape is stable. New fields under data are forward-compatible; consumers should treat unknown fields as opaque.
  • Schema bumps will increment schema_version. Existing clients should refuse mismatched versions and degrade gracefully.
  • No rate limit today. If we ever need to add one we'll do it as a soft Retry-After hint, not a 429 wall.

When this is the right tool

  • Embedding live chain stats in educational content (live block height in a glossary entry, halving countdown in a course chapter).
  • Browser-side Svelte / React widgets where you don't want to stand up your own bitcoind.
  • Hobby projects, blog post embeds, classroom demos.

When this is not the right tool

  • Trading systems or fee-bidding that need sub-second freshness — Fee Pressure API is the auth'd paid feed with that SLA.
  • Block-by-block deterministic replay — these endpoints are snapshots, not streams.
  • Compliance / sanctions screening — see Sanctions Check API.

Why this exists

Educational sites that want to embed live chain data usually face a choice: run their own bitcoind (real infrastructure cost), hit a commercial API (per-call pricing that breaks the embed model), or hardcode stale snapshots (which then quietly rot).

None of those is great for an MDX page that wants to show "as of right now, X" to a curious student. We already run the node; making six thin read-only endpoints public is roughly free for us and removes that constraint for the people teaching Bitcoin.

Endpoints at a glance

  • /tip live block height + coinbase tag
  • /halving next halving countdown + history
  • /mempool-summary fee bands + estimates
  • /supply circulating + inflation rate
  • /difficulty current + next adjustment
  • /price USD spot