Commit Graph
48 Commits
Author SHA1 Message Date
illuzenandCursor 2c8d530de4 Send miner auth token in Ready handshake. (#78)
* Send miner auth token in Ready handshake.

Require --auth-token or --auth-token-file when connecting to a node so the
miner matches the node's shared-secret QUIC auth.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Pin the node's miner TLS certificate by SHA-256 fingerprint.

Require --tls-cert-sha256 or --tls-cert-sha256-file so miners reject
MITM certs instead of accepting any self-signed server certificate.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fmt

* Docs: prefer reading miner auth token from file, not node logs.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Version the miner ALPN as quantus-miner/2 to match the node.

A node/miner protocol mismatch now fails cleanly at the TLS handshake with
"no application protocol" instead of an opaque auth error.

Co-authored-by: Cursor <cursoragent@cursor.com>

* point at git

* Depend on published quantus-miner-api 0.3.0 from crates.io.

The temporary git branch pin is no longer needed now that 0.3.0 is published.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fail closed on permanent auth/TLS misconfig instead of reconnect looping.

Validate the fingerprint and Ready frame size at miner/pool startup before
metrics, workers, or HTTP come up. Treat node auth rejection and pin mismatch
as PermanentConnectError (no retry), and only reset reconnect backoff after
the first NewJob proves auth succeeded.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Point miner auth docs and examples at miner-auth-token / TLS pin files.

The node never logs the auth token; CLI/pool help and every serve/Docker
example now require the chain config files (or env vars) instead of implying
credentials can be copied from logs.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fmt

* Remove the miner Dockerfile and Docker packaging docs/CI.

Container GPU access is a poor fit for this miner, and the Docker examples
were unusable with SocketAddr (hostnames rejected). Run the native binary
instead.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Shut down the pool on permanent upstream auth failure; keep reconnecting otherwise.

Supervise run_node_client alongside HTTP so a bad token/pin ends the process
instead of leaving a live API on a dead upstream. Node restarts still reconnect
with backoff; the current job is cleared while disconnected so captchas are not
issued against a stale header.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Replace obsolete EXTERNAL_MINER_PROTOCOL.md with a pointer to MINING.md.

The local copy still described the pre-auth protocol (no Ready token, no pin,
old ALPN, 16 MB frames). Canonical docs live in quantus-miner-api and the
node's MINING.md.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Delete EXTERNAL_MINER_PROTOCOL.md; README already points at MINING.md.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-13 09:50:03 +08:00
Nikolaus Heger 7e449c0a5f Benchmark: honor --gpu-batch-size/--cpu-batch-size and advance nonce ranges
The benchmark fed each worker a fixed range (10k CPU / 1M GPU nonces),
capping GPU dispatches at 1M regardless of --gpu-batch-size, and
re-searched the same range on every iteration. Worker ranges now step
through the nonce space and are sized from the batch flags, floored at
the old widths so tiny flags keep engine-internal cancellation batching
instead of turning per-call harness overhead into the measured quantity.
Batch-size flags are validated non-zero at parse time (serve and
benchmark) and echoed in the benchmark banner.
2026-08-12 12:04:44 +08:00
illuzen a47db3d1a2 Fix windows again (#72)
* handle lost device correctly

* Update lib.rs

* allow-integrated flag otherwise exclude

* DeviceLost is a status

* Integrated GPU skipped when discrete init fails

* nits
2026-06-30 16:30:11 +08:00
illuzen 7296c003bb Improve Windows gpu support (#70)
* support AMD GPUs on windows

* add support for more GPUs

* remove shader dump from logs

* handle gpu initialization failure better

* fmt

* re-order matching to avoid mobile / desktop false positives

* harden gpu matching

* add tests to engine-gpu module

* handle dead device and failed mapping correctly

* handle timeout properly with tokio

* nits

* fix benchmarks

* fmt
2026-06-30 12:55:35 +08:00
illuzen 157aa6fb5c Address v12 issues (#65)
* don't accept zero difficulty jobs

* bound job queue

* synchronous emit_payload

* cleaner gpu_batch_size type

* remove build script

* distance_threshold -> difficulty

* enable pq-cert checking with miner

* clearer logs

* Revert "enable pq-cert checking with miner"

This reverts commit 7a7f5394352b60d8c946f547f77a057504b29c44.

* update versions of relevant deps, including rand
2026-06-12 10:48:01 +08:00
illuzen 5ce62b3e12 add gpu-throttle arg (#64)
* add gpu-throttle arg

* smarter sleep logic

* document cli args
2026-05-22 23:31:54 +08:00
illuzen d7bf27854f GPU fixes (#58)
* improve logging

* don't let the queue spill, just drain it

* move cancellation out of the shader, since it doesn't work

* simplify batch size mechanism, improve logs

* fmt

* address review items
2026-04-22 13:42:01 +08:00
Nikolaus Heger 9ffb5b12e2 default for node addr 2026-04-20 13:08:37 +08:00
illuzen 443f0f9f89 QUIC miner (#49)
* implement quic

* simpler names

* simplify worker logic

* simplify gpu configuration logic

* miner initiates and picks random start nonce

* remove mining service

* clean up logs and remove unused engines

* clean up metrics

* metrics fix

* shared worker pool, cpu driven cancellation

just 10x the gpu thru-put, no more batch-size on gpu

* fmt

* non-local git

* taplo derp

* fix the benches

* handle stale results correctly in gpu

* more accurate gpu hashrate

* fmt

* remove unused

* handle duplicate solutions, cli controls gpu cancel frequency

* put plonky2 back

* demote noisy log
2026-02-02 16:38:21 +08:00
Nikolaus Heger ffc5b8f83c GPU batch size automatically adjusts to target duration 2026-01-05 15:53:14 +08:00
Nikolaus Heger 3b5f759fbd refactored and unified gpu devices number logic
use all GPUs by default, handle the parameter, disallow more GPU devices than available
2025-12-27 11:40:03 +08:00
Nikolaus Heger b79a9368e0 fmt 2025-12-26 13:45:18 +08:00
Nikolaus Heger f0aa971326 remove gpu feature, rename to gpu-devices
rename gpu-workers flag to devices, also check user doesn't specify more than they have (degrades performance)
2025-12-26 13:44:59 +08:00
Nikolaus Heger 23c617bda9 remove some AI dust 2025-12-26 13:10:46 +08:00
Nikolaus Heger a548f74f7d fmt 2025-12-26 12:47:42 +08:00
Nikolaus Heger 97ec1350de Fix for #39
Fix GPU worker crash, enable GPU default, and improve benchmark output
2025-12-26 12:46:57 +08:00
Nikolaus Heger ac87758996 Fix GPU contention, benchmarking 2025-12-26 10:53:00 +08:00
illuzenandNikolaus Heger a97d79632e Hybrid engine (#30)
* hybrid works with one gpu

* handle multiple gpus

* taplo

* fix clippy issues

* refactor to remove unnecessary abstraction layer

* update readme

* fix tests

* clippy

* delete hybrid engine

---------

Co-authored-by: Nikolaus Heger <nheger@gmail.com>
2025-12-22 21:05:31 +08:00
Nikolaus Heger 3ca29b6d8a throw errors when there's no GPUs detected 2025-12-19 16:40:54 +08:00
Nikolaus Heger c276a1173e clean up options 2025-12-19 15:26:43 +08:00
Nikolaus Heger 6ae4658209 add benchmark command
so we can easily compare CPU and GPU without having to run cargo bench.
2025-12-19 15:22:24 +08:00
illuzen 1509e2283b clean up documentation 2025-12-09 23:07:57 +08:00
illuzen ccca629c49 improved logging 2025-12-08 14:55:47 +08:00
illuzen aa1cf2bb46 gpu runs but doesn't mine 2025-12-01 15:11:07 +08:00
illuzen 50958ef4da ok wgpu runs hello world 2025-11-17 16:37:38 +08:00
Nikolaus Heger e92c4f0769 update comment 2025-11-07 14:40:13 +08:00
illuzen 63d7e114c2 Support new pow algo on cpu, not gpu (#22)
* support new pow algo, remove montgomery

* format

* remove redundant check

* use local poseidon until we release

* back to release

* remove unnecessary fxn

* comment out cuda for now

* comment out open-cl

* fix more tests

* remove cuda jobs
2025-11-03 16:23:18 +08:00
Cezary Olborskiandczareko abc3fcfcd3 chore: RM - refreshed (#15)
* chore: Proper version distribution

* chore: version based on tags

---------

Co-authored-by: czareko <czareko@users.noreply.github.com>
2025-09-23 17:22:49 +08:00
Cezary Olborski c820e0bd84 chore: Lock update + logs warn fix (#9) 2025-09-23 12:48:51 +08:00
rob thijssen 1103eb3efe Add miner-telemetry crate and integrate telemetry support
- Introduce miner-telemetry crate for WebSocket-based telemetry
reporting - Add telemetry configuration options to miner-cli CLI - Pass
telemetry CLI args as environment variables for miner-service - Enable
miner-service to bootstrap telemetry from env vars and emit events -
Emit periodic system.interval telemetry with mining stats and metadata -
Add miner-telemetry as dependency to miner-service and workspace member
2025-09-17 14:26:51 +08:00
rob thijssen 05a51fe5df Simplify short SHA extraction in build script 2025-09-17 00:12:26 +08:00
rob thijssen 058a287dcd Use if let Ok instead of if let Some for GITHUB_SHA check 2025-09-17 00:11:54 +08:00
rob thijssen 8f051f543c Add build.rs to embed version with git SHA in miner-cli binary 2025-09-16 12:24:24 +08:00
rob thijssen fbd63b580f revert all --version semver changes 2025-09-15 09:38:50 +08:00
rob thijssen e899709f72 Revert "Add build script to append git SHA to version info"
This reverts commit 7674e3141f.
2025-09-15 09:29:11 +08:00
rob thijssen 7674e3141f Add build script to append git SHA to version info 2025-09-15 09:14:40 +08:00
rob thijssen 5867ddefe9 append short git sha to the semantic version returned by the cli when
invoked with `--version`
2025-09-15 09:01:27 +08:00
rob thijssen 222890dc92 cuda scaffold
- Add engine-gpu-cuda crate with basic CUDA kernel (qpow G1) - Implement
CUDA build.rs compiling .cu to PTX when "cuda" feature enabled -
Integrate GPU engine into miner-service with runtime CUDA availability
check - Add fallback to CPU engine in gpu-cuda until full GPU kernel
support is ready - Enable optional "cuda" feature in miner-cli and
miner-service crates
2025-09-11 18:51:52 +08:00
rob thijssen 68c5835fc6 clippy cleanup 2025-09-11 09:19:07 +03:00
rob thijssen 7ec802ee24 feat: montgomery-optimized cpu mining engine
- introduce new `engine-montgomery` crate implementing a 512-bit
fixed-width montgomery multiplication backend for qpow mining. - mirror
`cpu-fast` engine behavior and metrics for direct comparison. - add
runtime backend selection with portable and x86_64 bmi2/adx kernels. -
expose `--engine cpu-montgomery` cli option in miner-cli. - integrate
engine and metrics support in miner-service with feature gating. - add
engine backend info metric for observability and a/b testing.
2025-09-10 22:52:04 +08:00
rob thijssen 7cbeb43b39 pr-cleanup 2025-09-10 11:08:39 +08:00
rob thijssen 49efb4ebc5 07: stable toolchain, rust validations
- Switch toolchain to stable with clippy and rustfmt components - Clean
up Clippy warnings with inline format args and hygiene fixes - Add GPU
engine placeholders (gpu-cuda, gpu-opencl) in CLI and service - Return
clear runtime error and exit for unimplemented GPU engines - Format all
TOML files with Taplo and ensure taplo fmt --check passes - Improve
mining nonce partitioning for safe range splits - Update tests to pass
cleanly on stable without warnings
2025-09-09 21:39:01 +08:00
rob thijssen 242bbe71f6 06: manipulator and difficulty
- Introduce ChainManipulatorEngine using fast incremental hashing path -
Throttle mining speed per solved block using sleeps after nonce batches
- Add CLI/env options to control base delay, batch size, throttle cap,
and resume state - Wire engine selection and parameters through
miner-service and miner-cli - Add debug logs for throttle state at job
start and on block found - Add new Grafana panel showing robust
difficulty median per chain for visibility
2025-09-09 19:41:38 +08:00
rob thijssen d0382f875a 05: workers and dashboard sync
- Replace `--cores`/`--num-cores` with `--workers` to clarify intent
(logical CPU threads) - Detect cpuset-aware default for workers, leaving
~50% headroom on shared hosts - Clamp user-specified workers to
effective cpuset size - Update logs, configs, and APIs accordingly
2025-09-09 12:18:04 +08:00
rob thijssen b69832bb4a 04: metrics chunking and dashboards
Improve mining metrics with chunked progress updates and dashboards

- Emit periodic per-thread progress updates by chunking search ranges,
enabling fresher and more accurate job/global hash rates. - Smooth
per-thread hash rates with EMA; derive per-job and global rates from
thread aggregates. - Remove job/thread rate series on
completion/cancellation to avoid scrape-timing zero artifacts. - Add
service-level metrics: `miner_active_jobs` gauge and
`miner_mine_requests_total` counter with result labels. - Introduce
CLI/env knob `--progress-chunk-ms` to control progress update frequency
(default 2000ms). - Update Grafana dashboards for trend-friendly
queries, cleaned labels, 24h/1h peak views, and job-level filtering. -
Add detailed documentation summarizing metrics improvements, usage, and
operational guidance.
2025-09-08 17:01:43 +08:00
rob thijssen ea40fdf6e5 03: engine comparability 2025-09-07 21:34:44 +08:00
rob thijssen 6cd53557d7 02: cpu fast engine and metrics 2025-09-07 20:48:01 +08:00
rob thijssen 0d5adf583b 01: soc and metrics
Convert repository into Cargo workspace with modular crates

- Split code into workspace members: miner-cli, miner-service, pow-core,
engine-cpu, engine-gpu-cuda, engine-gpu-opencl, metrics - Moved QPoW
math logic into local pow-core crate with compatibility API and
incremental helpers - Defined MinerEngine trait and baseline CPU engine
in engine-cpu crate - Rewrote service layer in miner-service: job
management, HTTP API, engine orchestration - Added CLI binary crate
miner-cli with flags: --port, --num-cores, --metrics-port, --engine -
Implemented runtime toggle for Prometheus metrics exporter enabled only
when --metrics-port provided - Deprecated root src/lib.rs and
src/main.rs with notices pointing to new CLI/workspace entrypoints
2025-09-07 20:21:10 +08:00