Hashly / research · NOTE 03
Stratum and payout failure modes: a public checklist for pool operators.
Share validation, vardiff races, stale templates, block submission, PPLNS and PROP accounting, double payouts and exposed wallet RPC: what to check in a pool stack, from public specs and research.
Where pool stacks fail
A mining pool is three systems glued together: a Stratum server that hands out work and validates shares, a node that provides templates and accepts blocks, and an accounting and payout service that turns shares into coins. Each is usually open-source software adapted to a specific chain, and most serious failures sit at the joins: a share accepted that should not be, a block found and not submitted, a reward credited before it is final, a payout sent twice.
This checklist is drawn from public protocol specifications and published research. It names no pool and no software as vulnerable; it lists what to verify in yours.
Share validation
In Stratum V1 the pool sends a job (previous hash, coinbase parts, Merkle branch, version, bits, time) and the miner returns a job id, its extranonce, a time and a nonce. The pool must rebuild the header and hash it itself. Every shortcut in that path is a way to get paid for work that was not done.
job_id known, and not superseded by a clean_jobs notification
extranonce2 exact length, under this connection's extranonce1
ntime within the template's allowed range (mintime .. now + limit)
version only bits allowed by the negotiated version-rolling mask (BIP 310)
duplicate (job, extranonce1, extranonce2, ntime, nonce, version) not seen before
hash recomputed by the server; hash <= share target (256-bit compare)
block? hash <= network target -> submit the block first, credit secondTwo details matter more than they look. Comparisons should be done on 256-bit integers, not on difficulty converted to floating point, where rounding near the boundary can accept shares just above the target or miss a block just below it. And the duplicate key must include every field the miner controls, including rolled version bits; otherwise the same work can be submitted again under a different encoding.
Vardiff and its races
Variable difficulty keeps each miner at a target share rate. The common bug is a race: the pool raises a connection’s difficulty, but shares for jobs issued before the change are still in flight. Crediting them at the new difficulty overpays; rejecting them punishes honest latency. The consistent rule is to bind difficulty to the job, and apply a new difficulty from the next job onward.
Bounds matter too. A miner that asks for a very low difficulty multiplies the shares the pool must hash and store; suggested difficulty needs a floor per port, and share rate per connection needs a limit.
Templates and block submission
Templates come from the node through getblocktemplate (BIP 22) or a chain-specific equivalent. When a new block arrives, every job built on the old tip becomes worthless; the pool must learn about it in seconds, through block notifications or long polling, and push new jobs with clean_jobs set. Slow template refresh shows up as a stale-share rate that miners notice before the operator does.
When a share meets the network target, submitting the block is the most time-critical action in the stack. It should happen before database writes, its result should be checked rather than assumed, and a failure should be retried through another node and raise an alert. A block that the node rejects because the pool assembled the coinbase or the Merkle branch differently from the job it sent is a full block reward lost.
Accounting and payouts
- Maturity and reorgs. A coinbase cannot be spent until it matures (100 blocks in Bitcoin; check your chain’s value). Credits should stay pending until then, and an orphaned block must reverse the credits it created.
- Reward scheme. Rosenfeld’s 2011 analysis shows why proportional (PROP) rewards are open to pool hopping: shares early in a round are worth more, so miners who leave mid-round take value from those who stay. PPLNS removes that incentive only if the window is counted in difficulty-weighted shares and cannot be reset.
- Rounding. Splitting a reward across thousands of miners leaves remainders. Use integer base units, reconcile every batch to the block reward minus the pool fee, and decide who gets the remainder.
- Double payouts. A wallet call that times out may still have sent the transaction. Write the payout batch with a unique id first, and resolve an uncertain result by looking up the transaction, never by sending again.
- Addresses. Validate payout addresses for the right chain and network. A fork that kept its parent’s address prefixes accepts addresses that also belong to the parent chain.
- Block withholding. A miner can submit shares and hide the blocks it finds. Eyal’s 2015 analysis shows pools can use this against each other. It cannot be prevented in Stratum V1; per-miner luck over time is the signal to watch.
Wallet, RPC and transport
The payout wallet is the most valuable target in the stack. Bitcoin Core’s RPC documentation is explicit that RPC is not designed to be exposed to untrusted networks and that anyone with RPC credentials can control the node. The node and wallet RPC should listen on localhost or a private network only, and the hot wallet should hold what the next payout batches need, not the pool’s balance.
Stratum V1 runs in clear text. Recabarren and Carbunar showed in 2017 that an attacker on the network path can read and alter it and steal part of a miner’s hashing power. TLS on Stratum ports, or Stratum V2’s encrypted and authenticated channel based on the Noise framework, closes that path.
Pool operator checklist
The server recomputes every sharePOOL-01Consensus / fundsHeader rebuilt from the job, extranonces, time, nonce and allowed version bits; hash compared with the share target and the network target as 256-bit integers, never as floating-point difficulty.
Duplicates, stale jobs and time are rejectedPOOL-02Consensus / fundsOne accepted share per job, extranonce, time, nonce and version; unknown or superseded jobs refused or counted as stale; time held inside the template’s bounds.
Difficulty is bound to the job that was sentPOOL-03Liveness / DoSA share is credited at the difficulty in force when its job was issued; difficulty changes take effect on the next job. Suggested difficulty from the miner is clamped to the pool’s bounds.
A block candidate is submitted before anything elsePOOL-04Consensus / fundsSubmission happens on the share path, the result is checked, and the block is retried through a second node if the first one fails. A rejected block raises an alert.
New tips reach miners in secondsPOOL-05Liveness / DoSBlock notifications rather than slow polling, and new jobs with clean-jobs set on a new previous hash. Stale rate is measured per server.
Credits wait for maturity and survive reorgsPOOL-06Consensus / fundsRewards are paid only after coinbase maturity on your chain; orphaned blocks reverse their credits; the accounting can be rebuilt from shares and blocks.
A payout cannot be sent twicePOOL-07Consensus / fundsPayout batches are written with a unique id before the wallet call; a timeout is resolved by looking the transaction up, not by retrying.
Rounding has an ownerPOOL-08Consensus / fundsAmounts are integers in base units; each batch reconciles to the block reward minus fee, with the remainder assigned by rule and logged.
Wallet RPC is not reachable from outsidePOOL-09Consensus / fundsNode and wallet RPC bound to localhost or a private network, strong credentials, a payout wallet holding only what the next batches need.
Miners can authenticate the poolPOOL-10OperationsTLS on Stratum V1 ports or Stratum V2’s encrypted channel, so a network attacker cannot redirect hashrate or rewrite payout addresses in transit.
Sources
Public documents only, checked on 3 Dec 2026. No client work, private report or undisclosed issue is used or referred to on this page.
- Braiins: Stratum V1 protocol documentation
- Stratum V2 specification, including the Noise-based secure channel
- BIP 22: getblocktemplate, fundamentals
- BIP 310: Stratum protocol extensions (version rolling)
- Bitcoin Core, src/consensus/consensus.h (COINBASE_MATURITY = 100)
- Bitcoin Core, doc/JSON-RPC-interface.md (security section)
- M. Rosenfeld, Analysis of Bitcoin Pooled Mining Reward Systems (2011)
- I. Eyal, The Miner's Dilemma (2015)
- R. Recabarren, B. Carbunar, Hardening Stratum, the Bitcoin Pool Mining Protocol (2017)