Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Setup Health-Checks

Since Phase 9, the first-run wizard (dvb-warppool-setup) doesn’t just check the Bitcoin Core RPC connection itself — it runs a diagnostic of:

  1. Bitcoin Core health — everything reachable over RPC (/api/bitcoin-health)
  2. Connectivity snapshot — RPC + ZMQ endpoint reachability, pre-filled from your bitcoin.conf (/api/connectivity-snapshot)

Both checks are entirely local — the wizard never contacts a third party.

Privacy matrix

CheckWhat it doesPrivacy
Bitcoin health (RPC calls)Localhost → Bitcoin Core✅ Local
Connectivity snapshotTCP-dials the configured RPC + ZMQ endpoints✅ Local

There are no opt-in external probes and no third-party calls. The wizard reads your bitcoin.conf (when a path is given) purely locally — to pre-fill the form and to filter the config recommendations.

Bitcoin health in detail

A click on “Bitcoin Core health check” makes 5 RPC calls in parallel:

RPCWhat we extract
getnetworkinfoversion, subversion
getblockchaininfoibd, chain, blocks, headers, verification_progress, size_on_disk, pruned
getindexinfotxindex (on/off)
getpeerinfoinbound/outbound peer count
getzmqnotificationspubhashblock/pubrawblock endpoints

Plus automatic warnings:

ConditionWarning
ibd=trueMining not yet possible; the pool should only start after sync
peers.total < 8Tip latency increased; new blocks arrive later
peers.inbound = 0 on mainnetPort 8333 is probably not forwarded
zmq.hashblock=NonePool falls back to RPC polling (job refresh latency)
pruned=trueSome features (txindex-based) are limited
verification_progress < 99.9% (and not IBD)Still syncing

Why inbound peers matter for a pool. peers.inbound = 0 is not just a good-citizen nag: a node that nobody can dial reaches the network’s new tip only through its own outbound peers, which adds latency to every block change — and every millisecond your pool keeps handing out a stale job is hashrate spent on a block that can no longer be won. For an internet-facing pool, forward TCP 8333 to the node and keep listen=1 on. The live reference deployment (pool.warppool.org) runs a pruned Bitcoin Core 31.1 with 8333 open, sitting at roughly 30 peers. The warning is skipped when the daemon already sees a LAN peer on 8333 (lan_peer_at_8333), so a node fronted by another host on the same network doesn’t warn spuriously.

Connectivity snapshot

On load (and via “↻ Re-check connection”) the wizard fetches /api/connectivity-snapshot, which:

  1. Reads the RPC + ZMQ settings — from your bitcoin.conf if a path is given, otherwise mainnet defaults (:8332) — and pre-fills the form.
  2. TCP-dials each endpoint locally (RPC URL, zmqpubhashblock, zmqpubrawblock) with a short timeout and reports each as reachable / unreachable / not-set. Nothing is sent beyond the dial.
  3. When no bitcoin.conf is found, it offers a one-click “Create mainnet config” (/api/create-bitcoinconf — writes a config with ZMQ + a random RPC password).

There is no port-bind smoke test, no UPnP discovery, and no external reachability probe in the wizard. Reachability of your public node is a Bitcoin Core concern (see the peers.inbound warning above); persistent UPnP forwarding lives in the daemon ([upnp], see below).

What this looks like in code

Backend in apps/dvb-warppool-setup/src/main.rs:

  • bitcoin_health(BitcoinHealthReq) — the 5 RPC calls + the warnings (delegates to warppool_health)
  • connectivity_snapshot() — TCP-dials the RPC + ZMQ endpoints and reports each

The warning logic lives in the warppool-health crate (collect_bitcoin_warnings_v2_with_conf) and has 15 unit tests in crates/health/src/bitcoin.rs covering every warning edge case (IBD, low-peers, no-inbound, no-zmq, pruned, verification-progress, no-double-warning-on-IBD, healthy-zero-warnings, plus the inbound / listen / private-LAN-peer cases).

UI in apps/dvb-warppool-setup/src/index.html:

  • Bitcoin card with RPC test + health-check button
  • Connectivity card with per-endpoint status pills + override boxes
  • Status cards with icons (✅⚠️❌), key-value rows, warning list with ⚠ bullet

Phase 10a — bitcoin.conf snippet generator

