Skip to content

Implement Detective Mining (Pool Software Change, No Protocol Change Required) #140

@fluffypony

Description

@fluffypony

We should encourage pools to adopt the "detective mining" strategy from Lee and Kim, which leverages information pools already leak in their job messages to collapse a selfish miner's private lead. Crucially, this is deployable at the pool or Stratum-proxy level with no consensus or protocol changes.

Paper: https://eprint.iacr.org/2019/486

Thanks to @AJ__1337 on X for highlighting the paper.

One-paragraph explainer

Selfish pools must distribute jobs that tell their workers which parent to mine on (eg. Qubic uses pool.qubic.li). Those jobs reveal the pool's private tip via the previous block hash. A detective miner subscribes to those jobs, detects when the leaked prevhash does not match the public tip, and immediately mines a "counter" child block on top of the selfish pool's hidden parent. Publishing that child forces the selfish pool to reveal its private block or lose it, repeatedly cutting off the attacker's lead and eroding their advantage. The original paper models and simulates this dynamic and shows the attacker's extra revenue disappears as detective adoption grows.

Practically, if ~50% of the Monero hashrate (the largest pools) implement this, then the selfish miner’s break-even jumps to roughly 42 percent if tie-breaking favours the honest chain, ~37 percent under neutral tie-breaking, and ~32 percent if tie-breaking favours the attacker (see Figure 11 in the paper). Comparatively, the baseline without detective miners is the classical Eyal–Sirer threshold that can be near 25 percent when tie-breaking favours the attacker, rising toward one third otherwise. If we are between 50% and 100% hashrate adoption across pools then it wipes out the ability to selfish-mine entirely across the tested splits (see Figures 14 and 15).

Why this is pool-side: Stratum job messages include a prevhash or equivalent parent reference that pools must share with miners. In Stratum v1 job payloads this field is explicit, and in Stratum v2 there is a dedicated SetNewPrevHash message. That is the hook detective mining exploits.

Actionable plan for pools and stratum proxies

Scope. All work is at the pool or proxy layer. No protocol or consensus changes are needed.

1) Instrumentation and detection

  • Add a lightweight "sensor" client that subscribes to competing pools' job streams. Capture the current prevhash and job IDs.
  • Continuously compare the observed prevhash with your node's public tip. If it diverges for more than T seconds, flag a likely private branch.

2) Counter-template construction

  • When a leak is detected, construct a valid block template whose parent equals the leaked prevhash. Keep the template minimal if needed. For Bitcoin-style stacks this means a legal header, coinbase, and a conservative transaction set.

3) Hash allocation and switching

  • Immediately redirect a configurable fraction of your pool's hashrate to the counter-template, even if that means the entire pool's hashrate uses this new template. Revert to public-tip templates when the competitor's jobs return to the public parent.

4) Submission and networking

  • On a find, broadcast your child block immediately. The selfish pool must then publish its private parent to avoid losing it, collapsing its lead.

Why this helps

  • Mechanism. Detective mining repeatedly cuts the attacker's private lead by forcing reveals whenever the attacker tries to extend a hidden branch.
  • Practicality. It exploits fields pools already expose in job messages, and it works today with Stratum, which means it works with Monero.
  • Economics. The paper's simulations show the attacker's excess revenue shrinks quickly as the detective share grows, and multiple selfish pools cannibalise one another even more once detective miners are active.

Pool Software Anti-Decoy Counter-Measures

Pool software should include some sneakiness to prevent their sensor probes from being detected. Here's a checklist:

Detection and corroboration

  • Require quorum: do not act unless the same off-tip prevhash is observed by multiple independent sensors on different IP ranges and regions.
  • Verify persistence: the off-tip parent must persist across multiple mining.notify messages or SV2 SetNewPrevHash updates for T seconds before diverting any hash.
  • Share-acceptance check: each sensor submits a few shares on the leaked job and proceeds only if the pool accepts them, proving the job is live and not a read-only decoy.
  • P2P sanity check: confirm the leaked parent is not yet known to your full node or the public tip.

Sensor hygiene

  • Make sensors hard to fingerprint: rotate IPs and providers, vary user agents, and keep normal share cadence and difficulties so targeted fake jobs are harder to aim at. Stratum sessions are per-connection with per-connection state (extranonce1), so blend in.
  • Use multiple ingress points: subscribe to several pool endpoints when available and compare job streams in real time.

Activation policy

  • Two-stage diversion: on a valid signal, divert a tiny fraction H of hash first, auto-ramp only if corroboration continues during a grace window. Roll back automatically if any check fails. The detective-mining literature supports that even modest detective share reduces attacker advantage.
  • Rate-limit triggers: bound how often you will divert within a rolling window and cap the maximum detective-hash allocation to limit worst-case decoy cost.
  • Cross-sensor consistency: abort if the pool delivers inconsistent prevhashes across your own sensors in close time proximity, which is a strong indicator you are being singled out. Stratum allows different jobs per connection, so inconsistency is meaningful.

Telemetry and audits

  • Log every incident: prevhash, job IDs, times seen, which sensors corroborated, share-acceptance results, diversion start/stop, and outcomes.
  • Track false positives and orphan rate during trials, then tighten thresholds based on empirical results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions