feat(#593): opt-in local miner — hand off stratum URL + secret for a co-located RigForge worker#725
Merged
Merged
Conversation
…co-located RigForge worker
A box that runs the stack 24/7 can mine with its spare CPU by co-locating a
RigForge worker on the stack host, pointed at the stack's own loopback stratum.
Pithead's side is purely intent + hand-off:
- `local_miner.enabled` config flag (default off), registered in
config.reference.json (closed-schema superset invariant).
- A `pithead setup` prompt ("Also mine on this machine with its spare CPU?",
default N) that writes the flag.
- announce_local_miner(): on setup/apply, surface the two values a RigForge
install would otherwise prompt for — the pool URL (loopback 127.0.0.1:PORT,
or the bound p2pool.stratum_bind address for the LAN-bind edge case) and the
stratum secret already in .env — so the co-located rig self-registers through
the proxy like any other worker.
Pithead adds NO HugePage/GRUB/MSR/governor code: RigForge owns all host-level
tuning and the miner service. Docs (docs/workers.md) state that ownership.
Tier-1 shell coverage: announce_local_miner opt-out/opt-in, loopback vs LAN
bind, no-password case; wizard prompt-count pin; wizard opt-in write. A real
co-located mining run is tier-4 (deferred).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…p completeness) The new local_miner.enabled config leaf fell into the catch-all Other group, failing the buildSections completeness test that every reference leaf resolves to a real group. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #593.
What this does
Adds an opt-in local miner: a box that runs the stack 24/7 can mine with its spare CPU by co-locating a RigForge worker on the stack host, pointed at the stack's own loopback stratum. The dashboard already discovers workers from the proxy, so a local rig self-registers with no stack-side wiring — the only friction was copying two values by hand. This closes that gap.
Scope (deliberately narrowed to config + hand-off + docs)
Per the issue's re-scoped design, RigForge owns all host-level tuning (HugePages, GRUB, MSR, governor, the miner service). Pithead's job is purely to declare intent and hand off. This PR does not vendor/drive RigForge or render a RigForge
config.json— those remain follow-on work; a manual RigForge install on the same host, fed the two printed values, is fully functional today.Pithead-side wiring added:
local_miner.enabledconfig flag (default off), registered inconfig.reference.jsonto satisfy the closed-schema superset invariant (feat(dashboard): commit dashboard.energy from the config editor + close config.json smuggling gap in the control gate (#504, #33) #537/tier 1 drift guard: every config path pithead reads must exist in config.reference.json #561). The drift-guard test picks up the newconfig_boolread site automatically (still green).pithead setupprompt — "Also mine on this machine with its spare CPU?" (default N), wired throughwizard_ask_shape→wizard_write_configlike the existing clearnet/onion/telegram opt-ins.announce_local_miner()— onsetupandapply, surfaces the two values a RigForge install would otherwise prompt for:127.0.0.1:${STRATUM_PORT}for a0.0.0.0/loopback bind, or the configuredp2pool.stratum_bindaddress for the specific-LAN-bind edge case the issue calls out (loopback wouldn't reach it).PROXY_STRATUM_PASSWORDfrom.env, shown only when set (a "none set" note otherwise).docs/workers.md#mine-on-the-stack-host-itself) — how to enable it, that RigForge owns the host tuning, and the host-global-governor / thread-cap caveats.No HugePage / GRUB /
nr_hugepages/ MSR / governor code was added — confirmed. (Note: the issue's claim that Pithead has no such code is inaccurate —optimize_kernelalready does GRUB/HugePages tuning for the stack's own RandomX use — but this PR adds none and does not touch it.)Testing
Tier-1 shell (
tests/stack/run.sh), all green (1550 passed):announce_local_miner hands off the stratum URL + secret only when opted in (#593)— opt-out prints nothing, absent block prints nothing, opt-in surfaces the loopback pool URL + secret + the RigForge-owns-tuning note, LAN-bind targets the boundaddress:port, and the no-password case is stated explicitly.wizard_ask_shape has exactly 6 read prompts— prompt-count pin updated (5 → 6).defaults path: no local_miner block written (opt-in off, #593)andopt-in path: local_miner.enabled written true (#593)— wizard prompt → write wiring.config.reference.json stays a complete superset(tier 1 drift guard: every config path pithead reads must exist in config.reference.json #561) — passes with the new key.Tier-4 deferred: a real co-located mining run (start a thread-capped RigForge worker against the stack's stratum, verify it self-registers and the stack keeps sync/share reliability) needs a mining host and is out of band for this config/doc change — matches the issue's own validation plan.
make lint: all touched surfaces pass (shellcheck/shfmt, docs-voice 31/31, markdownlint 0 errors).lint-protofails locally only because it requires a running Docker daemon (Tari protobuf lint, unrelated to this change).🤖 Generated with Claude Code