mining: expose chain identity (networkMagic, chainType, bech32Hrp) and template header bounds (medianTimePast, versionBits) #37014

issue mutatrum opened this issue on November 29, 2026
  1. mutatrum commented at 10:28 PM on November 29, 2026: contributor

    Tracking: #33777

    Motivation

    Currently Mining exposes only isTestChain() -> Bool, which cannot distinguish mainnet, testnet3, testnet4, signet, and regtest. As a result, external IPC mining servers must ask operators to configure network magic bytes and Bech32 HRPs manually, risking misconfiguration across networks.

    Similarly, BlockTemplate exposes the initial getBlockHeader(), but does not expose the consensus medianTimePast (MTP) or the node's allowed version-rolling mask / active BIP 9 deployment bits. Mining servers therefore have to approximate ntime lower bounds (ntime >= header.nTime instead of ntime > MTP) and hardcode BIP 323 version-rolling masks (0x1fffffe0).

    Proposal

    1. Add a chain-metadata getter on Mining (e.g. getChainParams()):
      • chainType :Text (e.g. "main", "test", "testnet4", "signet", "regtest")
      • networkMagic :UInt32 (4-byte P2P message start)
      • bech32Hrp :Text (e.g. "bc", "tb", "bcrt")
    2. Expose header validation bounds on BlockTemplate (either as fields on a HeaderBounds / TemplateRules struct or getters):
      • medianTimePast :UInt32 (exact consensus lower bound for nTime)
      • versionRollingMask :UInt32 (or active deployment bitmask so clients know which nVersion bits are safe to roll)

    Both additions are non-breaking and remove duplicated per-network configuration across IPC mining clients.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-11-30 04:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me