Skip to content

BIP352: Add intermediate vector material for silent payments#1953

Merged
jonatack merged 2 commits intobitcoin:masterfrom
macgyver13:bip352-generate-intermediate-comp
Sep 5, 2025
Merged

BIP352: Add intermediate vector material for silent payments#1953
jonatack merged 2 commits intobitcoin:masterfrom
macgyver13:bip352-generate-intermediate-comp

Conversation

@macgyver13
Copy link
Contributor

@macgyver13 macgyver13 commented Sep 4, 2025

This PR adds intermediate computation vectors to the BIP-352 reference implementation to improve development experience and code clarity.

Changes

  • Updated reference.py to validate intermediate values during silent payment computations
  • Added comprehensive intermediate vector material to send_and_receive_test_vectors.json
  • Applied labels suggestion by @fifalodm to scanning

Benefits

  • secp256k1 library no longer needs to handle silent payments specific code, intermediate values can be used instead
  • Other projects can use intermediate values to clarify computations during development and debugging

This change makes it easier for implementers to understand and debug silent payment computations by providing visibility into intermediate calculation steps.

@macgyver13 macgyver13 changed the title Add intermediate vector material for BIP-352 silent payments BIP352: Add intermediate vector material for silent payments Sep 4, 2025
Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pinging BIP authors @josibake @RubenSomsen for feedback or approval.

The tests pass with this change.

/bip-0352 $ ./reference.py send_and_receive_test_vectors.json
Simple send: two inputs
Simple send: two inputs, order reversed
Simple send: two inputs from the same transaction
Simple send: two inputs from the same transaction, order reversed
Outpoint ordering byte-lexicographically vs. vout-integer
Single recipient: multiple UTXOs from the same public key
Single recipient: taproot only inputs with even y-values
Single recipient: taproot only with mixed even/odd y-values
Single recipient: taproot input with even y-value and non-taproot input
Single recipient: taproot input with odd y-value and non-taproot input
Multiple outputs: multiple outputs, same recipient
Multiple outputs: multiple outputs, multiple recipients
Receiving with labels: label with even parity
Receiving with labels: label with odd parity
Receiving with labels: large label integer
Multiple outputs with labels: un-labeled and labeled address; same recipient
Multiple outputs with labels: multiple outputs for labeled address; same recipient
Multiple outputs with labels: un-labeled, labeled, and multiple outputs for labeled address; same recipients
Single recipient: use silent payments for sender change
Single recipient: taproot input with NUMS point
Pubkey extraction from malleated p2pkh
P2PKH and P2WPKH Uncompressed Keys are skipped
Skip invalid P2SH inputs
Recipient ignores unrelated outputs
No valid inputs, sender generates no outputs
Input keys sum up to zero / point at infinity: sending fails, receiver skips tx
All tests passed

@jonatack jonatack added the Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified label Sep 4, 2025
Copy link
Member

@josibake josibake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b7c79dc

This was raised in bitcoin-core/secp256k1#1698 (comment); I've verified that these changes do allow us to remove the ripemd160.py and bech32m.py utility files from the libsecp256k1 PR. I think this is also a generally useful change for other projects using these test vectors, in particular index building.

@jonatack
Copy link
Member

jonatack commented Sep 5, 2025

ACK b7c79dc

@jonatack jonatack removed the Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified label Sep 5, 2025
@jonatack jonatack merged commit eabb63c into bitcoin:master Sep 5, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants