BIP375: Add test vectors + runner #2046

pull macgyver13 wants to merge 6 commits into bitcoin:master from macgyver13:bip375-reference-testvectors-pr changing 8 files +1791 −0
  1. macgyver13 commented at 9:09 pm on November 26, 2025: contributor

    This PR adds the test runner test_runner.py and test_vectors.json for demonstrating BIP 375 behavior. Care was taken to minimize dependencies required to evaluate the test vectors.

    Dependencies are referenced at runtime from bip-0374 instead of cloning locally.

    Test generation tools moved to external repo

    Feedback welcome @andrewtoth @achow101 @josibake

    Test runner output

     0Invalid test cases: 13
     1=== Running Invalid Test Cases ===
     2Test 1: Missing DLEQ proof for ECDH share
     3Test 2: Invalid DLEQ proof
     4Test 3: Non-SIGHASH_ALL signature with silent payments
     5Test 4: Mixed segwit versions with silent payments
     6Test 5: Silent payment outputs but no ECDH shares
     7Test 6: Global ECDH share without DLEQ proof
     8Test 7: Wrong SP_V0_INFO field size
     9Test 8: Mixed eligible and ineligible input types
    10Test 9: Wrong ECDH share size
    11Test 10: Wrong DLEQ proof size
    12Test 11: Label without SP_V0_INFO
    13Test 12: Address mismatch
    14Test 13: Both global and per-input ECDH shares
    15
    16Valid test cases: 4
    17=== Running Valid Test Cases ===
    18Test 14: Single signer with global ECDH share
    19Test 15: Multi-party with per-input ECDH shares
    20Test 16: Silent payment with change detection
    21Test 17: Multiple silent payment outputs to same scan key
    
  2. jonatack added the label Proposed BIP modification on Nov 27, 2025
  3. jonatack added the label Pending acceptance on Nov 27, 2025
  4. macgyver13 force-pushed on Dec 1, 2025
  5. macgyver13 force-pushed on Dec 3, 2025
  6. Add foundational PSBT parsing and basic validation
    - Add constants.py with BIP 375 PSBT field type definitions
    - Add parser.py with PSBT v2 structure parsing functions
    - Add minimal test_runner.py for basic structure validation
    - Validates PSBT magic bytes and parse-ability
    - All 17 test vectors pass basic structure checks
    - - Basic structure validation complete: 4 passed, 13 failed
    56eeccc095
  7. Add input validation for silent payment eligibility
    - Add inputs.py with input type validation helpers
    - Add dependencies from previous work
    - - deps/bip352_utils.py
    - - deps/secp256k1_374.py
    - Validate eligible input types (P2PKH, P2WPKH, P2TR, P2SH-P2WPKH)
    - Check segwit version restrictions (v0-v1 only)
    - Verify P2SH inputs are P2SH-P2WPKH
    - Update test_runner.py to validate inputs
    Input validation complete: 6 passed, 11 failed
    df6466a533
  8. Add DLEQ proof validation for ECDH shares
    - Add dleq.py with DLEQ proof validation functions
    - Extract public keys from BIP32 derivation fields
    - Validate global and per-input DLEQ proofs using BIP-374
    - Verify scan key consistency between ECDH and DLEQ fields
    - Prevent conflicting global/per-input ECDH for same scan key
    - Check ECDH shares exist for silent payment outputs
    - Update test_runner.py with comprehensive DLEQ validation
    DLEQ validation complete: 14 passed, 3 failed
    adcbae6c09
  9. Add complete BIP-375 PSBT validator
    - Add validator.py with comprehensive BIP-375 validation
    - Validate output field requirements (SCRIPT or SP_V0_INFO)
    - Check SP_V0_INFO field size (66 bytes)
    - Validate SP_V0_LABEL requires SP_V0_INFO
    - Enforce SIGHASH_ALL requirement for silent payments
    - Integrate all previous validation (inputs, DLEQ, ECDH)
    - Simplify test_runner.py to use validator module
    - Validation complete: 16 passed, 1 failed
    da056e774e
  10. Add BIP-352 output script validation - address mismatch test case
    - Add validate_bip352_outputs() for output script verification
    - Support both global and per-input ECDH share modes
    - Update test_runner.py to pass test material to validator
    a6fe194a9e
  11. Add README
    - Details core files and dependencies
    - Link to test_generator.py for vector generation
    - Provide usage instructions for test_runner.py
    88dec03deb
  12. macgyver13 force-pushed on Dec 5, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-12-10 00:10 UTC

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