Instead of just emitting warnings, since Phase 10a the health check generates a copy-paste-ready bitcoin.conf snippet that fixes the identified problems. No direct write — the operator decides what (if anything) to adopt.

What ends up in the snippet

Health findingSnippet line
zmq.hashblock=Nonezmqpubhashblock=tcp://127.0.0.1:28332
zmq.hashblock=None AND zmq.rawblock=None+ zmqpubrawblock=tcp://127.0.0.1:28333
peers.total < 8 AND peers.outbound < 8maxconnections=125
peers.inbound == 0 AND chain="main"listen=1 + comment about port forwarding
bitcoin.conf readable AND blockreconstructionextratxn absentblockreconstructionextratxn=1000 (see Node Tuning)

What we deliberately don’t suggest:

  • txindex=1 — heavy, many pools don’t need it (pruned is fine for solo)
  • server=1 — if the RPC test got through at all, this must already be true
  • bind= — the default all-interfaces fits almost every case

Format

The comment lines in the real output are German (the key/value lines are exactly as shown):

# ===== dvb-WarpPool Setup-Wizard Recommendations =====
# ZMQ block notifications for immediate job refresh
zmqpubhashblock=tcp://127.0.0.1:28332
zmqpubrawblock=tcp://127.0.0.1:28333

# More peer slots so Bitcoin Core gets more stable peer discovery
maxconnections=125

# enable listening so incoming peers can connect
# (additionally: forward port 8333/tcp on the router to this machine)
listen=1
# ===== End Recommendations =====

Header + footer as wrapper comments so the operator spots the section immediately — no risk of accidentally overwriting existing settings (all recommendations sit inside a marked block).

UI

In the browser:

  • 📋 box containing the snippet as monospace code
  • “Copy” button (navigator.clipboard.writeText)
  • OS-aware path hint: ~/.bitcoin/bitcoin.conf (Linux), ~/Library/Application Support/Bitcoin/bitcoin.conf (macOS), %APPDATA%\Bitcoin\bitcoin.conf (Windows) — via navigator.platform
  • Fallback alert if the clipboard API is unavailable (e.g. http context without a TLS cert)

Daemon UPnP renew loop (Phase 27)

The wizard itself does not open router ports — it has no UPnP feature. Persistent port forwarding is a daemon concern: an opt-in renew loop in the daemon refreshes the forwards listed in the [upnp] block every renew_interval_secs. Opt-in (default enabled = false).

Configuration:

[upnp]
enabled = true
renew_interval_secs = 3000  # 50min, safely below the 3600s lease

[[upnp.forwards]]
port = 3333
protocol = "tcp"
lease_seconds = 3600
description = "Stratum V1"

UPnP add_port is idempotent on the router side (same port + protocol = extend lease, don’t create a second entry). The first renew happens 10s after daemon start (covers crash recovery), then every renew_interval_secs seconds (range 60..=86400). Errors are only logged — the loop keeps running so transient problems don’t permanently kill the forward.

Typical router quirks

  • FritzBox default: UPnP-discoverable = yes, but add_port = blocked. The operator has to enable “Allow UPnP status changes via UPnP” in the web UI. We then return add_port: The client is not authorized to map this port.
  • OpenWrt: UPnP off by default, has to be installed as a package (miniupnpd).
  • ISP routers (Telekom Speedport etc.): UPnP often completely disabled; some models have no UPnP at all.

In all of these cases the wizard shows a clear error with the exact router reason. The operator knows what to do.

Phase 12 — bitcoin.conf parse-existing

Instead of suggesting every recommendation, since Phase 12 the snippet generator filters out lines that are already configured — if the operator supplies the path to their bitcoin.conf.

How it works

  1. UI field “bitcoin.conf path” (optional, OS-aware placeholder)
  2. Path is sent along with the /api/bitcoin-health POST
  3. Server parses the file with parse_bitcoin_conf_str(&str) -> BTreeMap<String, Vec<String>> — line-based, tolerant of:
    • Comments (# ...)
    • Empty lines + whitespace
    • Section headers [main] [test] (ignored, all keys flattened)
    • Multiple values per key (e.g. two zmqpubhashblock= lines)
    • Malformed lines (no = → ignored, no crash)
  4. generate_bitcoinconf_snippet(&BitcoinHealth, parsed.as_ref()) filters per recommendation: if !parsed.contains_key("zmqpubhashblock") → push recommendation

Default behavior is preserved

If the path is not set: all recommendations as before. If the path is set but the file isn’t readable: all recommendations + warning “bitcoin.conf at … not readable”.

Example

bitcoin.conf before the health check:

server=1
rpcuser=warppool
zmqpubhashblock=tcp://127.0.0.1:28332
maxconnections=200

What previously would have been suggested in the snippet:

  • zmqpubhashblock=tcp://127.0.0.1:28332 (even though it’s already there!)
  • zmqpubrawblock=tcp://127.0.0.1:28333 (may be missing)
  • maxconnections=125 (even though 200 is already set!)
  • listen=1 (may be missing)

What with Phase 12 gets suggested:

  • only zmqpubrawblock=tcp://127.0.0.1:28333 and listen=1 — the rest is already configured.

What we do NOT do

  • No value-compare: if the operator has maxconnections=10 (bad), we still don’t suggest maxconnections=125 — we trust that the operator chose that value deliberately. We only fix “missing keys”, not “bad values”.
  • No direct write: we only parse read-only, no backup risk.
  • No TOML/JSON format: bitcoin.conf has its own line-based format, not TOML.

ZMQ silence detection (GBT template source)

bitcoin_no_zmq_hashblock fires when the node has no zmqpubhashblock endpoint at all. The more insidious failure is a configured endpoint that never delivers: wrong address, container network not reachable from the pool, a firewall, or bitcoind restarted on a different IP. Nothing errors, the pool simply learns about new blocks from the poll tick — up to job_refresh_secs (30 s unless configured; 90 s in the recommended ESP32 setting) after the network did.

The GBT template source therefore keeps a ZmqLiveness counter: every tip change it discovered through the poll tick while ZMQ watchers are running increments tips_without_zmq; every real ZMQ hashblock event resets it. Since v1.44 a tip the GBT long poll ([node] gbt_longpoll) reports before ZMQ counts the same way — the pool still gets the block in time, but the warning tells you ZMQ is not doing its job. The periodic health check surfaces bitcoin_zmq_hashblock_silent (with the number of missed tips) once the counter reaches 2. The warning is suppressible like the others, and the daemon log carries a warn! per missed tip. The IPC template source is exempt: waitNext pushes tips itself and has its own ipc_template_stale watchdog.

Block assembly checked by Core (block_proposal_rejected)

A pool that has never found a block has never had Core confirm that its block assembly is valid. Since v1.44 the daemon checks this itself: on the first job after start, then on every sixth tip change (roughly hourly on mainnet) and on every tip after a reject, it builds a block from the current job over the submitblock hex path (build_full_block_hex, with a test coinbase: zero extranonces, nonce 0) and, three seconds after the job went to the miners, hands it to Core as a BIP 23 proposal (getblocktemplate {"mode":"proposal"}). Core validates everything except proof of work — coinbase height, witness commitment, merkle root, weight, sigops, time — and answers null (valid) or a reject word such as bad-txnmrklroot; a block Core cannot even decode (-22 Block decode failed) counts as a reject too. The check costs Core a TestBlockValidity under cs_main with the whole block as hex, which is why it does not run on every tip. It covers the job, coinbase, witness commitment, merkle branches and transaction set; the IPC submitSolution call itself is covered by the regtest end-to-end tests, not by this check. The result is in /api/overview under network.last_block_proposal_at (last check), last_block_proposal_ok_at and last_block_proposal_ok_height (last clean check), last_block_proposal_reject, last_block_proposal_height (last check, may be an inconclusive one), last_block_proposal_ms and block_proposal_check_enabled, in the metrics warppool_block_proposal_ok_at_seconds, warppool_block_proposal_rejected and warppool_block_proposal_ms, and on the dashboard’s network card (“Block assembly checked by Core: OK”). A reject raises the suppressible block_proposal_rejected warning with the reason and height and stays until a later check is clean; an inconclusive-* answer (the tip moved on meanwhile) or an RPC error is no verdict and changes nothing. The check runs asynchronously, never in the job-notify path, and covers V1 and Sv2 alike (both share the job); in per-worker mode the test coinbase pays a placeholder address. [server] block_proposal_check = false turns it off.

Miners were sent to their fallback pool (node_unhealthy_miners_disconnected)

Since v1.45 the pool disconnects and refuses miners while the template source has delivered nothing for longer than the grace ([server] node_unhealthy_grace_secs, default 600 s) — see Resilience → Miners go to their fallback pool. While the gate is closed the health tick raises this suppressible warning with the reason (no-template, or ibd when the node also reports initial block download) and when the miners were disconnected; it clears itself the moment a template arrives and the gate opens. /api/overview carries network.miner_gate_closed, miner_gate_closed_since, miner_gate_reason, miner_gate_opened_at and miner_gate_refused_total; the metrics are warppool_miner_gate_closed and warppool_miner_gate_refused_total.

A found block waits in the spool (block_spool_pending)

Since v1.45 a found block is written to <data_dir>/block-spool/ beside the submit and resubmitted until a node gives a final verdict (see Resilience → Found block spool). While at least one block is pending, the health tick raises the suppressible block_spool_pending warning with the count, the oldest block’s height, its attempts and the last answer; /api/overview carries network.block_spool_pending, block_spool_oldest_at and block_spool_entries, and the metric warppool_block_spool_pending the count. The warning clears itself once the loop resolves the block (accepted, rejected for real, or stale because the chain moved on).

A second key, block_spool_error, fires when the spool directory failed the start-up write probe (the daemon creates block-spool/, writes and fsyncs a test file) or holds files it cannot read: a found block would then be kept in memory only and lost on a restart. Fix the directory (free space, permissions) and restart the pool; /api/overview shows the detail in network.block_spool_error.

auto switches between GBT and IPC at runtime

template_source = "auto" probes the IPC socket for three seconds at start. When the Bitcoin node starts a few seconds after the pool — the normal order on Umbrel after a Bitcoin app update restarts both apps — the probe misses and the pool starts on GBT. As of this release that is no longer a restart case: the pool probes the socket again every 60 s (backing off to 5 min) and switches to IPC as soon as the socket answers and delivers its first template, with GBT delivering until then. A socket that stops delivering later (node update, IPC toggle off, mount gone) takes the pool back to GBT after three refresh intervals — or within ten seconds when the ZMQ watchers report a tip that IPC does not deliver — and the retry starts over with a growing backoff while the socket keeps flapping. Each switch is one log line; the header badge and the node card on the admin health page show the source in force. There is no health warning for it any more (the former ipc_auto_fallback_socket_reachable is gone).

Bitcoin Core release check (opt-in)

With [node].check_core_updates = true the daemon fetches the Bitcoin Core release list once every core_update_check_hours (default 24) and the health tick raises bitcoin_core_update_available (params current, latest) when a newer final release exists on the node’s own major line. Newer major lines only show up as bitcoin.latest_core_release in the snapshot. Off by default — see the configuration reference for the privacy rationale.

Phase 13 — daemon periodic health check

The setup wizard runs once at first-run. The daemon runs continuous checks in the running pool — and pushes every change as an SSE event so the UI can show a dashboard widget.

Wiring

13a — crate extraction: The health logic was extracted out of the setup wizard into its own crate warppool-health. Since then the setup wizard is just a thin axum wrapper; the daemon can call the same functions directly without code duplication.

13b — periodic task: At startup, the daemon spawns a tokio task that runs the health check every N seconds (default 60). Activated via env:

WARPPOOL_HEALTH_CHECK_INTERVAL_SECONDS=60 dvb-warppool-daemon
# 0 = off (default on when env not set → 60s)

Per tick:

  1. Re-resolve RPC auth from config.node.rpc_cookie_path (preferred) or secrets.rpc_user/rpc_pass (the cookie gets rotated on Bitcoin Core restart — we read fresh every time)
  2. warppool_health::check_bitcoin_health(&client, &url, &auth).await
  3. collect_bitcoin_warnings_v2_with_conf(&h, None); the daemon then appends its own keys (ipc_template_stale, block_proposal_rejected, bitcoin_zmq_hashblock_silent) and projects the legacy warnings strings from warning_keys
  4. event_bus.publish(PoolEvent::HealthSnapshot { ... })

SSE event format

{
  "type": "health_snapshot",
  "at": "2026-05-27T12:00:00Z",
  "rpc_ok": true,
  "peers_total": 12,
  "peers_inbound": 3,
  "ibd": false,
  "pruned": false,
  "zmq_hashblock_ok": true,
  "warnings": [
    "Few peers (3/8 recommended) — tip latency increased"
  ],
  "warning_keys": [
    { "key": "bitcoin_few_peers", "message": "…", "params": { "total": "3" } }
  ]
}

warnings is the legacy array of ready-made strings; warning_keys carries the same warnings structured (stable key + params) so the UI can localise them into all supported languages and so an operator can suppress a warning by key (see below). The UI prefers warning_keys and falls back to warnings.

The UI subscribes via EventSource('/api/events'), dispatches on event.type === 'health_snapshot', and renders a banner/badge with the warnings (HealthBanner.svelte).

What it deliberately does NOT do

  • No bitcoin.conf parse in the periodic check — that’s setup-wizard-specific because it generates snippet recommendations. The daemon doesn’t need it.
  • No UPnP check in 13b — UPnP state changes rarely and is operator-side. The setup wizard checks once.
  • No delta detection — we push every snapshot; the UI does the client-side compare if needed. Saves server state. (Still true today.)
  • No read-only API endpoint GET /api/admin/health — the UI uses SSE. The only admin health routes that exist are the suppression ones below. A pull endpoint for CLI scripting is still open; for now, /metrics covers scripted monitoring.

Operator example

# Filter the live SSE stream down to health events
curl -N http://localhost:18334/api/events 2>/dev/null \
    | grep -A1 'event: health_snapshot'

# event: health_snapshot
# data: {"type":"health_snapshot","at":"...","rpc_ok":true,...}

The operator sees, for example, when after weeks of uptime zmq_hashblock_ok=false suddenly shows up (Bitcoin Core restarted without ZMQ config) — and can react without anyone having to monitor hands-on.

Phase 14 — health banner in the dashboard (shipped)

The health_snapshot events are rendered by HealthBanner.svelte as a persistent banner below the header, localised from warning_keys (falling back to the raw warnings strings for older daemons). The banner is dismissable per session on purpose — no localStorage, so a reload brings it back and nothing gets permanently hidden by accident.

Suppressing a warning permanently

Some warnings are correct but irrelevant for a given deployment — a deliberately pruned node, for example, does not need to be told it is pruned on every reload. A logged-in operator can therefore suppress a warning by its stable key:

  • In the UI: Admin → Health, or the “hide permanently” control on the banner.
  • The admin health page also shows a node card on top: Core version with the newest release on the same line and overall (when the opt-in release check is on), chain, block height / headers, peers, pruned / txindex, ZMQ hashblock endpoint, template source and the time of the last health tick. It reads GET /api/admin/health/node (admin-authenticated), which returns the daemon’s last full node-health view and 503 until the first tick ran.
  • Over the API: GET /api/admin/health/suppressions, POST /api/admin/health/suppress { "key": "bitcoin_pruned" }, DELETE /api/admin/health/suppress { "key": "bitcoin_pruned" } — all admin-authenticated.

The stable keys are bitcoin_ibd, bitcoin_few_peers, bitcoin_no_inbound_listen, bitcoin_no_inbound_no_listen, bitcoin_no_zmq_hashblock, bitcoin_zmq_hashblock_silent, bitcoin_pruned, bitcoin_verification_progress, bitcoin_core_update_available (opt-in), ipc_template_stale and block_proposal_rejected.

The suppression list lives in the database and is re-read on every health tick, so changes take effect without restarting the daemon. Suppressed keys are filtered out before the legacy warnings strings are built, so a suppressed warning disappears from both fields. Only warnings that carry a key can be suppressed.

IPC template-stale warning

When the pool takes its templates from Bitcoin Core’s IPC interface ([node] template_source = "ipc" — note that Core’s IPC interface is itself experimental), the health loop additionally watches whether templates are still arriving. If none has arrived for longer than 3 job-refresh intervals (at least 90 s), it raises the suppressible ipc_template_stale warning — a permanently dead socket (node downgraded below Core 31, IPC toggle off, mount gone) would otherwise fail silently as “no new jobs”. With "ipc" it is deliberately only a warning: there is no automatic fallback to GBT; the way back is setting [node] template_source = "gbt" and restarting. With "auto" the pool falls back to GBT by itself after the same interval and keeps retrying IPC, so the warning appears only while IPC is the source in force.

See also

  • Notifications — rpc-down / rpc-recovered events are fired by the same health loop
  • Observability — warppool_rpc_ready + RPC latency histogram
  • Troubleshooting — when the wizard shows “cookie not readable” or UPnP finds no gateway