Commit Graph
4980 Commits
Author SHA1 Message Date
Jon Atack c0614759ed Merge pull request #2351 from jonasnick/bip-0327-test-vectors 2026-11-16 05:53:27 -06:00
Jonas Nick 61a775497f bip-0327: bump version to 1.0.5
Add a changelog entry for the changes to the test vectors.
2026-11-16 09:29:52 +00:00
Jonas Nick 83b770777a bip-0327: add test vectors for the signs of accumulated tweaks
ApplyTweak multiplies gacc by g, which is -1 if an x-only tweak negates
the aggregate public key. In every previous tweak sequence, the product
of all values of g equals the last one. Add a test vector with two
x-only tweaks, of which only the first negates the aggregate public key.
It detects implementations that set gacc to g instead of multiplying it
by g.

PartialSigAgg adds e*g*tacc, where g is -1 if the aggregate public key Q
has an odd Y coordinate. In the previous PartialSigAgg test vectors,
tacc is 0 whenever Q has an odd Y coordinate. Add a test vector with a
plain tweak and an odd Q, generated by gen_vectors_helper.py. It detects
implementations that omit g.
2026-11-16 09:29:52 +00:00
Jonas Nick 7cdaa7a183 bip-0327: isolate the range check in a PartialSigVerify test vector
The PartialSigVerify test vector with the partial signature n fails the
verification equation even without the range check. So it does not
detect implementations that omit the range check or that check s > n
instead of s >= n. Change the pubnonces of the test vector such that the
partial signature 0 is valid, keeping the aggregate nonce. Since
n*G = 0*G, the partial signature n then satisfies the verification
equation, and only the range check rejects it. The previous version of
the test vector detects no mistake that the new version does not detect,
so it is replaced rather than kept.

gen_vectors_helper.py computes the new pubnonces.
2026-11-16 09:29:52 +00:00
Jonas Nick b7557f897a bip-0327: add a NonceGen test vector without repeated bytes
In the previous NonceGen test vectors, every rand_ consists of the byte
0F repeated 32 times, every present sk of the byte 02 repeated 32 times,
and every pk has an even Y coordinate. Add a test vector whose rand_ and
sk are not a repeated byte and whose pk has an odd Y coordinate. It
detects implementations that reverse the byte order of rand_ or sk, that
replace the first byte of pk with 02, or that use only the first byte of
rand_.

With the last mistake, two NonceGen invocations with the same other
arguments return the same secnonce with probability 1/256, although the
BIP requires that Sign is never executed twice with the same secnonce.
2026-11-16 09:29:52 +00:00
Jonas Nick 17affe2861 bip-0327: add test vectors for a public key and its negation
A public key and its negation have the same X coordinate, and their
compressed encodings differ only in the first byte. Add a Sign test
vector with a secnonce generated for the negation of the signer's public
key, and a KeyAgg test vector with a public key and its negation. They
detect implementations that compare public keys only by their X
coordinates, in the public key check of Sign, in GetSecondKey, or in
KeyAggCoeffInternal. Distinct public keys in the previous test vectors
also have distinct X coordinates.

The public key check in Sign ensures that the secret key provided to
Sign is determined when NonceGen is invoked. Comparing only X
coordinates determines the secret key only up to negation.
2026-11-16 09:29:52 +00:00
Jonas Nick 0ba8e56a02 bip-0327: add test vectors for k2' >= n and 256-byte messages
Add Sign test vectors with k2' = n and k2' = n + 1. Together they
detect implementations that check the secret nonce values only for
zero, that check k2' <= n instead of k2' < n, or that reduce k2' mod n
before checking it for zero. No single value detects the last two:
among values of at least n, checking k2' <= n accepts only n, while
reducing first rejects only n. For k2' = n, the optional correctness
check at the end of Sign also fails, because k2'*G is infinity, so this
vector detects the k2' <= n mistake only in implementations that omit
that check.

Add NonceGen and DeterministicSign test vectors with a 256-byte
message. They detect implementations that encode only the low byte of
len(m); the longest message in the previous test vectors has 38 bytes.
DeterministicSign needs its own vector because it encodes len(m)
separately.
2026-11-16 09:29:52 +00:00
Jonas NickandFerdinando Ametrano 6e8dafd3c3 bip-0327: add test vectors and a README that describes them
Add Sign test vectors for a secnonce with k2' = 0 and for a secnonce
generated for a different public key. No previous test vector detected
an implementation that checks only k1', or one that omits the public
key check added in 1.0.0-rc.2.

Add test vectors for a single signer, a 4-byte extra_in, and plain and
x-only tweaks in DeterministicSign. They detect implementations that
reject a single signer, encode the length of extra_in as 32 whenever
extra_in is present, or treat every tweak in DeterministicSign as
x-only.

Add a README to the vectors directory. It states that the test vectors
only contain inputs whose length and number meet the specification of
BIP327, and that a test vector should only be added if it detects a
plausible implementation mistake that the other test vectors do not
detect. Name that mistake in the comment of each added test vector.

Co-authored-by: Ferdinando Ametrano <ferdinando@ametrano.net>
2026-11-16 09:29:52 +00:00
Jon Atack b34d9f7517 Merge pull request #2315 from fametrano/bip375-valid-table-row 2026-11-10 16:50:28 -06:00
Ferdinando Ametrano ec7f9b44aa bip-0375: bump version to 0.1.4 2026-11-10 21:08:56 +01:00
Ferdinando Ametrano 8882768f52 bip-0375: replace bare OP_2 vector with an in-progress PSBT
The valid vector "input eligibility: bare OP_2 script is not a segwit
v2 witness program" passed only because its "checks" field limited it
to the input eligibility check. Its only input, the bare OP_2, is not
eligible, so its silent payment output script cannot be derived and the
output scripts check fails.

Replace it with a vector that adds an eligible P2WPKH input carrying
the ECDH share and DLEQ proof. The bare OP_2 input keeps only
PSBT_IN_NON_WITNESS_UTXO, which the segwit version check reads, so the
vector still tests that bare OP_2 is not taken for a segwit v2 witness
program, with no "checks" field. The bare OP_2 input is unsigned, so the
vector is In Progress; add its row to the Valid PSBTs table at its
position in the JSON file.

Vector by @macgyver13.
2026-11-10 21:03:51 +01:00
Murch d71d60687b Merge pull request #2350 from jonatack/2026-11-include-deputies-in-readme
process: include deputies in README Owner entries
2026-11-10 00:32:02 +01:00
Jon Atack 7bf26a7109 script, refactor: rename authors to owners where relevant 2026-11-09 13:22:49 -06:00
Jon Atack d853786cd8 bip3: clarify deputy inclusion in readme owner entry 2026-11-09 11:43:10 -06:00
Jon Atack c2497beafd script: buildtable checks deputy inclusion in readme 2026-11-09 11:36:14 -06:00
Jon Atack 99e21c8154 Merge pull request #2349 from craigraw/bip392-fix-xkey-examples
BIP392: Fix xprv/xpub examples to use BIP352 derivation paths
2026-11-09 09:55:18 -06:00
Craig Raw bba6223aa1 BIP392: Fix xprv/xpub examples to use BIP352 derivation paths 2026-11-09 16:43:28 +01:00
Murch a34f044bb8 Merge pull request #2310 from zjubiology/master
BIP375: check SegWit versions in non-witness UTXOs
2026-11-07 16:41:44 +01:00
zjubiology 97b6274626 BIP375: check SegWit versions in non-witness UTXOs
Signed-off-by: zjubiology <zjubiology@outlook.com>
2026-11-07 22:20:18 +08:00
Murch f9cff97a6b Merge pull request #2348 from Yudis-bit/fix/bip352-vector-input-encoding
bip-0352: fix input encodings in test vectors
2026-11-06 21:00:44 +01:00
Murch 55916fd835 Merge pull request #2251 from jeanpablojp/rawtr-descriptor
BIP394: rawtr() Output Script Descriptors
2026-11-06 20:57:37 +01:00
jeanpablojp bc8b68c9cf BIP394: rawtr() Output Script Descriptors 2026-11-06 13:10:19 +00:00
Jon Atack c9547b9dad Merge pull request #2347 from ajtowns/202611-bip95-bump
BIP95: Change proposed Testnet 5 genesis block structure
2026-11-05 19:34:21 -06:00
Murch a50f8f8cb9 Merge pull request #2238 from fametrano/bip174-witnessscript-vector-pubkey
BIP-174: test data: make the witnessScript in the invalid-key case match its P2WSH hash
2026-11-05 23:46:36 +01:00
Jon Atack d4dea2a230 Merge pull request #2207 from macgyver13/bip375-labeled-spend
BIP-375: correct labeled test vectors to include labeled-spend key in PSBT_OUT_SP_V0_INFO
2026-11-05 12:05:54 -06:00
Jon Atack e30a8b0523 Merge pull request #2257 from fametrano/bip375-sp-info-identifier-serialization
bip-0375: say the version byte belongs to the identifier, not to the field
2026-11-05 11:40:33 -06:00
Murch 758c231cd4 Merge pull request #2342 from ajtowns/202611-bip34-early
BIP34: clarify encoding for early blocks
2026-11-05 18:20:32 +01:00
Anthony Towns 69ec29d518 BIP95: Change proposed Testnet 5 genesis block structure
This moves the anti-pre-mine commitment back into `pszTimestamp` and
keeps it as ASCII text, rather than using it as a fake public key. The
genesis transaction's output is replaced by an `OP_RETURN` to avoid
confusion over spendability. Using the `OP_RETURN` output and `nVersion`
rolling for additional nonce bits are explicitly allowed.
2026-11-06 03:17:59 +10:00
Murch a0190d01a1 Merge pull request #2339 from Eunovo/bip352-invalid-control-block-vector
Bip352: Add consensus-validity requirement to Scanning requirements
2026-11-05 18:10:07 +01:00
Yudis-bit 04393c98c0 bip-0352: fix input encodings in test vectors
BIP352 scanning assumes consensus-valid transactions. These fixtures
have a Taproot control parity mismatch and ECDSA encodings without
a sighash byte.

Correct both sending and receiving copies. The DER lengths and R/S
stay unchanged. Append SIGHASH_ALL outside DER as an encoding
correction. Complete transaction signature validity remains outside
these input-only fixtures.

The 29 vectors pass the official reference runner before and after.
Expected outputs, addresses and shared secrets are unchanged.
2026-11-05 20:37:13 +07:00
Novo bbb2794d9e BIP352: add consensus validity scanning requirements
Silent Payments transaction scanning assumes that the transaction is consensus-valid. The test vectors do not include consensus-invalid transactions.
2026-11-05 13:29:16 +01:00
Anthony Towns d433c2e35d BIP34: clarify encoding for early blocks 2026-11-05 16:56:02 +10:00
Anthony Towns 4e3f4a95a7 BIP34: Add version header and changelog section 2026-11-05 16:55:30 +10:00
macgyver13 d31236854b BIP-375: update validation to match sorting outputs with same scan key
Fix output script validation for silent payment output ordering when multiple 
outputs share the same scan key (labeled addresses of one recipient).
2026-11-04 18:26:44 -05:00
macgyver13 434a4d2659 BIP-375: update labeled test vectors
Now PSBT_OUT_SP_V0_INFO provides labeled-spend public key not the base-spend
public key.

Modify test vector with labeled-spend key to the same recipient from:
two sp outputs - output 0 uses label=3 / output 1 uses label=1
to:
three sp outputs (same scan key) - output 0 uses label=1, outputs 1 and 2 uses label=2 (same spend key)
This vector excercises the BIP375 sorting outputs with same scan key properly.

The next commit will fix the validation logic and address this failing test.

bump ChangeLog to 0.1.3
2026-11-04 18:14:49 -05:00
Ferdinando Ametrano a2c1248774 bip-0375: say the version byte belongs to the identifier, not to the field
"The PSBT_OUT_SP_V0_INFO should be serialized as a zero byte for the
version, followed by the 33 bytes of the scan key and then 33 bytes for
the spend key" names the field, and the field is 66 bytes: its table
entry is "<33 byte scan key> <33 byte spend key>", the test vectors carry
66, and the validator refuses anything else.

The sentence is in the Unique Identification section and was added with
it, so what it describes is the output script that stands in for a silent
payment output when building the unsigned transaction that identifies the
psbt -- 67 bytes there, and nothing about the field. Read as the field's
own serialization it contradicts the table, which is how it first read
here.

Only the wording changes.
2026-11-05 00:13:24 +01:00
Ferdinando Ametrano 8bd2e39a36 BIP-174: test data: make the witnessScript in the invalid-key case match its P2WSH hash
In the "PSBT with invalid output witnessScript typed key" case, the
value of the PSBT_OUT_WITNESS_SCRIPT record no longer hashes to the
P2WSH program in the output's redeemScript: 65f0b3dd trimmed it to its
last six bytes while fixing a short read.

Re-encode the record as `02 0100 25 <script>`: the key stays one byte
too long, which is what the case tests, and the value is the original
37-byte script again. Same total length, same layout as the "invalid
output redeemScript typed key" case.
2026-11-04 23:56:11 +01:00
Jon Atack a0c977f375 Merge pull request #2346 from fjahr/95port
BIP95: Change default P2P port to 18353
2026-11-04 10:26:40 -06:00
Fabian Jahr ab3f20041f BIP95: Change default P2P port to 18353 2026-11-05 00:38:08 +09:00
Jon Atack a763725aa4 Merge pull request #2345 from MrHodlX/bip373-output-vector
BIP373: replace the duplicated x-only output participant vector
2026-11-04 09:15:00 -06:00
MrHodlX e315654e75 BIP373: replace the duplicated x-only output participant vector 2026-11-04 08:43:47 -05:00
Jon Atack 61ff3f1361 Merge pull request #2311 from jonatack/2026-09-bip375-reference-implementation
bip375: replace stale TODO with reference implementation
2026-11-03 21:42:17 -06:00
Jon Atack ea875b262c Merge pull request #2343 from achow101/375-deputize
375: Add deputy
2026-11-03 21:38:48 -06:00
Jon Atack d5ca385c8e Merge pull request #2212 from fjahr/cisa
BIP460: CISA for Taproot Key Path Spends
2026-11-03 21:33:06 -06:00
Ava Chow e4e02e14cf 375: Deputize macgyver 2026-11-03 19:28:09 -08:00
Fabian Jahr 3886890d7e bip-0460: Add entry to the README index 2026-11-04 11:01:32 +09:00
Fabian Jahr 6ee9ac116e bip-0460: Add CISA for Taproot key path spends 2026-11-04 11:00:26 +09:00
Fabian Jahr 55167425a1 bip-0460: Add vendored BIP 459 reference code 2026-11-04 11:00:26 +09:00
Fabian Jahr 4a801194d5 bip-0460: Add vendored BIP 458 reference code 2026-11-04 11:00:26 +09:00
Fabian Jahr 2106e90394 bip-0460: Add vendored secp256k1lab library 2026-11-04 11:00:25 +09:00