diff --git a/bip-0375.mediawiki b/bip-0375.mediawiki index 7d6089a469..2c604bd3df 100644 --- a/bip-0375.mediawiki +++ b/bip-0375.mediawiki @@ -10,7 +10,7 @@ Assigned: 2025-01-08 License: BSD-2-Clause Discussion: https://groups.google.com/g/bitcoindev/c/5G5wzqUXyk4 - Version: 0.1.1 + Version: 0.1.2 Requires: 352, 370, 374 @@ -237,8 +237,8 @@ Using [https://github.com/bitcoin/bips/blob/master/bip-0374.mediawiki#dleq-proof ====Computing the Output Scripts==== Compute the PSBT_OUT_SCRIPT using the procedure in [https://github.com/bitcoin/bips/blob/master/bip-0352.mediawiki#creating-outputs BIP352] but substituting ''a·Bscan'' with the PSBT_GLOBAL_SP_ECDH_SHARE for that scan key if available, or the sum of all PSBT_IN_SP_ECDH_SHAREs from eligible inputs for that scan key. -If there are multiple silent payment codes with the same scan key, sort the codes lexicographically in ascending order to determine the ordering of the ''k'' value. -If there are multiple silent payment codes with both the same scan and spend keys, sort the subgroup by output index in ascending order. +If there are multiple silent payment codes with the same scan key, the ''k'' values are assigned in ascending output index order: the first of those outputs has ''k'' = 0, the next ''k'' = 1, and so on. +The counter is per scan key and counts only the outputs sharing that scan key, so it is not the output index itself. ===Transaction Extractor=== @@ -331,7 +331,7 @@ Use the provided [[bip-0375/test_runner.py|test runner]] to validate each test v | PSBT_OUT_SCRIPT does not match derived sp output |- | Output Scripts -| two sp outputs (same scan / different spend keys) not sorted lexicographically by spend key +| k values swapped between two sp outputs (same scan key / different spend keys) |- | Output Scripts | k values assigned to wrong output indices with three sp outputs (same scan / spend keys) @@ -368,7 +368,7 @@ Use the provided [[bip-0375/test_runner.py|test runner]] to validate each test v | one input / two sp outputs - output 0 has no label / output 1 uses label=0 convention for sp change |- | Can Finalize -| two sp outputs - output 0 uses label=3 / output 1 uses label=1 +| two sp outputs (same scan key) with spend keys in descending order - output 0 uses label=3 / output 1 uses label=1, k follows output index |- | Can Finalize | two inputs using per-input ECDH shares - only eligible inputs contribute shares (P2SH excluded) @@ -403,6 +403,8 @@ Use the provided [[bip-0375/test_runner.py|test runner]] to validate each test v == Changelog == +* '''0.1.2''' (2026-08-14): +** State that the ''k'' values follow output index order, as the test vectors and the reference validator do. * '''0.1.1''' (2026-04-16): ** Add test vectors and reference for validating Sending Silent Payments with PSBTs. * '''0.1.0''' (2025-01-13): diff --git a/bip-0375/bip375_test_vectors.json b/bip-0375/bip375_test_vectors.json index 3f16f51b23..8fbd1fff35 100644 --- a/bip-0375/bip375_test_vectors.json +++ b/bip-0375/bip375_test_vectors.json @@ -477,7 +477,7 @@ } }, { - "description": "output scripts: two sp outputs (same scan / different spend keys) not sorted lexicographically by spend key", + "description": "output scripts: k values swapped between two sp outputs (same scan key / different spend keys)", "psbt": "cHNidP8B+wQCAAAAAQIEAgAAAAEEAQEBBQECAQYBAAABDiAYpxdmOwurFLEqGncTI/8eQHndUy5d0T4o6hCBxwCYSgEPBAAAAAABAR+ghgEAAAAAABYAFCKactNKZFvTSWu79Qu7gckGP0+UIgICyBe7dSGvw16pbzv7Jw5utQ3f+lVgYnuWH+wA8pllCL9HMEQCID9iBcRocGpGJF8XE6u4uLmjp7/YOsdF98ByDUQxtM38AiBxWKv7gg8r9a1nRfVvwHCcmVzMrP4XCY2KobYfjJ/y/wEBAwQBAAAAIgYCyBe7dSGvw16pbzv7Jw5utQ3f+lVgYnuWH+wA8pllCL8IAAAAgAAAAAABEAT+////Ih0Cekh/wZ+3aYd7h0LW6hgRjzxOcrHqjG3mAqetSkHb4GghA+yk/xG3KOLg9gzmIilDpv9VudlfYnv5qZ0IS8hy1QpbIh4Cekh/wZ+3aYd7h0LW6hgRjzxOcrHqjG3mAqetSkHb4GhAihOzmFVF9yvW6JcUrrkJs+NUqEKpu4tWzQ7e0h34oZlZizEiikngvX6VzhBT98WyistUOmhwdgDjzomCLuMgIQABAwiQXwEAAAAAAAEEIlEgdUe4Fj1bvFSYQL5MwUaq0JUgc2e565RwbeZwjUCPk/kBCUICekh/wZ+3aYd7h0LW6hgRjzxOcrHqjG3mAqetSkHb4GgCi4D5lDNIleEbx2x1q254/iwluzMvIXshHEAXvx9nfYYAAQMIECcAAAAAAAABBCJRIGziw1OV8XDyS20tgNCkDEb0a6S0hD9qsxGpNLMcXYTcAQlCAnpIf8Gft2mHe4dC1uoYEY88TnKx6oxt5gKnrUpB2+BoA6r4Yq7amM+SU5r33DN10dpfsGsSHvCh8DGp9zgv1T27AA==", "supplementary": { "inputs": [ @@ -966,7 +966,7 @@ } }, { - "description": "can finalize: two sp outputs - output 0 uses label=3 / output 1 uses label=1", + "description": "can finalize: two sp outputs (same scan key) with spend keys in descending order - output 0 uses label=3 / output 1 uses label=1, k follows output index", "psbt": "cHNidP8B+wQCAAAAAQIEAgAAAAEEAQEBBQECAQYBAAABDiAYpxdmOwurFLEqGncTI/8eQHndUy5d0T4o6hCBxwCYSgEPBAAAAAABAR/gkwQAAAAAABYAFCKactNKZFvTSWu79Qu7gckGP0+UIgICyBe7dSGvw16pbzv7Jw5utQ3f+lVgYnuWH+wA8pllCL9HMEQCICJa45kPVF365uoUKpN0arSqgSfjyBNY63wha08anrtiAiBl42BSGRArJQdeOVXz80zjvPKjXR4QFd1dw7/tPs81qQEBAwQBAAAAIgYCyBe7dSGvw16pbzv7Jw5utQ3f+lVgYnuWH+wA8pllCL8IAAAAgAAAAAABEAT+////Ih0Ci3kOCYf96fDRI5jra+MMc3Z5PGR4ZaKgLy78lg2WZWghAlWBv6pzMVb2uY5xom9w/XazZ4ZJ9isfxed7jpq45hBQIh4Ci3kOCYf96fDRI5jra+MMc3Z5PGR4ZaKgLy78lg2WZWhAeUCBnrbp8ljBWDh8CmTMFvUXx+9ECRIszqqU9OL/U3bEJHv8Fw2bJjsOPSBrZoyH6Us03ur6AKF5KwR614h1uwABAwighgEAAAAAAAEEIlEgyvcy9B51UZCclKM10VeOp7dmAnuIbN0cFwHZv8a3hIgBCUICi3kOCYf96fDRI5jra+MMc3Z5PGR4ZaKgLy78lg2WZWgDliRhtuNd91TQDUhtw53swgJxhFB2YU5cDtLJDyPT6b4BCgQDAAAAAAEDCDDmAgAAAAAAAQQiUSBNB6DTsPYafF7+NsLDxYfItphBhUYAjPgZu9pM4xgSIQEJQgKLeQ4Jh/3p8NEjmOtr4wxzdnk8ZHhloqAvLvyWDZZlaANaVzfUxngmF8xrDElrsrxiVVoyslQkT7ycnANd9GnlqwEKBAEAAAAA", "supplementary": { "inputs": [ diff --git a/bip-0375/deps/__pycache__/dleq.cpython-314.pyc b/bip-0375/deps/__pycache__/dleq.cpython-314.pyc new file mode 100644 index 0000000000..d6a4469a9c Binary files /dev/null and b/bip-0375/deps/__pycache__/dleq.cpython-314.pyc differ diff --git a/bip-0375/deps/bitcoin_test/__pycache__/messages.cpython-314.pyc b/bip-0375/deps/bitcoin_test/__pycache__/messages.cpython-314.pyc new file mode 100644 index 0000000000..e51ea30967 Binary files /dev/null and b/bip-0375/deps/bitcoin_test/__pycache__/messages.cpython-314.pyc differ diff --git a/bip-0375/deps/bitcoin_test/__pycache__/psbt.cpython-314.pyc b/bip-0375/deps/bitcoin_test/__pycache__/psbt.cpython-314.pyc new file mode 100644 index 0000000000..4430731c0a Binary files /dev/null and b/bip-0375/deps/bitcoin_test/__pycache__/psbt.cpython-314.pyc differ diff --git a/bip-0375/deps/secp256k1lab/src/secp256k1lab/__pycache__/__init__.cpython-314.pyc b/bip-0375/deps/secp256k1lab/src/secp256k1lab/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000..852afcfffb Binary files /dev/null and b/bip-0375/deps/secp256k1lab/src/secp256k1lab/__pycache__/__init__.cpython-314.pyc differ diff --git a/bip-0375/deps/secp256k1lab/src/secp256k1lab/__pycache__/ecdh.cpython-314.pyc b/bip-0375/deps/secp256k1lab/src/secp256k1lab/__pycache__/ecdh.cpython-314.pyc new file mode 100644 index 0000000000..9f4d373df3 Binary files /dev/null and b/bip-0375/deps/secp256k1lab/src/secp256k1lab/__pycache__/ecdh.cpython-314.pyc differ diff --git a/bip-0375/deps/secp256k1lab/src/secp256k1lab/__pycache__/secp256k1.cpython-314.pyc b/bip-0375/deps/secp256k1lab/src/secp256k1lab/__pycache__/secp256k1.cpython-314.pyc new file mode 100644 index 0000000000..d6b1905c56 Binary files /dev/null and b/bip-0375/deps/secp256k1lab/src/secp256k1lab/__pycache__/secp256k1.cpython-314.pyc differ diff --git a/bip-0375/deps/secp256k1lab/src/secp256k1lab/__pycache__/util.cpython-314.pyc b/bip-0375/deps/secp256k1lab/src/secp256k1lab/__pycache__/util.cpython-314.pyc new file mode 100644 index 0000000000..cbb8b75330 Binary files /dev/null and b/bip-0375/deps/secp256k1lab/src/secp256k1lab/__pycache__/util.cpython-314.pyc differ diff --git a/bip-0375/validator/__pycache__/bip352_crypto.cpython-314.pyc b/bip-0375/validator/__pycache__/bip352_crypto.cpython-314.pyc new file mode 100644 index 0000000000..66f989bfaf Binary files /dev/null and b/bip-0375/validator/__pycache__/bip352_crypto.cpython-314.pyc differ diff --git a/bip-0375/validator/__pycache__/inputs.cpython-314.pyc b/bip-0375/validator/__pycache__/inputs.cpython-314.pyc new file mode 100644 index 0000000000..693f7cbec6 Binary files /dev/null and b/bip-0375/validator/__pycache__/inputs.cpython-314.pyc differ diff --git a/bip-0375/validator/__pycache__/psbt_bip375.cpython-314.pyc b/bip-0375/validator/__pycache__/psbt_bip375.cpython-314.pyc new file mode 100644 index 0000000000..a423359487 Binary files /dev/null and b/bip-0375/validator/__pycache__/psbt_bip375.cpython-314.pyc differ diff --git a/bip-0375/validator/__pycache__/validate_psbt.cpython-314.pyc b/bip-0375/validator/__pycache__/validate_psbt.cpython-314.pyc new file mode 100644 index 0000000000..a2f59a5e41 Binary files /dev/null and b/bip-0375/validator/__pycache__/validate_psbt.cpython-314.pyc differ diff --git a/bip-0375/validator/validate_psbt.py b/bip-0375/validator/validate_psbt.py index 0ec7c84853..c2fe5f7148 100644 --- a/bip-0375/validator/validate_psbt.py +++ b/bip-0375/validator/validate_psbt.py @@ -304,7 +304,8 @@ def validate_output_scripts(psbt: PSBT) -> Tuple[bool, str]: output_index = struct.unpack("