Testnet 5 (BIP95) #35861

pull fjahr wants to merge 25 commits into bitcoin:master from fjahr:2026-07-t5-draft changing 59 files +6743 −129
  1. fjahr commented at 6:44 PM on August 1, 2026: contributor

    Implements BIP 95 (Testnet 5). Relative to Testnet 4 it removes the 20-minute minimum-difficulty exception, raises the minimum difficulty, and enforces BIP 54 from block 1. The Genesis block has not been mined yet.

    Based on #35793, only the top five commits belong to this PR.

    Per the discussion in a recent IRC meeting: since BIP 95 activates BIP 54 from block 1, this depends on #35793 and won't make the v32 feature freeze. So we can review and settle the changes now, but leave this in draft until #35793 lands. Once reviewers are happy with the state of the draft here we can add the Genesis block and the network can get started without being included in a release. We can then ship a patched v32 release with Testnet 5 included. A solo-mining ckpool endpoint is likely being set up and will be advertised here. There are no DNS or fixed seeds yet.

  2. chainparams: add versionbits deployment for BIP 54 4a6b1c6ffb
  3. scripted-diff: rename BIP54-sigops constants to MAX_TX_BIP54_SIGOPS
    BIP54 counts sigops differently from existing sigops-based checks. Since
    we are overloading the sigops term, make clear the constant refers to
    BIP54-sigops, not other kinds of pre-existing sigops.
    
    Also update the functional test framework's constant that has
    "standardness" in its name, since we are about to make it consensus
    critical (func test scripted-diff courtesy of Anthony Towns).
    
    -BEGIN VERIFY SCRIPT-
    sed -i 's/MAX_TX_LEGACY_SIGOPS/MAX_TX_BIP54_SIGOPS/g' $(git grep -l MAX_TX_LEGACY_SIGOPS src/)
    sed -i 's/MAX_STD_LEGACY_SIGOPS/MAX_TX_BIP54_SIGOPS/g' $(git grep -l MAX_STD_LEGACY_SIGOPS)
    sed -i 's/signature operations in validating a transaction./signature operations in a single transaction, per BIP54./' test/functional/test_framework/script_util.py
    -END VERIFY SCRIPT-
    
    Co-Authored-by: Anthony Towns <aj@erisian.com.au>
    9fb74e75d0
  4. moveonly: move CheckSigopsBIP54 from policy to consensus
    Move the function that checks whether a transaction respects the BIP54 sigops rule to the
    consensus folder (along with the accompanying constant), as it will be made consensus-critical
    in the next commit. Can be reviewed with git's --color-moved option.
    9ccf729e75
  5. validation: make BIP54 sigops check consensus-critical
    When BIP54 is active, enforce that block transactions do not violate the BIP54 limit on the
    number of legacy sigops present in Scripts that get executed during block validation.
    39cca6c97e
  6. qa: add to utilities a version of SignSignature for Taproot inputs
    In Taproot the signature commits to the list of spent outputs.
    16d8f7c502
  7. qa: extensive unit tests for BIP54 legacy sigops limit
    Test the newly introduced limit with various combinations of inputs and outputs types,
    historical transactions, and exercise some implementation-specific edge cases. Record
    each test case and optionally write them to disk as JSON to generate the BIP test vectors.
    d75143d393
  8. fuzz: add a fuzz target for the BIP54 sigops check
    The fuzz target was specifically crafted to support seeding it with the BIP54 test vectors
    generated by the unit test in the previous commit.
    243e7a7623
  9. scripted-diff: rename testnet4 timewarp constant
    We are going to introduce the timewarp fix for mainnet with a greater grace period. Rename
    the MAX_TIMEWARP value for testnet to differentiate them.
    
    -BEGIN VERIFY SCRIPT-
    
    for f in $(git grep -l MAX_TIMEWARP); do sed -i "s/MAX_TIMEWARP/MAX_TIMEWARP_TESTNET4/g" "$f"; done
    
    -END VERIFY SCRIPT-
    43f1b9471b
  10. miner: update a timewarp comment to refer specifically to BIP 54 6a10f77ef5
  11. validation: prevent timewarp attacks with a 2h grace period d96b2c79dc
  12. validation: prevent negative difficulty adjustment intervals 8795625242
  13. qa: BIP54 test vectors for timewarp and Murch-Zawy
    Documentation about the test vectors, including about their structure and content, as well as
    reproduction instructions, is available here: https://github.com/bitcoin/bips/tree/master/bip-0054/test_vectors
    da0b9ecf05
  14. validation: enforce that coinbase transactions are timelocked to block height
    When BIP 54 is active, coinbase transactions must have their nLockTime field set to the block height
    minus 1 (since it encodes the last height at which the transaction is invalid), and their nSequence
    field may be anything but the maximum value (which indicates "final", bypassing timelock
    validation).
    87b003f19d
  15. qa: BIP54 test vectors for restrictions on coinbase transactions
    Documentation about the test vectors' structure and content, as well as instructions for generating
    them is available at https://github.com/bitcoin/bips/tree/master/bip-0054/test_vectors .
    534d4766d1
  16. Avoid creating <= 64-byte transactions in most functional tests. e5c1b4aae9
  17. [test] Separate 64B and 63B tx size tests 32bfb7b6e1
  18. validation: make 64-byte transactions invalid
    64-byte transactions are also now treated as a consensus failure in
    PreChecks, like BIP54-sigops check failures. Note this only changes the
    RPC error, and not the disconnection behaviour in P2P since
    266dd0e10d08c0bfde63205db15d6c210a021b90.
    b1ec5a6f4f
  19. qa: unit tests for BIP54 rule on 64-byte transactions (with JSON test vectors)
    This adds tests exercising the bounds of the checks on the invalid transaction size, for various
    types of transactions (legacy, Segwit, bytes in input/output to get to 64 bytes) as well as
    sanity checking against some known historical violations.
    
    Thanks to Chris Stewart for digging up the historical violations to this rule.
    0719bf5164
  20. qa: end-to-end test all BIP54 mitigations
    The previously introduced unit tests extensively test the specific implementation of each
    mitigation. This functional test complements them by end-to-end testing all mitigations.
    For the added timestamp constraints, it mimicks how they would get exploited (by implementing pseudo
    timewarp and Murch-Zawy attacks) and demonstrates those exploits are not possible anymore after
    BIP54 activates.
    0acde965fa
  21. doc: add a BIP 54 entry to bips.md 9630491bf2
  22. DrahtBot commented at 6:45 PM on August 1, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35861.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #35852 (scripted-diff: Use inline const(expr) over static constexpr in headers by maflcko)
    • #35657 (refactor: avoid redundant input lookup in CheckTxInputs by arejula27)
    • #35570 (refactor: Change some validation.cpp methods to return BlockValidationState by optout21)
    • #35569 (Encapsulation for CTransaction by purpleKarrot)
    • #35301 (Silent Payments: Implement bip352 (take 2) by Eunovo)
    • #34864 (coins: tighten cache entry state invariants by l0rinc)
    • #32729 (test,refactor: extract script template helpers and expand sigop coverage by l0rinc)
    • #32468 (rpc: generateblock to allow multiple outputs by polespinasa)
    • #29491 ([EXPERIMENTAL] Schnorr batch verification for blocks by fjahr)
    • #28690 (build: Introduce internal kernel library by sedited)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  23. testnet: Introduce Testnet5 (BIP95)
    Testnet 5 is specified in BIP95. It drops the 20-minute minimum-difficulty
    exception of Testnet 3/4 and raises the minimum difficulty to nBits
    0x1a0fffff.
    f7bc6bdb36
  24. kernel: Add Testnet5 (BIP95) to the C API 768da947a7
  25. testnet: Activate BIP54 on Testnet5 (BIP95)
    BIP95 enforces the BIP54 rules on Testnet 5 from block 1. This also covers
    timewarp, so BIP94 is not enforced.
    5777e69d25
  26. doc: add BIP95 entry to bips.md c168a088b3
  27. doc: add release note for Testnet5 (BIP95) 31ed5baf68
  28. fjahr force-pushed on Aug 1, 2026
  29. DrahtBot added the label CI failed on Aug 1, 2026
  30. DrahtBot commented at 7:16 PM on August 1, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task iwyu: https://github.com/bitcoin/bitcoin/actions/runs/30713233158/job/91404317894</sub> <sub>LLM reason (✨ experimental): CI failed because IWYU (include-what-you-use) reported a failure and forced the job to exit with “Failure generated from IWYU.”</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>

  31. DrahtBot removed the label CI failed on Aug 1, 2026
  32. DrahtBot added the label Needs rebase on Aug 14, 2026
  33. DrahtBot commented at 5:49 PM on August 14, 2026: contributor

    <!--cf906140f33d8803c4a75a2196329ecb-->

    🐙 This pull request conflicts with the target branch and needs rebase.

  34. fjahr force-pushed on Aug 15, 2026
  35. fjahr force-pushed on Aug 15, 2026
  36. DrahtBot added the label CI failed on Aug 15, 2026

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-08-21 06:51 UTC

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