Publish sanitized P2Pool hashrate stats

Enable P2Pool's --data-api/--local-api and add a small stdlib-only sidecar
that copies an allowlist of numeric fields (node/sidechain hashrate,
connected miners, shares, network difficulty) to /p2pool/stats.json. Worker
IPs and wallet fragments in local/stratum are never served.

An Ingress adds that single path to the website host (www.eom.dev by
default), so the homepage can read it same-origin and reuse its TLS cert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018STDcc5BaYxPMNA9S8Wycs
This commit is contained in:
2026-11-08 02:37:26 +00:00
co-authored by Claude Opus 5.5
parent fd4f3184d7
commit 946256a3dd
5 changed files with 316 additions and 2 deletions
+27
View File
@@ -22,6 +22,33 @@ Optional:
stop earning once they leave its PPLNS window.
- `monero_p2pool_addpeers` (default `[]`): extra P2Pool peers as `host:port`.
They must be on the same chain.
- `monero_p2pool_stats_host` (default `www.eom.dev`): website host that gets
the public `/p2pool/stats.json` path. Use `""` to keep stats internal.
- `monero_p2pool_stats_ingress_class` (default `nginx`), `monero_p2pool_stats_image`
(default `python:3.13-alpine`).
Public stats
------------
P2Pool runs with `--data-api /api --local-api`. Those files include miner IP
addresses, so they are never served. A `stats` sidecar
(`files/p2pool_stats.py`, standard library only) copies an allowlist of numeric
fields into one JSON document:
{"sidechain": "nano",
"node": {"hashrate_15m", "hashrate_1h", "hashrate_24h", "miners",
"shares_found", "shares_failed", "current_effort",
"average_effort", "reward_share_percent",
"last_share_found_time", "updated_at", "stale"},
"pool": {"hashrate", "miners", "difficulty", "height", "blocks_found",
"last_block_found_time", "pplns_window", "updated_at", "stale"},
"network": {"hashrate", "difficulty", "height", "reward_xmr",
"updated_at", "stale"}}
`node` is this P2Pool instance (everyone mining through it); `pool` is the
whole sidechain. Sections are `null` until P2Pool writes them, and the
endpoint answers 503 until `node` exists. Run the sidecar's tests with
`python3 -m unittest discover -s tests`.
Example Playbook
----------------