Skip to content

Commit 721cbfb

Browse files
committed
update docs
1 parent 46f29b6 commit 721cbfb

File tree

4 files changed

+74
-55
lines changed

4 files changed

+74
-55
lines changed

README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,53 @@
66
[![Go Report Card](https://goreportcard.com/badge/github.com/Distortions81/M45-Core-goPool)](https://go.dev)
77
[![License](https://img.shields.io/github/license/Distortions81/M45-Core-goPool)](https://github.com/Distortions81/M45-Core-goPool/blob/main/LICENSE)
88

9-
goPool is a solo Bitcoin mining pool that connects directly to Bitcoin Core over JSON-RPC and ZMQ, exposes Stratum v1 (with optional TLS), and ships with a status UI + JSON APIs for monitoring.
9+
goPool is a **from-scratch Golang solo Bitcoin mining pool**. It connects directly to Bitcoin Core over JSON-RPC and ZMQ, exposes Stratum v1 (with optional TLS), and ships with a status UI + JSON APIs for monitoring.
10+
11+
## What this project is
12+
13+
- A solo Bitcoin pool server written in Go from the ground up for this project.
14+
- A direct integration with Bitcoin Core (no external pool engine dependency).
15+
- A self-hosted stack: Stratum endpoint, web status UI, and JSON APIs.
16+
17+
## Feature highlights
18+
19+
- **Solo mining core**: builds and submits Bitcoin blocks directly against Bitcoin Core (`getblocktemplate` + `submitblock`) with JSON-RPC and optional ZMQ acceleration.
20+
- **Stratum v1 server**: supports `mining.subscribe`, `mining.authorize`, `mining.submit`, `mining.configure`, CKPool-style `mining.auth`, and optional Stratum TLS.
21+
- **Compatibility controls**: CKPool subscribe-response emulation, version-rolling support, suggest-difficulty handling, optional `mining.set_extranonce` and `mining.set_version_mask` notifications.
22+
- **Share-policy controls**: duplicate checks, nTime and version-rolling checks, worker-match enforcement, stale-job freshness modes, and optional inline submit processing.
23+
- **VarDiff + hashrate telemetry**: configurable difficulty clamps/targets, EMA smoothing, worker/pool hashrate history, and best-share tracking.
24+
- **Safety and resilience**: node/job-feed health gating (disconnect/refuse when unsafe), reconnect/invalid-submit banning, pending submission replay, and stale-feed safeguards.
25+
- **Web status UI + JSON APIs**: live overview, node/pool/server pages, worker pages, and `/api/*` endpoints for monitoring/automation.
26+
- **Operator controls**: optional admin panel for live settings updates, persist-to-disk controls, log tooling, and guarded reboot action.
27+
- **Storage and backups**: SQLite state store with atomic snapshots and optional Backblaze B2 upload workflow.
28+
- **Auth/integrations**: optional Clerk auth flows, saved-worker pages, Discord notification toggles, and one-time worker linking codes.
29+
- **Performance options**: fast-path Stratum decode/encode toggles, socket buffer tuning, optional SIMD JSON/hash paths, and built-in profiling hooks.
30+
31+
## Direct Go libraries and licenses
32+
33+
The table below lists direct Go module dependencies from `go.mod` and the license declared in each dependency's upstream `LICENSE*` file.
34+
35+
| Library | Version | License |
36+
|---|---:|---|
37+
| github.com/Backblaze/blazer | v0.7.2 | Apache-2.0 |
38+
| github.com/btcsuite/btcd | v0.25.0 | ISC |
39+
| github.com/btcsuite/btcd/btcec/v2 | v2.3.6 | ISC |
40+
| github.com/btcsuite/btcd/btcutil | v1.1.6 | ISC |
41+
| github.com/btcsuite/btcd/chaincfg/chainhash | v1.1.0 | ISC |
42+
| github.com/bwmarrin/discordgo | v0.29.0 | BSD-3-Clause |
43+
| github.com/bytedance/sonic | v1.15.0 | Apache-2.0 |
44+
| github.com/clerk/clerk-sdk-go/v2 | v2.5.1 | MIT |
45+
| github.com/golang-jwt/jwt/v5 | v5.3.0 | MIT |
46+
| github.com/hako/durafmt | v0.0.0-20210608085754-5c1018a4e16b | MIT |
47+
| github.com/martinhoefling/goxkcdpwgen | v0.1.1 | MIT |
48+
| github.com/minio/sha256-simd | v1.0.1 | Apache-2.0 |
49+
| github.com/pebbe/zmq4 | v1.4.0 | BSD-3-Clause |
50+
| github.com/pelletier/go-toml | v1.9.5 | Apache-2.0 |
51+
| github.com/remeh/sizedwaitgroup | v1.0.0 | MIT |
52+
| golang.org/x/sys | v0.40.0 | BSD-3-Clause |
53+
| modernc.org/sqlite | v1.44.1 | BSD-3-Clause |
54+
55+
Additional third-party asset notices are in `THIRD_PARTY_NOTICES.md`.
1056

1157
> **Downloads:** Pre-built binaries are available on GitHub Releases.
1258

data/config/examples/autogen.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ cp data/config/examples/services.toml.example data/config/services.toml
4141
- **Examples are regenerated:** Example files are recreated on each startup to reflect current defaults
4242
- **Don't edit examples:** Your changes to `.example` files will be lost on restart
4343
- **Actual configs are protected:** Your configuration files in `data/config/` are gitignored and never overwritten
44-
- **Cookie authentication preferred:** RPC credentials in `secrets.toml` only work with the `-allow-rpc-credentials` flag. Prefer setting `node.rpc_cookie_path` in `config.toml` for secure cookie-based authentication
44+
- **Cookie authentication preferred:** RPC credentials in `secrets.toml` only work with the `-allow-rpc-creds` flag. Prefer setting `node.rpc_cookie_path` in `config.toml` for secure cookie-based authentication
4545

4646
## Authentication Priority
4747

4848
1. **Cookie file** (recommended) - Set `node.rpc_cookie_path` in `config.toml`
4949
2. **Auto-detection** - goPool searches common locations if `rpc_cookie_path` is empty
50-
3. **Username/password** (deprecated) - Use `rpc_user`/`rpc_pass` in `secrets.toml` with `-allow-rpc-credentials` flag
50+
3. **Username/password** (deprecated) - Use `rpc_user`/`rpc_pass` in `secrets.toml` with `-allow-rpc-creds` flag
5151

5252
See [operations.md](../../../documentation/operations.md) for detailed configuration options.

documentation/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Documentation Index
22

3-
- `operations.md` - Build, configuration, runtime flags, listeners/TLS, backups, and day-to-day operations.
4-
- `json-apis.md` - Public and authenticated `/api/*` endpoint reference (payloads, auth expectations, caching).
5-
- `stratum-v1.md` - Stratum v1 method compatibility matrix and behavior notes.
6-
- `version-bits.md` - `version_bits.toml` format, precedence, and currently known bit usage in goPool.
7-
- `TESTING.md` - Unit/compat/fuzz/benchmark test workflows and profiling helpers.
8-
- `systemd.service` - Example systemd unit for long-running deployments.
3+
Start with [README.md](../README.md) for quick setup and feature overview, then use these docs for deeper operations:
4+
5+
- `operations.md` - Build/run procedures, config files, runtime flags, listeners/TLS, backups, signals, and operational guidance.
6+
- `json-apis.md` - Public and authenticated `/api/*` endpoint reference (methods, response fields, auth expectations, caching headers).
7+
- `stratum-v1.md` - Stratum v1 method compatibility and behavior notes (supported, compatibility-acknowledged, and not implemented).
8+
- `version-bits.md` - `version_bits.toml` format, precedence, and known bit usage in goPool.
9+
- `TESTING.md` - Unit/compat/fuzz/benchmark workflows, profiling commands, and coverage commands.
10+
- `systemd.service` - Example service unit for long-running deployments.

documentation/operations.md

Lines changed: 17 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ go build -ldflags="-X main.buildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ) -X main.buil
4242

4343
Both values appear on the status page and JSON endpoints so you can verify the exact build at runtime.
4444

45-
## Initial configuration
45+
## Starting the pool
4646

47-
1. Run `./goPool`; it generates `data/config/examples/` and exits.
48-
2. Copy the base example to `data/config/config.toml` and edit required values (especially `node.payout_address`, `node.rpc_url`, and ZMQ addresses: `node.zmq_hashblock_addr`/`node.zmq_rawblock_addr`—leave blank to fall back to RPC/longpoll).
49-
3. Optional: copy `data/config/examples/secrets.toml.example`, `data/config/examples/services.toml.example`, `data/config/examples/policy.toml.example`, `data/config/examples/tuning.toml.example`, and `data/config/examples/version_bits.toml.example` to `data/config/` for sensitive credentials or advanced tuning.
50-
4. Re-run `./goPool`; it may regenerate `pool_entropy` and normalized listener ports if you later invoke `./goPool -rewrite-config`.
47+
1. Run `./goPool` once; it generates `data/config/examples/` and exits.
48+
2. Copy `data/config/examples/config.toml.example` to `data/config/config.toml`.
49+
3. Set required values in `config.toml` (especially `node.payout_address`, `node.rpc_url`, and optional `node.zmq_hashblock_addr`/`node.zmq_rawblock_addr`).
50+
4. Optional: copy split files from `data/config/examples/` into `data/config/` (`secrets.toml`, `services.toml`, `policy.toml`, `tuning.toml`, `version_bits.toml`) when you need overrides.
51+
5. Start goPool again with `./goPool`.
5152

52-
## Runtime overrides
53+
## Runtime flags
5354

5455
| Flag | Description |
5556
|------|-------------|
@@ -62,8 +63,17 @@ Both values appear on the status page and JSON endpoints so you can verify the e
6263
| `-rpc-url <url>` | Override `node.rpc_url` for this run—useful for temporary test nodes. |
6364
| `-rpc-cookie <path>` | Override `node.rpc_cookie_path` when testing alternate cookie locations. |
6465
| `-data-dir <path>` | Override the data directory (logs/state/config/examples) for this run. |
66+
| `-log-dir <path>` | Override directory for pool/debug/net-debug logs only. |
67+
| `-pool-log <path>` | Override pool log file path. |
68+
| `-debug-log <path>` | Override debug log file path. |
69+
| `-net-debug-log <path>` | Override net-debug log file path. |
6570
| `-max-conns <n>` | Override max concurrent miner connections (`-1` keeps configured value). |
6671
| `-safe-mode <true|false>` | Force conservative compatibility/safety settings (can disable fast-path tuning and automatic bans). |
72+
| `-ckpool-emulate <true|false>` | Override CKPool-style Stratum subscribe response shape. |
73+
| `-stratum-fast-decode <true|false>` | Override fast-path Stratum decode/sniffing behavior. |
74+
| `-stratum-fast-encode <true|false>` | Override fast-path Stratum response encoding behavior. |
75+
| `-stratum-tcp-read-buffer <bytes>` | Override Stratum TCP read buffer bytes (`0` uses OS default). |
76+
| `-stratum-tcp-write-buffer <bytes>` | Override Stratum TCP write buffer bytes (`0` uses OS default). |
6777
| `-secrets <path>` | Point to an alternate `secrets.toml`; the file is not rewritten. |
6878
| `-rewrite-config` | Persist derived values like `pool_entropy` back into `config.toml`. |
6979
| `-stdout` | Mirror every structured log entry to stdout (nice when running under systemd/journal). |
@@ -74,50 +84,11 @@ Both values appear on the status page and JSON endpoints so you can verify the e
7484
| `-allow-public-rpc` | Allow connecting to an unauthenticated RPC endpoint (testing only). |
7585
| `-allow-rpc-creds` | Force username/password auth from `secrets.toml`; logs a warning and is deprecated. |
7686
| `-backup-on-boot` | Run one forced database backup pass at startup (best-effort). |
87+
| `-miner-profile-json <path>` | Write aggregated miner profile JSON to a file for offline tuning. |
7788
| `-saved-workers-local-noauth` | Allow saved-worker pages without Clerk auth (local single-user mode). |
7889

7990
Flags only override values for the running instance; nothing is written back to `config.toml` (except `node.rpc_cookie_path` when auto-detected). Use configuration files for durable behavior.
8091

81-
## Launching goPool
82-
83-
### Initial run
84-
85-
1. Run `./goPool` once without a config. The daemon stops after generating `data/config/examples/`.
86-
2. Copy `data/config/examples/config.toml.example` to `data/config/config.toml`.
87-
3. Provide the required values (payout address, RPC/ZMQ endpoints, any branding overrides) and restart the pool.
88-
4. Optional: copy `data/config/examples/secrets.toml.example`, `data/config/examples/services.toml.example`, `data/config/examples/policy.toml.example`, `data/config/examples/tuning.toml.example`, and `data/config/examples/version_bits.toml.example` to `data/config/` and edit as needed.
89-
5. If you prefer reproducible derived settings, rerun `./goPool -rewrite-config` once after editing. This writes derived fields such as `pool_entropy` and normalized listener ports back to `config.toml`.
90-
91-
### Common runtime flags
92-
93-
| Flag | Description |
94-
|------|-------------|
95-
| `-network <mainnet|testnet|signet|regtest>` | Force network defaults for RPC/ZMQ ports and version mask adjustments. Only one mode is accepted. |
96-
| `-bind <ip>` | Override the bind IP for all listeners (Stratum, status UI). Ports remain as configured. |
97-
| `-listen <addr>` | Override Stratum TCP listen address for this run. |
98-
| `-status <addr>` | Override status HTTP listen address for this run. |
99-
| `-status-tls <addr>` | Override status HTTPS listen address for this run. |
100-
| `-stratum-tls <addr>` | Override Stratum TLS listen address for this run. |
101-
| `-rpc-url <url>` | Override the RPC URL defined in `config.toml`. |
102-
| `-rpc-cookie <path>` | Override the RPC cookie path; useful for temporary deployments while keeping `config.toml` untouched. |
103-
| `-data-dir <path>` | Override the data directory used for config/state/logs for this run. |
104-
| `-max-conns <n>` | Override maximum concurrent miner connections (`-1` keeps config value). |
105-
| `-secrets <path>` | Use an alternative `secrets.toml` location (defaults to `data/config/secrets.toml`). |
106-
| `-stdout` | Mirror structured logs to stdout in addition to the rolling files. |
107-
| `-profile` | Write a CPU profile to `default.pgo` for offline `pprof` analysis. |
108-
| `-rewrite-config` | Rewrite `config.toml` after applying runtime overrides (reorders sections and fills derived values). |
109-
| `-flood` | Force `min_difficulty`/`max_difficulty` to the same low value for stress testing. |
110-
| `-safe-mode <true|false>` | Toggle conservative compatibility/safety mode for this run. |
111-
| `-debug` / `-net-debug` | Force debug logging and raw network tracing at startup. |
112-
| `-no-json` | Disable the JSON status endpoints (you still get the HTML status UI). |
113-
| `-allow-public-rpc` | Allow connecting to an unauthenticated RPC endpoint (testing only). |
114-
| `-allow-rpc-creds` | Force RPC auth to come from `secrets.toml` `rpc_user`/`rpc_pass`. Deprecated and insecure; prefer cookie auth. |
115-
| `-backup-on-boot` | Force one startup backup run (best-effort). |
116-
| `-saved-workers-local-noauth` | Disable Clerk auth requirement for saved-worker pages (local single-user mode). |
117-
118-
Additional runtime knobs exist in `config.toml` plus optional `services.toml`/`policy.toml`/`tuning.toml`, but the flags above let you temporarily override them without editing files.
119-
Flags such as `-network`, `-rpc-url`, `-rpc-cookie`, `-allow-public-rpc`, and `-secrets` only affect the current invocation; they override the values from `config.toml` or `secrets.toml` at runtime but are not persisted back to the files.
120-
12192
## Configuration files
12293

12394
### config.toml

0 commit comments

Comments
 (0)