stratum.work shows, in real time, the block templates Bitcoin mining pools hand out to their miners. Collectors connect to pools over the Stratum protocol like an ordinary miner, record every mining.notify message, and stream them to the browser, which decodes and visualizes them: what each pool is building on, what it pays out, which transactions it put first, and how quickly it switches to a new block. The idea comes from 0xB10C (original thread); this project puts it in a form many people can use. A development deployment runs at dev.stratum.work.
Contents: How it works · Repository map · Quick start · Postgres · Data analysis · Testing and CI · Contributing · Further reading
Coding agents: also read CLAUDE.md (conventions, test commands and data gotchas in short form).
| Data | Source | Written by |
|---|---|---|
Templates: every mining.notify a pool sends (job id, previous block hash, the two coinbase halves, merkle branches, version, nBits, nTime, clean-jobs flag), with receive time and latency estimates |
Mining pools, over Stratum | collector |
| Blocks: every Bitcoin block, the pool that mined it (coinbase tags and payout addresses, matched against mempool/mining-pools) and the analytics findings for its height | Bitcoin Core node (RPC + ZMQ) | backend |
| Stale blocks and reorgs: blocks on non-active branches the node knows about, and switches of the active chain | Bitcoin Core node (getchaintips); for stale blocks our node never had, headers from the public stale-blocks dataset, validated |
backend |
| Mempool: every transaction the node's mempool accepted, with first-seen time and how it left (mined, replaced, conflict, ...) | Bitcoin Core node (ZMQ sequence + rawtx) |
mempool-recorder |
flowchart LR
pools[Mining pools] -- "Stratum mining.notify" --> collector
node[Bitcoin Core node] -- "RPC + ZMQ" --> backend
node -- "ZMQ sequence, rawtx" --> recorder[mempool-recorder]
collector -- templates --> db[("Postgres + TimescaleDB")]
collector -- "live templates" --> mq[RabbitMQ]
backend -- "blocks, pools, analytics, stale blocks" --> db
backend -- "block events" --> mq
recorder -- "mempool tables" --> db
db --> web["web (Next.js)"]
mq --> web
web -- "SSE /api/stream + JSON API" --> browser[Browser: decodes and draws]
- collector (
collector-go/, Go): one process per pool. Publishes each template to RabbitMQ for the live view and stores every template intemplateswithout asking a node: which chain a template belongs to is derived at read time (design doc; some pools mine other chains on the same endpoints). It also hardens ingest (line caps, quarantine of unstorable messages intemplates_rejected, burst detection iningest_events). It replaced an earlier Python collector (collector/, removed). - backend (
backend/, Python): follows the node (RPC + ZMQhashblock), backfills blocks down toMIN_BLOCK_HEIGHT, identifies the pool of each block, runs the analytics plug-ins over the templates of that height, tracks stale blocks, and publishes block events. - web (
web/, Next.js): serves the UI, the live stream (/api/stream, Server-Sent Events) and a read-only JSON API (web/app/api/). - mempool-recorder (
mempool-recorder/, Go): records the node's mempool so templates can be resolved against it (a template'smerkle_branches[0]is the txid of its first transaction). See its README.
Storage. Everything is stored in Postgres + TimescaleDB (design doc; the project moved there from MongoDB). The local docker compose stack runs it too, see Postgres + TimescaleDB.
The words we use, and what each does and does not claim: docs/glossary.md.
What each value is (observed, verified or modelled), how arrival times and clocks are measured and how far they can be off, what the latency adjustment assumes, how several connections per pool and duplicates are handled, and the limits of older history: docs/methodology.md.
The server collects and forwards the raw messages; all decoding, formatting and visualization happens in the browser (coinbase reconstruction, scriptSig tags, outputs and fees, the first transaction, merkle and timing views). So anyone can check what the site shows against what the pools sent, and the stream (GET /api/stream) can power other tools. The browser doing the work also means client performance matters: CI measures it on every web PR (web/perf).
Where the decoding lives: web/utils/bitcoinUtils.ts (coinbase transaction, scriptSig ASCII and info, outputs and value, first transaction, OP_RETURN and AuxPoW data), web/utils/formatters.ts (coinbase assembly, prev-hash, nTime, nBits). The collector only stores what it received (newDocument in collector-go/document.go); the backend's block processing is process_block / build_block_doc in backend/main.py.
A pool sends mining.notify whenever it has new work: on a new block (with clean-jobs set, so miners drop old work) and periodically as it refreshes the transaction set. Its fields, and how the UI derives its columns from them, are documented one per page in docs/:
prev_block_hash, coinbase_raw (coinbase1 + extranonce1 + extranonce2 + coinbase2), height (BIP34, from the coinbase), coinbase_script_ascii, coinbase_output_value, merkle_branches, first_transaction, version / block_version, nbits, ntime, clean_jobs, pool_name, timestamp, latency_tracking.
| Path | What | Stack |
|---|---|---|
collector-go/ |
Stratum client, one per pool: mining.notify to Postgres and RabbitMQ, latency estimates, kernel receive timestamps, quarantine and burst records, /livez /readyz /metrics. A golden test against a frozen fixture from the earlier Python collector (testdata/golden.json) |
Go |
backend/ |
Follows the node; blocks, pools, analytics (backend/analytics/), stale blocks (stale_blocks.py; stale_import.py for ones the node never had), storage layer (integrations/store.py) |
Python |
web/ |
Next.js app: realtime table, template details, timing, Sankey, infra/latency views; API routes in web/app/api/, data layer in web/lib/db/, perf harness in web/perf/ |
TypeScript, Next.js 16 |
mempool-recorder/ |
Records the node's mempool in Postgres | Go |
db/ |
Postgres schema as dbmate migrations (db/migrations/), local dev users (dev-users.sql), migration and SQL tests |
SQL |
postgres/ |
CloudNativePG Postgres + TimescaleDB image used in production | Dockerfile |
docs/ |
Field documentation and design docs |
docker compose runs the stack on one machine: RabbitMQ, Postgres + TimescaleDB (migrations applied at startup), five collectors connected to public pools, the backend and the web app. The web app runs in development mode with hot reload.
- Docker Engine with the Compose plugin (
docker compose, v2). - About 5 GB of disk for images, plus the data you collect.
- Optional: a Bitcoin Core node with RPC and ZMQ, see Connecting a Bitcoin node.
git clone https://github.com/bboerst/stratum-work.git
cd stratum-work
cp .env.example .env # optional: Bitcoin node, remote access
docker compose up --build # add -d to run in the backgroundOpen http://localhost:3000. Collectors connect to their pools straight away, and templates appear as pools send mining.notify. The first build takes a few minutes.
Without a Bitcoin node the live template table works, and so does everything the browser derives from templates. Blocks, pool identification, analytics and stale blocks stay empty, and the backend logs RPC connection errors and keeps retrying. Without stored blocks, templates from other chains can't be told apart from Bitcoin's (that's judged against the stored blocks at read time).
To run the optimized production build (no hot reload): ENVIRONMENT=production docker compose up --build.
| Service | Host port | Notes |
|---|---|---|
web |
3000 | Next.js, dev mode by default, ./web mounted into the container |
backend |
8001 (BACKEND_PORT) |
Block processing and analytics; needs a node |
collector-* |
none | One per pool (antpool, f2pool, poolin, secpool, 256foundation) |
rabbitmq |
5672, 15672 | Management UI at http://localhost:15672 (mquser / mqpassword) |
postgres |
5432 (POSTGRES_PORT) |
TimescaleDB, plus postgres-migrate and postgres-dev-users, which run once at startup; see below |
These are local development credentials: don't expose the ports to an untrusted network. To bind them elsewhere, see machine-specific overrides. To start only some services: docker compose up --build web backend collector-f2pool (dependencies start with them).
docker compose reads ./.env (gitignored). Every setting is optional; the defaults are those in docker-compose.yml, and .env.example documents each one.
| Setting | Default | Purpose |
|---|---|---|
CORS_ORIGINS |
http://localhost:3000 |
Origin(s) your browser uses for the web app (comma-separated) |
ALLOWED_DEV_ORIGINS |
(empty) | Hostnames allowed to use Next.js dev resources (hot reload) from another machine |
BITCOIN_RPC_HOST / _PORT |
host.docker.internal / 8332 |
Node RPC endpoint |
BITCOIN_RPC_USER / _PASSWORD |
rpc_user / rpc_password |
RPC credentials |
BITCOIN_RPC_SCHEME / _CA_FILE |
http / (empty) |
https and a CA file for nodes behind a TLS proxy |
BITCOIN_ZMQ_BLOCK |
tcp://host.docker.internal:28332 |
ZMQ block notifications |
MIN_BLOCK_HEIGHT |
863998 |
Lowest height the backend backfills on first start |
BLOCK_GAP_WINDOW |
144 |
Heights below the tip the backend checks against the node's active chain after each sync, new block and reorg: missing blocks are fetched, blocks a reorg replaced are swapped for the node's and marked stale (0 = off; see "Active chain" below) |
BLOCK_GAP_FILL_INTERVAL_S |
3600 |
Seconds between runs of the historical gap fill (also once after the startup sync): every height missing between MIN_BLOCK_HEIGHT and the stored tip is fetched, on a pruned node through getblockfrompeer (0 = off; see "Historical gaps" below) |
BLOCK_GAP_FILL_MAX_BLOCKS / _PEERS / _PEER_TIMEOUT_S |
50 / 3 / 30 |
Per gap-fill run: blocks at most, peers tried per pruned block, seconds to wait for each peer |
UNKNOWN_PARENTS_ENABLED |
true |
Keep the unknown-parents summary (unknown_parent_pools) up to date: after each new block over the last two hours, and once after the startup sync over the last seven days (false = off; see "Unknown parents" below; the web's Forks page reads it) |
STALE_PARENTS_ENABLED |
true |
Keep the stale-parents summary (stale_parent_pools) up to date on the same schedule, and when the stale-block tracker records a block: every stale block whose height window overlaps the range, or that has no row yet, is recomputed (false = off; see "Unknown parents" below) |
TEMPLATE_SETS_ENABLED |
true |
Count transaction sets per height (template_set_heights / _feeds / _pairs) after each new block, for every height of the last 1,008 whose receive window has closed and isn't counted yet (false = off; see "Template providers" below; the web's /api/template-providers reads them) |
RESOLVER_ENABLED |
false |
Read every template's hash-verified positions 1-15 against the mempool recorder's tables (template_decodes), hourly, for every height of the last RESOLVER_LOOKBACK (144) whose receive window has closed and isn't read yet (RESOLVER_INTERVAL_S, 3600; see "Template positions" below) |
TEMPLATE_SETS_BACKFILL / _CHUNK |
false / 144 |
Also count older history in the background: after the recent heights, one chunk of _CHUNK heights per cycle, walking down from the lowest counted height to the lowest stored block (the first height with a parent); resumes after a restart (progress is the table itself) and stops when done |
POOL_OWN_TEMPLATE_CREATORS |
(empty) | Web: comma-separated prefixes of DATUM template-creator names that are a pool's own template servers, so their blocks count for the pool rather than as miner-built (methodology) |
BEST_CHAIN_HISTORY_INTERVAL_S |
86400 |
Seconds between runs of the full-history active-chain check (also once after the startup sync): the stored active-chain block at every height between MIN_BLOCK_HEIGHT and the stored tip is compared with the node's (0 = off; see "Active chain, full history" below) |
REPORTED_HASHRATE_PAGE_URL / _URL / _USER_AGENT / _SOURCE |
(empty) / (empty) / stratum-work/1.0 (+https://stratum.work) / miningpoolstats |
For python -m reported_hashrate: the pool-statistics site's page (read for its last_time token) and its JSON data file (fetched with ?t=<last_time>); unset page URL = off (methodology) |
POSTGRES_PORT |
5432 |
Host port of the Postgres service |
COLLECTOR_PG_* / BACKEND_PG_* / WEB_PG_* |
the local postgres service, each as its own user |
Point a component at another database (_HOST, _PORT, _DATABASE, _USER, _PASSWORD, and _SSLMODE for collectors and web) |
COLLECTOR_SITE / COLLECTOR_REPLICA |
local / a |
Collector identity in sources |
COLLECTOR_SOURCE_KIND |
(empty) | Optional label stored as the source's kind (--source-kind, e.g. relay), so collectors of one pool and site that collect differently can be told apart; give a labelled collector its own replica name. Empty = no label (unchanged) |
COLLECTOR_NODE |
(empty) | The machine whose clock stamps received_at, recorded in its ingest_events start row (in Kubernetes, the pod's spec.nodeName) |
STREAM_POOL_RATE / STREAM_POOL_BURST |
5 / 20 |
Per-pool live display limit (every template is still stored) |
HEIGHT_RATE_LIMIT / _WINDOW_S / _BURST |
(off) / 600 / the limit |
Web: past heights each client may read per window from the per-height template routes, up to _BURST at once (public API); unset or 0 = no limit |
EXTRANONCE1_MASK_KEY |
(random per start) | Key for masking extranonce1 in everything the web serves, and for the hashed last part of template ids (job ids are never served) |
TX_API_SOURCE / TX_API_MEMPOOL_SPACE_FALLBACK |
mempool.space / false |
Where the table's first-transaction fee rates come from. Compose runs no mempool recorder, so it defaults to mempool.space; auto (the web's own default) = this deployment's /api/tx with historical data enabled, mempool.space otherwise; local forces /api/tx. The fallback asks mempool.space when /api/tx fails |
Only the backend uses the node (the collectors don't). The node needs:
- RPC reachable from the containers. A node on the Docker host is
host.docker.internal; make surerpcallowipallows the Docker network (e.g.172.16.0.0/12). Read-only RPC is enough. - ZMQ block notifications on
BITCOIN_ZMQ_BLOCK: the backend subscribes tohashblock:zmqpubhashblock=tcp://0.0.0.0:28332 - Nodes behind a TLS proxy (e.g. StartOS) serve RPC over
https, often with a private CA. Point the stack at the CA rather than turning off verification:BITCOIN_RPC_SCHEME=httpsandBITCOIN_RPC_CA_FILE=/path/to/root-ca.pem(a host path, mounted read-only). - First start: the backend backfills every block from the tip down to
MIN_BLOCK_HEIGHT, over 100k blocks with the default. For a quick start set it a few dozen blocks below the current tip; there are no templates for blocks mined before your collectors ran anyway.
- Web: edit files under
web/; the browser updates. After changingweb/package.json, rebuild with freshnode_modules:docker compose up -d --build --renew-anon-volumes web. - Backend and collectors: the code is baked into the image, so rebuild the service you changed:
docker compose up -d --build backend(orcollector-f2pool, ...). - Logs:
docker compose logs -f web backend,docker compose logs -f collector-antpool. - Shell / status:
docker compose ps,docker compose exec web sh.
docker compose stop # stop, keep containers and data
docker compose down # remove containers and the network, KEEP the data volumesWarning:
docker compose down -valso deletes the named volumes, i.e. all collected data (pg-data). Don't use it (ordocker volume prune) unless that's what you want. To reset only one store, remove just its volume, e.g. Postgres:docker compose rm -sf postgres && docker volume rm stratum-work_pg-data(volume names are<project>_<volume>; the project defaults to the directory name, check withdocker volume ls). The nextdocker compose upmigrates the empty database again.
Each collector-* service connects to one pool and extends the shared x-collector-base template (environment, dependencies, restart policy). To add one locally, put a service in your docker-compose.override.yml (gitignored) and change only the pool flags:
services:
collector-newpool:
extends: {file: docker-compose.yml, service: collector-f2pool}
command:
- --pool-name=NewPool
- --url=stratum+tcp://newpool.example.com:3333
- --userpass=someuser.worker:x
- --log-level=INFO--pool-name is the name shown in the UI and stored as the source. RabbitMQ and Postgres come from the template's environment (passwords only from the environment: the collector refuses them on the command line). docker compose run --rm --no-deps collector-f2pool --help lists every flag with its env fallback (PG_*, RABBITMQ_*, COLLECTOR_*). Use a pool's public endpoint and a username it accepts for anonymous or test mining; respect its terms.
If the stack runs on another machine, use its hostname instead of localhost:
# .env
CORS_ORIGINS=http://my-devbox:3000
ALLOWED_DEV_ORIGINS=my-devbox # without it, Next.js blocks hot reload from non-localhost hostsCompose changes that apply only to your machine (port bindings, extra services) go in a gitignored docker-compose.override.yml, which docker compose loads automatically. !override replaces a list instead of appending to it:
services:
web:
ports: !override
- "192.0.2.10:3000:3000" # e.g. only on a VPN address
postgres:
ports: !override
- "127.0.0.1:5432:5432" # keep infrastructure on loopbackdocker compose up runs Postgres with three services:
postgres: TimescaleDB 2.30 on Postgres 18 (timescale/timescaledb:2.30.2-pg18); ownerstratum/stratum, databasestratum.postgres-migrate: appliesdb/migrationswith dbmate, then exits.postgres-dev-users: creates the local login userscollector,backendandweb(password = user name), each granted its least-privilege role (stratum_collector,stratum_backend,stratum_web), then exits.
The collectors, backend and web start once the users exist, each connected as its own user. The collectors write every template to templates, other chains' and unparseable heights included: which chain a template belongs to, and whether it is current, is judged at read time (design doc). The web turns rows into API responses in web/lib/db/pg-mapping.ts.
Connect with psql (the image has it, no local install needed):
docker compose exec postgres psql postgres://web:web@localhost/stratum # read-only, what the web sees
docker compose exec postgres psql -U stratum stratum # owner (local only)
psql postgres://web:web@localhost:5432/stratum # from the host, with a local psqlStale blocks: on every new block and every STALE_POLL_INTERVAL_S (60) seconds the backend calls getchaintips, walks each non-active branch to the fork point and stores its blocks in stale_blocks (header always; coinbase, size and pool when the node has the full block); reorgs of the active chain go to chain_reorgs. STALE_BLOCKS_ENABLED=false turns it off. RPC methods used: getchaintips, getblockheader, getblock, getblockhash.
Stale blocks our node never had (one-off or occasional): templates from two or more pools on a previous block we don't know prove a Bitcoin block we never stored. backend/stale_import.py finds them (read per chunk of heights through the templates height index), takes their headers (and full blocks, where present) from the public stale-blocks dataset (CC0, doi:10.5281/zenodo.22667157; thanks to its contributors), validates each one (hash, proof of work at our chain's difficulty, parent = the active chain's block at height − 1, height, merkle root of a full block) and stores the valid ones in stale_blocks with header_source = 'bitcoin-data/stale-blocks' (methodology). Nothing that fails a check is stored; the JSON summary lists candidates, matches, rejections and their reasons. It connects like the backend (PG_*, a user in the stratum_backend role) and needs no node:
git clone --depth 1 https://github.com/bitcoin-data/stale-blocks /tmp/stale-blocks
cd backend && python -m stale_import --csv /tmp/stale-blocks/stale-blocks.csv --blocks-dir /tmp/stale-blocks/blocks --dry-run
# then without --dry-run; --from-height / --to-height bound the template heights read, --chunk the heights per queryStale blocks our node did see are in blocks, and peers don't serve them once the node has pruned them, so the coinbase fill can leave them without coinbase data. --coinbase-fill takes it from the dataset's block files instead: each file's header must hash to the stored block hash, the block must parse exactly, its transactions must fold to the stored merkle root and its coinbase must hash to its txid; only then are the merkle branches, coinbase txid and bytes (and size, weight, transaction count where empty) filled, never overwriting a value. The summary lists every block as filled, not in the dataset, or failed (with the check):
cd backend && python -m stale_import --coinbase-fill --blocks-dir /tmp/stale-blocks/blocks --dry-runActive chain: after each sync, new block and reorg the backend compares its stored active-chain block at each of the last BLOCK_GAP_WINDOW heights with the node's (getblockhash). A missing block is fetched; a stored block the node's active chain no longer has (a reorg) is replaced by the node's block, stored with seen_at = when the backend noticed. The replaced block stays stored: it gets a stale_blocks row (was_active, and a chain_reorgs row), so blocks_best hides it, even with STALE_BLOCKS_ENABLED=false. RPC methods used: getblockcount, getblockhash, getblock, getchaintips, getblockheader.
Historical gaps: the startup sync only extends the stored range at both ends, and the active-chain check covers the last BLOCK_GAP_WINDOW heights. Deeper gaps (e.g. blocks that failed while the database was unreachable) are filled by a separate pass, once after the startup sync and then every BLOCK_GAP_FILL_INTERVAL_S seconds. It reads the stored heights between MIN_BLOCK_HEIGHT and the stored tip (no RPC when nothing is missing) and stores up to BLOCK_GAP_FILL_MAX_BLOCKS missing blocks per run, newest first, as synced blocks (seen_at NULL, like the backfill). A pruned node answers "Block not available (pruned data)" for old blocks: then the backend asks it to download the block again from a connected peer that advertises NETWORK (full history; NETWORK_LIMITED peers only serve the last 288 blocks) and WITNESS (the node only fetches blocks from witness peers), outbound peers first, up to BLOCK_GAP_FILL_PEERS peers with BLOCK_GAP_FILL_PEER_TIMEOUT_S seconds each. A run keeps its peers in order of who delivers: the peer that delivered last is asked first, a peer that didn't moves to the back, and a disconnected one is dropped (the list is refreshed when that leaves it short). The block is stored once it arrives (the node may prune it again later; it is only needed once). The wait happens outside the block processor, so new blocks are never delayed. A block that can't be fetched is logged and retried on the next run. RPC methods used: getblockhash, getblock, plus getpeerinfo and getblockfrompeer (Bitcoin Core 23+) on a pruned node.
Active chain, full history: the active-chain check above only covers the recent window, so a wrong block deeper down (e.g. a history backfill that stored a block which later lost a race, while the active chain's block isn't stored) stays wrong. Once after the startup sync and then every BEST_CHAIN_HISTORY_INTERVAL_S seconds (default daily), the backend compares the stored active-chain block at every height between MIN_BLOCK_HEIGHT and the stored tip with the node's, in chunks of 2,000 heights: one indexed read and one getblockhash per height, outside the block processor, so new blocks aren't delayed. Only the fixes run on the block processor: the node's block is stored first, as a synced block (seen_at NULL: it wasn't seen live), on a pruned node through the gap fill's getblockfrompeer path, and only then is the stored block marked replaced, the same way as above. A height with no stored block is left to the gap fill. Marking a block replaced needs its header from the node (getblockheader); if the node never saw that block it has no header, the block stays in blocks_best next to the node's, and the height is logged as failed and retried on the next run. Each run logs one summary line (checked, mismatched, stored, replaced, failed, duration).
Unknown parents: the web's Forks page reads unknown_parent_pools, which the backend keeps current from the last hours of templates (UNKNOWN_PARENTS_ENABLED). A new database, or history from before the backend ran, is filled by the backfill, run once from backend/ with the backend's PG_* settings (as a user in the stratum_backend role); it walks the templates in 7-day chunks, logs each, prints a JSON summary, and can be re-run at any time (each parent is recomputed whole):
python -m unknown_parents --backfill # from the first template to now
python -m unknown_parents --backfill --from 2026-01-01 --to 2026-02-01 --chunk 1dUntil the table has rows, the page's 90-day view reads templates directly.
Templates on a recorded stale block are summarised the same way, in stale_parent_pools (STALE_PARENTS_ENABLED). Its backfill recomputes every stale block once (under a second each), in chunks of 2,016 heights:
python -m stale_parents --backfill # every stale block
python -m stale_parents --backfill --from-height 900000 --to-height 910000 --chunk 1000While that table is empty and stale blocks exist, the page reads their templates directly.
Template providers: the web's /api/template-providers (the home page's "Who builds the templates") derives template providers from template_set_heights / _feeds / _pairs, which the backend fills for each height once its receive window has closed (TEMPLATE_SETS_ENABLED). Older history is counted in the background with TEMPLATE_SETS_BACKFILL=true (one chunk per cycle, after the recent heights, down to the lowest stored block; the backend's stratum_backend_template_sets_lowest_height gauge shows how far it got), or by hand from backend/ like the backfills above (each height is recomputed whole, so it can be re-run at any time, e.g. after the pool list changed):
python -m template_sets --backfill # from the lowest stored block to the highest closed height
python -m template_sets --backfill --from-height 960000 --to-height 970000 --chunk 288Until a height is counted, the route answers 404 and the home page leaves the section out.
Template positions: with RESOLVER_ENABLED=true the backend stores each template's positions 1-15 that our mempool record reproduces exactly (template_decodes; methodology). Nothing on the site reads them yet. Older heights, by hand from backend/ (each height is recomputed whole; --out only prints the rows, for a read-only role):
python -m resolver --backfill --from-height 977000 --to-height 977143
python -m resolver --backfill --from-height 977000 --to-height 977005 --out decodes.tsvMigrations: docker run --rm -v "$PWD/db:/db" ghcr.io/amacneil/dbmate:2.37.0 new <name>, then fill -- migrate:up and a working -- migrate:down. TimescaleDB procedures such as add_columnstore_policy need -- migrate:up transaction:false. db/test-migrations.sh runs them up/down/up and checks the role privileges.
Not in compose: the mempool recorder. Run it from its directory (go run . -h lists flags and env fallbacks) against the compose Postgres; it logs in as the local user mempool / mempool (db/dev-users.sql, role stratum_mempool) and needs a node with -zmqpubsequence / -zmqpubrawtx (README).
- Collect your own. Connect a node, set
MIN_BLOCK_HEIGHTnear the tip, and let a few collectors run:docker compose up -d --build web backend collector-f2pool collector-antpool. A few hours give dozens of heights; every height has a few hundred templates per pool. Without a node you still get templates (but no blocks). - From the public site. The web's JSON API is read-only and public (below). Fetch it politely: a request or two per second, honor
Retry-After, and cache what you've read.
All in db/migrations; the design doc explains the choices. Hashes and hex fields are bytea; encode(x, 'hex') shows them.
| Object | What |
|---|---|
sources |
One row per collector connection: name (the pool), site, replica, and an optional kind label (--source-kind, e.g. relay; NULL = not labelled) |
templates |
Every template, one row per mining.notify, whatever chain it is for (hypertable on received_at, indexed on (height, source_id, received_at)). prev_hash is in Stratum's word order; height is as the pool sent it (0 if unparseable) |
bitcoin_parents |
The blocks we know (blocks and stale_blocks) by prev_hash in Stratum's order: a template whose prev_hash isn't here doesn't build on our Bitcoin chain |
unknown_parent_pools |
The backend's summary of templates on a parent that was no known block, per (prev_hash, pool): de-duplicated count n, first_received / last_received, auxpow, connection ranks conns, heights and nbits (jsonb value → templates). Facts only: join bitcoin_parents at read time to keep the still-unknown ones (methodology) |
template_set_heights, template_set_feeds, template_set_pairs |
The backend's transaction-set counts per height (non-empty templates in the height's window, on the block at h − 1): the heights counted; per (height, feed, pool_id paid, NULL = unidentified) its distinct sets, templates and first / last receive time; per pair of those nodes the sets both received (shared). Counts add up over heights. Template providers are derived from them at read time (methodology) |
template_decodes, template_decode_heights |
The backend's resolver: per transaction set (height, prev_hash, the first four branches, branch_count) the hash-verified txids of positions 1..verified_to (1, 3, 7 or 15; full_15), read against our mempool at received_at, the set's first arrival, with the candidates tried and the templates carrying it; and the heights read. A level not verified says nothing about the pool (methodology) |
stale_parent_pools |
The backend's summary of templates on a recorded stale block, per (prev_hash, pool): the templates at the block's height + 1 received inside that height's window, de-duplicated count n, first_received / last_received, connection ranks conns, heights and nbits. Facts only, kept for every stale block: join stale_blocks (reorged_in_at IS NULL) at read time to keep the ones still stale (methodology) |
reported_hashrate |
Hashrate as each pool reports it, from a third-party pool-statistics site (python -m reported_hashrate, daily, off unless configured): per (source, pool_key, at hour) the reported hashrate and the site's network_hashrate at fetch time, in H/s. A claim, not a measurement: never mix it with block shares (methodology) |
template_routing_labels |
The old write-time chain classification (chain, reason) of the rows that were in the former templates_other table, kept as a fact |
templates_dedup(h1, h2, t1, t2) / templates_copies(…) |
One stream per pool when a pool is collected over several connections, for heights h1–h2 received in [t1, t2]: templates_dedup is what reads show, templates_copies classifies every row (primary, copy, secondary_stream, gap_fill). With one collector per pool, templates_dedup = the raw rows. A shown row's first_seen is the earliest of its exact copies; first_seen_latency_ms / first_seen_latency_method are that copy's latency estimate (latency_ms / latency_method are the row's own). height_window(h1, h2) gives a height range's receive window (t_from, t_to); pass '-infinity', 'infinity' for every row at the heights. The bounds go to chunk exclusion, so pass them as values |
blocks, blocks_best |
Every block stored (keyed by hash, so stale and active-chain blocks coexist); blocks_best hides the currently stale ones. block_hash is in display (explorer) order. mining_pool and analysis are jsonb |
pools |
Pool definitions from mempool/mining-pools |
stale_blocks, chain_reorgs |
Stale blocks and reorgs the node saw, plus stale blocks our node never had whose headers were imported from the public stale-blocks dataset after validation (header_source = node or bitcoin-data/stale-blocks; imported rows have status not-in-node) |
stale_tip_templates(from_height, to_height) |
Templates built on a tip other than the active chain's block at height − 1 (tip = stale or unknown), per height, pool and prev hash, with how long the pool kept mining on it |
mempool_txs, mempool_tx_inputs, mempool_blocks, mempool_offmempool, mempool_tx_raw |
Mempool recorder tables (details); hashes in internal byte order |
templates_rejected, ingest_events |
collector-go only: messages it couldn't store; bursts, dropped templates, starts, sessions and extranonce changes (kind: burst, sink_overflow, start, session, extranonce); in relay mode also each miner submit with the pool's result, each mining.set_difficulty and mining.configure (share, difficulty, configure; migration has the fields) |
hash_display(bytea), hash_from_display(text), stratum_prev_hash_to_block_hash(bytea) |
Byte-order helpers: internal ↔ display hex, and Stratum prev_hash → block hash |
Gotchas. Always filter template reads on height (or a height range): the functions take it as arguments, and a raw templates read without it reads the whole table. Take the Bitcoin tip from blocks_best, never from max(height) of templates: other chains' templates are stored too, at their own heights. For one height's templates, bound the receive time with height_window(h, h) (the web's height reads do), so a stuck feed's late re-send or another chain's template at a past height isn't counted. Templates at height h are work for the block after h − 1. With several collectors per pool, count from templates_dedup(…), or group raw rows by pool: one row per collector is not one template. Empty templates (no transactions, length(merkle_branches) = 0) all carry the same empty set, so drop them before grouping feeds by transaction set and report their timing separately. blocks.mining_pool keeps the name a block was identified with when it was stored, so older blocks can carry a pool's former name; newer pool lists only fill in blocks still unidentified.
-- The tip
SELECT max(height) AS tip FROM blocks_best;
-- Recent blocks and who mined them
SELECT height, encode(block_hash, 'hex') AS hash, block_time, mining_pool->>'name' AS pool, analysis->'flags' AS flags
FROM blocks_best ORDER BY height DESC LIMIT 10;
-- Per pool at one height (received in its window): templates, first template time, distinct first transactions.
-- The bounds come from height_window(). As values they exclude chunks at plan time (in psql:
-- `SELECT * FROM height_window(925000, 925000) \gset`, then :'t_from', :'t_to'); the subqueries below work in any
-- client but are slower (measured: 0.6 s against 20 ms).
SELECT pool, count(*) AS templates, min(first_seen) AS first_seen,
count(DISTINCT substring(merkle_branches FROM 1 FOR 32)) AS first_txs
FROM templates_dedup(925000, 925000, (SELECT t_from FROM height_window(925000, 925000)), (SELECT t_to FROM height_window(925000, 925000)))
GROUP BY pool ORDER BY first_seen;
-- Which pools built on which previous block at a height (a fork shows up as two prev hashes)
SELECT encode(stratum_prev_hash_to_block_hash(prev_hash), 'hex') AS prev_block, array_agg(DISTINCT pool) AS pools
FROM templates_dedup(925000, 925000, (SELECT t_from FROM height_window(925000, 925000)), (SELECT t_to FROM height_window(925000, 925000))) GROUP BY 1;
-- Each pool's first transaction of its latest template at a height, as an explorer txid
SELECT DISTINCT ON (pool) pool, hash_display(substring(merkle_branches FROM 1 FOR 32)) AS first_txid
FROM templates_dedup(925000, 925000, (SELECT t_from FROM height_window(925000, 925000)), (SELECT t_to FROM height_window(925000, 925000)))
WHERE length(merkle_branches) >= 32
ORDER BY pool, received_at DESC;
-- ... joined to the mempool recorder: when the node first saw it, and its fee rate
SELECT t.pool, hash_display(m.txid) AS txid, m.first_seen, m.fee::numeric / m.vsize AS sat_per_vb
FROM templates_dedup(925000, 925000, (SELECT t_from FROM height_window(925000, 925000)), (SELECT t_to FROM height_window(925000, 925000))) t
JOIN mempool_txs m ON m.txid = substring(t.merkle_branches FROM 1 FOR 32);
-- Templates that don't build on a block we know, per pool (last day; /api/forks groups them by parent, from unknown_parent_pools)
SELECT s.name AS pool, count(*), min(t.height), max(t.height)
FROM templates t JOIN sources s ON s.id = t.source_id
WHERE t.received_at > now() - interval '1 day'
AND NOT EXISTS (SELECT 1 FROM bitcoin_parents p WHERE p.prev_hash = t.prev_hash)
GROUP BY 1;
-- Pools that kept mining on a stale or unknown tip in the last 100 heights
SELECT height, pool, tip, templates, mined_after_switch
FROM stale_tip_templates((SELECT max(height) - 100 FROM blocks_best), (SELECT max(height) + 1 FROM blocks_best));
Read-only, served by web/app/api/ on any deployment (e.g. https://stratum.work/api/...). The public sites rate-limit per client; cache what you fetch, and prefer your own instance for bulk reads.
Past heights are limited per client when HEIGHT_RATE_LIMIT is set: /api/mining-notify, /api/analysis-data?height=, /api/block-pool-first-seen and /api/block-template-matches share one budget of past heights per client (a token bucket: HEIGHT_RATE_LIMIT heights per HEIGHT_RATE_LIMIT_WINDOW_S seconds, up to HEIGHT_RATE_LIMIT_BURST at once). A height costs once however many of these routes ask about it, and each client's last 32 heights are free to ask again; the tip and the two heights above it (current work) are always free. Over the limit: 429 with Retry-After (seconds) and {"error": …, "retry_after_s": N}. The client is CF-Connecting-IP, else the first X-Forwarded-For, else X-Real-IP, so only deploy it behind a proxy that sets them; IPv6 counts per /64. A request carrying none of them isn't limited (the server logs it once), and a client's first refusal is logged with its address. Counts are kept in memory per process: with several replicas each keeps its own.
| Route | Returns |
|---|---|
GET /api/stream |
Server-Sent Events: live templates and block events, what the UI renders. A new connection first gets {"type":"replay","data":<template>} for the templates the server received in the last 20 s (plus each pool's one before), then the live stream. One connection's templates per pool (how); a pool flooding templates is throttled, with {"type":"burst","pool_name":…,"suppressed":N,"first_ms":…,"last_ms":…} saying how many weren't sent. ?connections=all adds the pool's other connections' work (below) |
GET /api/mining-notify?height=H[&connections=all] |
Templates at a height: one stream per pool; with connections=all, every connection's templates, exact copies once, each with conns (its connections, a, b, …, first to receive it first; how) |
GET /api/blocks?n=20[&before=H|&after=H|&height=H] |
Blocks, newest first, with pool and analysis |
GET /api/block-pool-first-seen?height=H |
Each pool's first template time at a height, with a reliable flag |
GET /api/block-template-matches?height=H |
Which stored templates each block at H was built from (how): per block its identified pool, when it reached us, and a state (verified, empty_block, no_match, unknown); per verified match the pool, connection (a, b), first receive time (µs) with that copy's own latency estimate, template count and coinbase fit (coinbase, layout, merkle); without a match, the closest shared depth. No job ids |
GET /api/analysis-data?height=H / ?interesting=true |
Templates with decoded fields plus block details / blocks with analytics findings; first_transaction is "empty template" for a template with no transactions besides the coinbase (formerly "empty block") (details) |
GET /api/pools |
Pool definitions |
GET /api/stale-blocks?n=20 |
Recent stale blocks with the pools that built on them |
GET /api/forks?range=6e|26e|all |
Templates built on a parent other than the active chain's block, over the last 6 difficulty epochs (12,096 blocks, default), the last 26 (52,416 blocks) or all history, counted down from our tip (90d and 1y are still read as 6e and 26e), as episodes (one per parent): height, pools with their connections (a/b), first / last receive time, duration, templates (exact copies on a pool's connections count once), AuxPoW template share (null for a stale parent), the facts (tip when first and last seen, offset from it, nbits, Bitcoin's bits at height − 1, proof of work, the recorded stale block) and the kind (stale for a recorded stale block; inferred for an unknown parent: bitcoin_block, never_appeared, other_chain, invalid_parent, undetermined; invalid_coinbase for a finding with no fork at its height; rules), the invalid-coinbase finding at the height (invalid_coinbase), the template providers among its pools in the difficulty epoch it began in (providers, a count, null before that epoch's transaction sets are counted; provider_groups, the pools per provider, a pool in none has an unknown provider; rule), and the range in heights (blocks, tip_height, from_height). Unknown parents from the backend's unknown_parent_pools, stale ones from its stale_parent_pools; recomputed every 5 minutes. /api/unknown-parents is an alias |
GET /api/forks?range=…&providers=0 |
The same without template providers (providers null, provider_groups empty), cached apart: what the Forks page reads, since the providers are most of a cold read |
GET /api/forks?view=strip |
All history as the Forks page's strip, in a few KB: per row (a race per fork point, every other episode alone; rules) its position in Bitcoin time, height, kind, invalid work (0/1) and key, plus the epochs with another chain's work |
GET /api/forks?view=providers |
Per difficulty epoch with a Forks row, its template providers and their feeds ({ epochs: { [epoch]: string[][] } }, the rule of /api/template-providers), for grouping a row's pool tiles; pools excluded from the live site included (counted per finished height) |
GET /api/forks/timeline?height=<h> |
One height's fork timeline for a Forks row: per pool, runs of work on each parent (start, parent, invalid, empty), including where it went back to the block before (status previous), where its last run ends, the parents with their status and inferred kind, and the blocks at height − 1 and height (rules). Only heights with a fork (404 otherwise); a pool excluded from the live site is shown at heights at or below our tip and left out above it, as in /api/forks; every block still names its miner |
GET /api/forks?parent=<hex>[&range=…] |
One episode's details: every template from its pools at heights h − 1 … h + 1 within its minutes ± 5, decoded (scriptSig height, tags, AuxPoW root, outputs) and labelled by the parent it built on (best, stale, this, other), plus the blocks we know at h − 1 and h with their arrival |
GET /api/template-providers[?range=6e|26e|all] |
Blocks by template provider (rules): columns (one per counted difficulty epoch, then now = the last 144 blocks; range keeps the last 6 or 26 epochs), pies (the last 144 / 2,016 / 12,096 / 52,416 blocks and All), legend, each group with its kind (producer = a template provider, miner = miner-built, other = not on our feeds / unidentified), blocks, pools, pools paid, feeds and colour; plus tip_height, from_height, heights_counted. Recomputed every 5 minutes; 404 until heights are counted |
GET /api/tx/<txid> / GET /api/tx?txids=a,b,…[&at=ms] |
A transaction as our node saw it: fee, vsize, fee rates (own and ancestor package), first seen, how it left (mined, replaced, …) or mined off-mempool; found: false if never seen. Up to 100 txids, display-order hex (details) |
GET /api/realtime-prefill |
The tip and the current templates the realtime views start from: heights tip − 1 … tip + 1 in one read, the last 5 minutes by each row's own receive time plus each pool's latest before. Templates carry site and replica (their connection), as on the stream. ?connections=all adds connections (each other connection whose latest work matches no other connection's, as the stream's ?connections=all would have sent it: connection, age_ms, template) and letters (the letter of each recently active connection); both are absent if they couldn't be read |
GET /api/stream?connections=all sends exactly the default messages, plus three types. Clients that don't know them can ignore them.
{"type":"connection_template","connection":"b","data":<template>}: work on another of the pool's connections that matches no template any other of its connections received within 10 s of it (exact match on height, pool,prev_hash,merkle_branches,version,nbitsandntime; no tolerance). It is sent 10 s after it arrived, once that window has passed. Copies are never sent.{"type":"connection_copy","pool_name":…,"connection":"b","height":H}: that connection's latest template is an exact copy again, or it is now the connection the default stream shows. Its distinct work has ended.{"type":"connection_burst","pool_name":…,"connection":"b","suppressed":N,"first_ms":…,"last_ms":…}: likeburst, for that connection's messages, which have their own rate.
connection is the pool's connection ranked by (site, replica) over every connection it has had, as on the height page: a, b, …. A retired connection keeps its letter, so a pool's live connections can start at b, and a letter never changes while another connection is down. The first 10 s after the server's consumer starts aren't judged.
Prometheus text format on /metrics.
No sample carries a pool label: each collector is one process and one pool connection, named by
stratum_collector_info{pool,site,replica,version}. Join on the scrape target to label the others.
| Metric | Type | What |
|---|---|---|
stratum_collector_info |
gauge | 1, with labels pool, site, replica, version |
stratum_collector_templates_received_total |
counter | mining.notify messages received (stored as templates) |
stratum_collector_last_notify_timestamp_seconds |
gauge | Receipt time of the last template (unix seconds); 0 before the first one |
stratum_collector_start_time_seconds |
gauge | Process start (unix seconds) |
stratum_collector_notify_malformed_total, _rejected_total, _bursts_total, _reconnects_total |
counter | Quarantined mining.notify, quarantined messages, burst records, lost or failed connections |
stratum_collector_subscribed, _ready, _kernel_rx_timestamps |
gauge | 1 while subscribed, while /readyz succeeds, if receipt times are kernel timestamps |
stratum_collector_rx_clock_lag_seconds, _rx_clock_lag_max_seconds |
summary, gauge | How far the post-read clock trailed the kernel receive timestamp |
stratum_collector_latency_estimate_seconds{method} |
gauge | One-way latency estimate (RTT/2) |
stratum_collector_sink_queue_depth{sink}, _sink_events_total{sink,event} |
gauge, counter | Postgres and RabbitMQ sink queues and counters |
Every replica of a pool without a template for 5 minutes. Each replica counts from its last template, or from its
start if it has had none since: a restart doesn't look like silence, and a pool that stays silent across restarts
still shows up after 5 minutes. A timestamp, unlike increase(..._templates_received_total[5m]), has no counter
reset or missing history after a restart to misread.
time() - max by (pool) (
(
stratum_collector_last_notify_timestamp_seconds > stratum_collector_start_time_seconds
or stratum_collector_start_time_seconds
)
* on (job, instance) group_left (pool) stratum_collector_info
) > 300
A replica that isn't scraped at all drops out of the max; check up for that.
| Metric | Type | What |
|---|---|---|
stratum_backend_zmq_block_saved_seconds |
histogram | ZMQ hashblock receipt (blocks.seen_at) to the block saved, for blocks saved with seen_via zmq. Buckets 0.05 s to 40 s |
stratum_backend_reconcile_blocks_saved_total |
counter | Blocks saved with seen_via reconcile: the active-chain reconciliation found them missing, not ZMQ (a missed announcement, a reorg's other blocks, or a failed save of an announced block). Blocks mined while the backend was stopped are stored by the startup sync as synced, not counted |
histogram_quantile(0.95, sum by (le) (rate(stratum_backend_zmq_block_saved_seconds_bucket[1d])))
increase(stratum_backend_reconcile_blocks_saved_total[1d]) > 0
(cd backend && python -m pytest tests) # backend (from backend/)
(cd web && npm ci && npm test && npm run lint) # web: vitest + eslint
(cd collector-go && go test ./...) # collector
(cd mempool-recorder && go test ./...) # mempool recorderPython tests need the component's requirements.txt plus pytest; Go tests need Go (or the golang image). Some tests use a real Postgres when PG_TEST_* is set and skip otherwise (see .github/workflows/db.yml for the setup). With nothing installed locally, run them in the compose containers:
docker compose exec web npm test
docker compose run --rm --no-deps -v "$PWD:/repo" -w /repo/backend --entrypoint sh backend \
-c "pip install -q pytest && python -m pytest tests"End-to-end scripts (need Docker; everything runs in throwaway containers):
db/test-migrations.sh # migrations up/down/up + role privileges
backend/test-stale-blocks-e2e.sh # stale blocks: two regtest nodes, a fork and a reorg
backend/test-reorg-reconcile-e2e.sh # active chain across reorgs: tracker off, backend down, 2 deep, full-history check
backend/test-block-gap-fill-e2e.sh # historical gaps on a pruned node (-prune=550 -fastprune), filled via getblockfrompeer
mempool-recorder/test-e2e.sh # regtest node + TimescaleDB + recorder imageClient performance: npm run perf against a running production build (web/perf/README.md).
| Workflow | Runs on | Checks |
|---|---|---|
images.yml |
PRs, main, releases |
Builds multi-arch images (amd64 + arm64) of changed components; PRs push nothing, main pushes bboerst/stratum-work-<component>:sha-<7> and :main, releases push every component as :<tag> and :latest |
tests.yml |
Changes to web/, collector-go/, backend/ |
Web vitest, tsc and eslint; collector-go gofmt, vet and tests; backend pytest (Postgres-backed tests skip there; db.yml runs them) |
db.yml |
Changes to db/, postgres/, collector-go/, the backend's storage code |
Migrations on the local and the production image, collector-go's sink and the backend store against a migrated database (as their roles), stale blocks e2e, active-chain reconciliation e2e, historical gap fill e2e |
mempool-recorder.yml |
Changes to mempool-recorder/ or migrations |
gofmt, go vet, go test, e2e |
perf.yml |
PRs touching web/ |
Measures the PR against its base with web/perf and posts the table as a PR comment |
Issues and pull requests are welcome. The essentials (longer form in CLAUDE.md):
- Defaults preserve existing behavior. New settings are optional, documented in
.env.example, and default to the previous behavior. - No machine-specific values in the repo: hostnames, IPs, credentials, node URLs go in your gitignored
.envordocker-compose.override.yml. Keep secrets out of command lines (env vars or files). - Database changes only through migrations in
db/migrations/, with a working-- migrate:down. Applications connect as least-privilege roles (stratum_collector,stratum_backend,stratum_web,stratum_mempool), never as the owner. - Bitcoin RPC over https is verified with
BITCOIN_RPC_CA_FILE; never disable verification. - The browser does the processing: keep client CPU and memory low and check
npm run perffor web changes. - Images are built by CI only (
images.yml); deployments pinsha-<7>tags and promote the same image from dev to prod. - Pull requests: what was broken or missing, what changed, how it was tested (commands and results). Keep them focused. Squash merges are titled
Title (#N).
The backend runs analytics plug-ins for each processed block. They inspect the templates of the block's height and may emit small findings, stored on the block (analysis) and sent with the block event.
- Location:
backend/analytics/:prev_hash_divergence.py(pools advertising different previous block hashes),invalid_coinbase_no_merkle.py(every template's coinbase parsed strictly; templates with no merkle branches whose coinbase pays more than the subsidy),pool_identification.py(pool identification andPoolsManager). - Output:
analysis.flags[], each{ key, icon, details }, e.g.{"key": "prev_hash_fork", "icon": "fork", "details": {"groups": [{"prev_hash": "…", "pools": ["PoolA", "PoolB"]}]}};analysis.pool_identification={ mining_pool, method: "address|tag", addresses_considered }; andanalysis.coinbase_parse={ repaired: [{pool_name, stored_extranonce2_length, extranonce2_length, templates}], unparsed: [{pool_name, extranonce2_length, templates, sample_job_id}] }when any coinbase needed another extranonce2 length or didn't parse. - Analyses run once, when the block is stored. After changing the coinbase checks,
python -m coinbase_reanalysis [--from H] [--to H] [--dry-run]brings stored blocks up to date; after changing the DATUM template-creator rule,python -m coinbase_reanalysis --datum-creators [--dry-run]does the same for the creator.
- Add a module, e.g.
backend/analytics/my_feature.py, with a function returning a finding orNone:from typing import Any, Dict, List, Optional def analyze_my_feature(templates: List[Dict[str, Any]], logger) -> Optional[Dict[str, Any]]: if not interesting(templates): return None return {"key": "my_feature", "icon": "star", "details": {"…": "…"}}
- Call it in
run_block_analyses(...)inbackend/main.py, which fetches the height's templates from the store (store.templates_at_height(height)):finding = analyze_my_feature(templates, logger) if finding: flags.append(finding)
- Add tests in
backend/tests/and rebuild:docker compose up -d --build backend.
Guidelines: keep findings small (what the UI needs to render); keep the logic deterministic and scoped to the height's templates; with several collectors per pool the templates are every collector's rows (site / replica say which), so group by pool or pair exact copies per collector as invalid_coinbase_no_merkle.py does, rather than counting rows; use the shared logger and never log secrets.
- Design: MongoDB → Postgres + TimescaleDB: data access, schema, measurements, history migration, redundant collection.
- How the data is measured: what each value is, how it was taken, and its limits.
- Field docs in
docs/; component READMEs: mempool-recorder, web/perf. - CLAUDE.md: guidance for coding agents.
License: MIT, © the stratum.work contributors.