An accountless mining pool that represents mining shares as ecash tokens. https://hashpool.dev
  • Rust 94.7%
  • Shell 2.3%
  • HTML 1.9%
  • Nix 0.8%
  • Just 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
vnprc 3547740516 mint: refuse the generator point as pool_pubkey; prod ships no key
config/prod/mint.config.toml shipped pool_pubkey set to G, a structurally
valid compressed pubkey that namespaces every epoch under a well-known
constant instead of a real pool identity.

Both halves, for the two ways this goes wrong:
- naming::validate_pool_pubkey now rejects G by value, so a copied dev
  value is caught even if it is otherwise well-formed.
- the prod config ships pool_pubkey commented out with a TODO(operator),
  so an unedited prod file fails on the pre-existing "pool_pubkey is
  required" error instead of ever reaching the generator-point check.

The dev config needed a replacement key that isn't G: pubkey of
sha256("hashpool dev pool identity"), pinned by a naming.rs test that
derives it independently and compares against the committed config.
Updated every test constant that used G as a pool pubkey to the new dev
key. receive_address is untouched — it is an address, not an identity,
and stays derived from G per its own existing test.

pool_pubkey (and every other [hashpool_mint] setting) is now validated
before setup_mint opens the database, wrapped with the config file path
it loaded, so a refused start never leaves a freshly created mint.sqlite
behind.

Refs vnprc/hashpool#35.
2026-10-21 23:43:01 +01:00
.cargo cdk: move the dependency to the forge and pin it at 874a1bf3 2026-10-09 05:12:37 +00:00
benches chore: v0.2 Phase 1 code cleanup 2026-03-09 11:38:50 -04:00
common Update stratum apps and core 2026-05-18 22:58:30 +00:00
config mint: refuse the generator point as pool_pubkey; prod ships no key 2026-10-21 23:43:01 +01:00
docs mint: automatic reward trigger with the epoch store in the mint database 2026-10-11 02:09:15 +00:00
examples remove examples/interop-cpp* 2025-08-16 16:34:47 +02:00
protocols cdk: move the dependency to the forge and pin it at 874a1bf3 2026-10-09 05:12:37 +00:00
roles mint: refuse the generator point as pool_pubkey; prod ships no key 2026-10-21 23:43:01 +01:00
scripts scripts: regtest scenario runner for the reward trigger 2026-10-11 02:12:09 +00:00
test/integration-tests Bump SRI protocol crates to 1.9.0 2026-05-18 18:31:12 +00:00
utils feat: wire GlobalInfo.network through pool and translator 2026-03-23 21:46:11 -04:00
.gitignore feat: wire GlobalInfo.network through pool and translator 2026-03-23 21:46:11 -04:00
bitcoin-node.nix Revert "Source bitcoin-node from the bitcoind-gunix flake" 2026-08-08 02:06:58 +00:00
bitcoind.nix Revert "Source bitcoin-node from the bitcoind-gunix flake" 2026-08-08 02:06:58 +00:00
CHANGELOG.md docs: relabel v0.2 notes as v0.1.1 2026-03-11 15:51:12 -04:00
codecov.yaml disable github checks annotation 2025-01-27 18:40:07 +00:00
CONTRIBUTING.md remove github hooks 2025-04-22 19:29:28 +05:30
devenv.lock Restore devenv shell entry under the devenv 2.1.2 CLI 2026-10-07 01:54:06 +00:00
devenv.nix cdk: move the dependency to the forge and pin it at 874a1bf3 2026-10-09 05:12:37 +00:00
devenv.yaml Restore devenv shell entry under the devenv 2.1.2 CLI 2026-10-07 01:54:06 +00:00
flake.lock Revert "Source bitcoin-node from the bitcoind-gunix flake" 2026-08-08 02:06:58 +00:00
flake.nix Revert "Source bitcoin-node from the bitcoind-gunix flake" 2026-08-08 02:06:58 +00:00
justfile mint: enforce loopback-only epoch admin bind and add the rotate-epoch recipe 2026-10-21 23:43:01 +01:00
LICENSE-APACHE Add license 2022-08-23 17:18:34 +00:00
LICENSE-MIT Add license 2022-08-23 17:18:34 +00:00
LICENSE.md Add license 2022-08-23 17:18:34 +00:00
README.md Revert "Source bitcoin-node from the bitcoind-gunix flake" 2026-08-08 02:06:58 +00:00
RELEASE.md update release process 2024-10-15 16:52:59 -03:00
rustfmt.toml update rustfmt.toml 2024-11-13 17:40:33 +05:30
SRI_README.md link to the original readme in the same repo 2025-10-28 18:23:38 -04:00
sv2-tp.nix upgrade runtime template provider: sv2-tp 1.0.6 -> 1.1.1 + Bitcoin Core 30.2 -> 31.1 2026-07-17 17:06:18 +00:00

Hashpool

This project is a fork of the Stratum V2 Reference Implementation (SRI) that replaces traditional share accounting with an ecash mint. Instead of internally accounting for each miner's proof of work shares, hashpool issues an "ehash" token for each share accepted by the pool. For a limited time after issuance, ehash tokens accrue value in bitcoin as the pool finds blocks. Miners can choose to accept the 'luck risk' of finding blocks and hold these tokens to maturity or sell them early for a guaranteed payout.

You can find the original SRI README here.

Getting Started

To run Hashpool, first clone the repository and follow the instructions to install nix and devenv.

Once set up, cd into the hashpool directory and run:

devenv shell
devenv up
Screenshot from 2025-10-11 08-37-22

Development Environment Setup

The development environment initializes a containerized system with the following components:

Components Overview

  1. pool - SV2 Mining Pool

    • coordinates mining tasks and distributes workloads to miners
    • issues an ecash token for each share accepted
    • manages an internal cashu mint
      • receives a blinded message for each mining share
      • signs it and returns a blinded signature to the proxy/wallet
  2. proxy - SV2 Translator Proxy

    • talks stratum v1 to downstream miners and stratum v2 to the upstream pool
    • manages the cashu wallet
      • bundles a blinded message with each share sent upstream to the pool
      • receives the blinded signature for each blinded message
      • stores each unblinded message with it's unblinded signature (this is an ecash token)
  3. jd-client - SV2 Job Declarator Client

    • talks to bitcoind miner side
    • retrieves block templates
    • negotiates work with upstream pool
  4. jd-server - SV2 Job Declarator Server

    • talks to bitcoind pool side
    • negotiates work with downstream proxy
  5. bitcoin-node - Bitcoin Core 31.1 (multiprocess)

    • official Bitcoin Core node binary with IPC support
    • serves block data to sv2-tp via unix socket
  6. sv2-tp - SV2 Template Provider (v1.1.1)

    • connects to bitcoin-node via IPC socket
    • serves Stratum V2 block templates to the pool and jd-client
  7. miner - CPU Miner

    • find shares to submit upstream to the proxy
  8. mint - CDK Cashu Mint

    • generate ehash and ecash tokens
    • redeem ehash and ecash tokens
  9. web-pool - Web Dashboard (Pool Side)

    • web interface for pool statistics and monitoring
    • displays pool hashrate, services, and connected proxies
    • deployed at pool.hashpool.dev
  10. web-proxy - Web Dashboard (Proxy Side)

    • web interface for proxy statistics and monitoring
    • wallet page displays ehash balance and an ehash faucet
    • miners page displays miner connection info and connected miners
    • pool page displays upstream pool and blockchain stats
    • deployed at proxy.hashpool.dev
  11. prometheus / victoria-metrics - Metrics Stores (Two per Deployment)

    • one metrics store for the pool, one for the translator
    • each scrapes /metrics from its service
    • provides the HTTP API that the corresponding web dashboard queries

Production Deployment

For deploying Hashpool on Debian 12, see the Deployment Guide.


What's New in v0.1.1

  • SRI 1.7.0 migration complete: all protocols and utilities now import from crates.io (roles_logic_sv2 deprecated), vendored crates limited to hashpool-specific modifications
  • New Template Provider: Bitcoin Core 30.2 (bitcoin-node) + sv2-tp v1.0.6 replaces the Sjors SV2 fork; connects via unix IPC socket
  • Ehash mint flow redesign: end-to-end minting and share accounting were reworked across pool, translator, and mint services
  • New roles: web services for pool/proxy monitoring and wallet UX
  • Testnet staging: dedicated testnet deployment configs and workflow
  • Fixed: share difficulty formula in the SV1 translator now uses the SV2 formula (2^256 / target) matching miner expectations
  • Fixed: CoinbaseOutputConstraints 6-byte encoding (SRI 1.7.0 pool↔TP protocol)
  • Added: Debian 12 deployment workflow (build-in-place + ship-only)

Troubleshooting

TUI detaches but processes keep running

If you try to copy text from the devenv shell while devenv up is running, process-compose can crash and detach the TUI, leaving all background processes running as orphans.

1. Find and kill the orphaned processes:

pgrep -a -f "pool_sv2|translator_sv2|mint|jd_server|jd_client|web_pool|web_proxy|sv2-tp|bitcoin-node|prometheus"

Kill the listed PIDs:

kill <pids...>

2. Verify everything is dead:

pgrep -f "pool_sv2|translator_sv2|mint|jd_server|jd_client|web_pool|web_proxy|sv2-tp|bitcoin-node|prometheus" && echo "still running" || echo "all clear"

3. Remove the stale socket and restart:

rm .devenv/run/pc.sock
devenv up

Contribution

This project is very early. PRs and bug reports are very welcome!