Skip to content

Conversation

@notTanveer
Copy link

Key Changes:

  • New PSBT Fields:
    • Global:
      • PSBT_GLOBAL_SP_ECDH_SHARE (0x07)
      • PSBT_GLOBAL_SP_DLEQ (0x08)
    • Per-Input:
      • PSBT_IN_SP_ECDH_SHARE (0x1d)
      • PSBT_IN_SP_DLEQ (0x1e)
    • Per-Output:
      • PSBT_OUT_SP_V0_INFO (0x09)
      • PSBT_OUT_SP_V0_LABEL (0x0a)
  • Parsing and Serialization:
    • Implemented parsing logic in PSBT.parse_unknowns, InputScope.read_value, and OutputScope.read_value for the new fields, including key and value length validations.
    • Implemented serialization logic in PSBT.write_to, InputScope.write_to, and OutputScope.write_to.
    • Silent Payment specific fields (global, per-input, per-output) are serialized only for PSBT version 2, as per BIP-375 requirements.
  • PSBT Version Handling:
    • The PSBT class now explicitly handles version (None for v0, 2 for v2).
    • Global Silent Payment fields will raise an error if encountered or serialized in a non-v2 PSBT.
  • Signer Logic (PSBT.sign_with):
    • Added checks to prevent signing if inputs with Segwit version > 1 are present alongside Silent Payment outputs.
    • Enforces SIGHASH_ALL for inputs when Silent Payment outputs are present.
  • Output Handling:
    • The OutputScope.vout property now correctly handles cases where script_pubkey might be None if sp_v0_info is present (indicating a Silent Payment output whose script is not yet computed).
  • Backwards Compatibility:
    • Ensured that existing PSBTv0 and Taproot field serialization remains correct, particularly for Taproot output fields in OutputScope.write_to after version-conditional logic was added.

still figuring out the tests for this implementation(BIP-375 has no test vectors) — will add them soon.

@notTanveer notTanveer marked this pull request as draft June 18, 2025 13:23
@notTanveer
Copy link
Author

BIP 375 is still in draft and doesn’t have a reference implementation yet, mainly because folks are still figuring out the best way to handle it. so i’m converting this to a draft PR for now. once the test vectors and other pieces are in place, we can revisit and move it forward.

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