Skip to content

feat(translator): record share header hashes in the logs - #952

Open
baveet256 wants to merge 2 commits into
stratum-mining:mainfrom
baveet256:2026-10-15-tproxy-share-hash-audit
Open

baveet256 wants to merge 2 commits into
stratum-mining:mainfrom
baveet256:2026-10-15-tproxy-share-hash-audit

Conversation

@baveet256

@baveet256 baveet256 commented Oct 27, 2026 •

Copy link
Copy Markdown

What the logs were missing

On main, a share that meets the miner's target logs Received mining.submit from SV1 downstream for channel id: …. A share sent upstream logs SubmitSharesExtended: valid share, forwarding it to upstream | channel_id, sequence_number. The translator had already hashed the header to validate the share, then dropped that hash. The log has no worker, no share_hash, and no mark when the hash meets the network nbits. A later pool ack names a sequence number and cannot be tied back to a hash. Nothing is written to a file, and nothing can ask bitcoind whether a candidate is in the best chain.

Summary

  • The translator already hashed each share for validation and then dropped that hash. Accepted and forwarded shares now log share_hash in bitcoind display order. A share that meets the chain-tip nbits is also a BLOCK_CANDIDATE warning. That line means the hash met nbits at validation time. chain_status on it stays unknown.
  • An optional append-only JSONL file records what was forwarded and ties a batched pool ack back to that hash by (upstream_channel_id, sequence_number). In aggregated mode every miner shares one sequence series. In non-aggregated mode the same sequence number on two channels stays two shares. Block candidates also go to block-candidates.jsonl unless that path is set to "".
  • Chain status stays off until share_audit_bitcoin_rpc_url points at a Bitcoin Core RPC endpoint on the same network as the pool. Auth is a cookie file, or a user and password together. The checker calls getblockchaininfo and getblockheader only for block candidates. It waits 120 seconds, then 10, 30, and 60 minutes, and stops at 6 confirmations or 24 hours. in_best_chain means the header is in the node's active chain. orphaned_or_stale means the node knows the header and it is not in that chain. not_found means this node has not seen the hash. A down or still-loading node is a warning and does not write not_found. The translator does not submit the block.

Test plan

  • cargo test -p translator_sv2 --lib
  • Confirm hosted config examples leave share_audit_path and the RPC URL commented out
  • With the RPC URL unset, startup does not log Chain-status RPC enabled
  • With a mainnet pool, point share_audit_bitcoin_rpc_url at a mainnet bitcoind before expecting any chain_status line

baveet256 and others added 2 commits October 27, 2026 14:42
The translator already hashed each share for validation and then dropped that hash. Keep it on the accept and forward lines, write an optional JSONL trail of what was sent upstream, and ask a configured bitcoind whether a block candidate is in the best chain.

Co-authored-by: Cursor <cursoragent@cursor.com>
Operators need the accepted, forwarded, and block-candidate lines, the optional JSONL files, and the fact that chain status talks only to a configured bitcoind.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant