Jonas Nick
3d243d8a49
BIP 341: allow taproot_sign_key with no script tree
...
In contrast to taproot_output_script, taproot_sign_key was not able to deal with
a script_tree that is None. This commit fixes taproot_sign_key such that it can
sign for such outputs.
This commit avoids changing the behavior of the functions except
taproot_sign_key at the cost of having some code duplication. Alternatively, one
could let taproot_tree_helper deal with a None script_tree directly.
2023-01-04 14:31:44 +00:00
Jonas Nick
be340277fc
BIP 341: Fix taproot_tweak_pubkey
...
`lift_x` returns `None` if the input integer is not an X coordinate on the curve
to indicate failure. `point_add`, on the other hand, interprets `None` as the
point at infinity. Therefore, without this commit, if the internal `pubkey` is
not a valid X coordinate, the function will not fail, which contradicts the
specification in the "Script validation rules section". Instead, it sets `Q` to
`t*G`.
2022-10-24 20:33:05 +00:00
Jonas Nick
3998dbbc8a
BIP 340: fix function signature of lift_x in reference code
...
bip-0340.mediawiki defines lift_x as taking an integer argument. This commit
changes the argument of lift_x in the reference code to be identical to the
specification. Previously it took a byte array.
2022-08-23 10:07:32 +00:00
Jonas Nick
2119931f01
BIP 341: add missing conversion from bytes to int
2022-08-16 15:09:14 +00:00
Jonas Nick
0144413e91
bip-0340: clarify that lift_x fails with out-of-range inputs
...
Without this commit, it's not defined what happens if x is not in range 0..p-1.
However, lift_x may easily be called with out of range values. The reference
implementation of lift_x correctly returns failure in such cases.
2022-06-20 13:43:56 +00:00
Jonas Nick
255b5b67c0
BIP340: remove batch speedup graph and link to it instead
...
This avoids having to update the BIP with a fresh graph every time there's a
change to libsecp and suggests that the expected speedup depends on the specific
implementation.
2021-05-17 14:55:13 +00:00
Jonas Nick
43b5f171dc
BIP 341/342: Add link to Bitcoin Core test vectors
...
Also remove mention of non-existing examples.
2021-04-13 15:04:17 +00:00
Jonas Nick
e1def09d6d
BIP8: fix typo: 2 retarget intervals are 4032 blocks.
2021-03-22 12:57:36 +00:00
Jonas Nick
f5a3140f21
BIP8: remove redundant and conflicting sentence from param selection
...
At the end of the param selection section it's explicitly stated that
startheight _must_ be a multiple of 2016.
2021-03-22 12:56:59 +00:00
Jonas Nick
7e9b4dd620
BIP-0340: note that adapting the spec to other curves is insecure
2020-07-21 18:44:46 +00:00
Jonas Nick
2611302d83
BIP-0340: Remove last remaining mention of Jacobi symbol
...
Jacobi symbol can be confusing because it may suggest that the modulus is
composite.
Thanks to Alan Szepieniec for pointing out this issue.
2020-07-18 20:14:51 +00:00
Jonas Nick
804538f141
BIP-0340: small fixups
...
- key prefixing means prefixing the message
- array indexing starts with 0
- 'Gennaro' is spelled with two n's
- has_even_y definition takes P as argument
Thanks to Alan Szepieniec for pointing out these issues.
2020-07-18 20:14:36 +00:00
Jonas Nick
15fba98cf4
bip-341: add missing Post-History
2020-05-15 12:57:49 +00:00
Jonas Nick
dde165749e
bip-341: Commit to all scriptPubKeys in SigMsg
2020-05-15 12:33:01 +00:00
Jonas Nick
0916da6594
BIP-0341: Replace notion of is_negated with parity bit
2020-03-27 15:14:43 +00:00
Jonas Nick
4ea021f28c
BIP-0341: Avoid decompressing the output public key in script spends
2020-03-06 14:20:08 +00:00
Jonas Nick
9bfa53e9fb
BIP 340: Verify sig before returning it
2020-03-04 16:34:24 +00:00
Jonas Nick
b6b5f58e6e
BIP 340: Use synthetic nonces in reference code and test vectors
2020-03-04 16:34:24 +00:00
Jonas Nick
d41e778ca1
BIP 340: Update reference code and test vectors as follows:
...
- use evenness as tiebreaker
- using different tags for nonce- and challenge hashing
- add pubkey to nonce function.
2020-03-04 16:34:17 +00:00
Jonas Nick
ddc31eb6f6
BIP-340: Improve wording of recommendation for fresh secret keys
2020-02-23 19:33:13 -08:00
Jonas Nick
8b4f79b6f6
BIP-340: Stress that secret key should be fresh and if not then RFC6979 shouldn't be used
2020-02-23 19:33:13 -08:00
Jonas Nick
b4255dc83b
BIP 340: Recommend verifying the signing output
2020-01-28 22:04:39 +00:00
Jonas Nick
2874f1ffe7
BIP 340: Recommend synthetic nonces
2020-01-28 22:04:34 +00:00
Jonas Nick
d199b6dff6
Replace private key with secret key
2020-01-19 14:47:33 -08:00
Jonas Nick
66e2931de2
Clarify bip-taproot digest difference to bip143 regarding sub-hashes
2020-01-19 14:47:33 -08:00
Jonas Nick
1f5bdb304e
Improve clarity of footnotes for lift_x
2020-01-19 14:47:33 -08:00
Jonas Nick
708aeadf85
Replace references to Euler's criterion with Legendre symbol in bip-schnorr
2020-01-19 14:47:33 -08:00
Jonas Nick
5a25adc490
Fix bip-schnorr footnote 7 by specifying that we're referring to P's y coordinate and not some undefined 'x'
2020-01-19 14:47:33 -08:00
Jonas Nick
3e5a79af88
Rename is_y_square to is_negated in taproot signing
2020-01-19 14:47:33 -08:00
Jonas Nick
fe74ab65db
Update test-vectors.csv
2020-01-19 14:47:33 -08:00
Jonas Nick
c8281deec6
Fix point_from_bytes accepting out-of-range pubkeys and add test vector
2020-01-19 14:47:33 -08:00
Jonas Nick
c9196eeef4
Fix typo in reference code comment
2020-01-19 14:47:33 -08:00
Jonas Nick
301fef36de
Make more clear that signing function in test vectors generation code isn't intended to be used anywhere else
2020-01-19 14:47:33 -08:00
Jonas Nick
a6d2d42aa2
Check infinity in is_positive
2020-01-19 14:47:33 -08:00
Jonas Nick
82129e720d
Adjust test vector generation code to latest terminology
2020-01-19 14:47:33 -08:00
Jonas Nick
fdf6e897d9
Fix test vector generation code after changing schnorrsig_sign api
2020-01-19 14:47:33 -08:00
Jonas Nick
78bb31c3bf
Accept seckey in the form of bytes and not int in the reference BIP-schnorr code to match the spec.
2020-01-19 14:47:33 -08:00
Jonas Nick
d112f5b035
Replace taproot_tweak_pubkey assertion with exception and add it to taproot_tweak_seckey too
2020-01-19 14:47:33 -08:00
Jonas Nick
afa5519ade
Add taproot_tweak_pubkey and taproot_tweak_privkey functions to bip-taproot wallet section
2020-01-19 14:47:33 -08:00
Jonas Nick
e1d7da3796
Add is_quad function to bip-schnorr reference code
2020-01-19 14:47:33 -08:00
Jonas Nick
fe8f5f68ca
Standardize on secret key in bip-schnorr
2020-01-19 14:47:33 -08:00
Jonas Nick
05cc92b9ad
Add x() and y() functions for points to bip-schnorr
2020-01-19 14:47:33 -08:00
Jonas Nick
1c8bdd75a5
Remove 0xc1
2020-01-19 14:47:33 -08:00
Jonas Nick
65a4f1deb8
Mention SHA256 block size
...
Rebased by Pieter Wuille
2020-01-19 14:47:33 -08:00
Jonas Nick
a5112f9f01
Move plain public key in output rationale to design section
...
Rebased by Pieter Wuille
2020-01-19 14:47:33 -08:00
Jonas Nick
204b7f13a0
Prescribe that a taproot output key should always have a taproot commitment
2020-01-19 14:47:33 -08:00
Jonas Nick
8fd629c3f9
Fix privkey negation in taproot_sign_key
2020-01-19 14:47:33 -08:00
Jonas Nick
cc962bf84f
Address sipa's comments
2020-01-19 14:47:33 -08:00
Jonas Nick
c33c7d0a0c
Tag signature hashes, improve rationale and update test vectors
2020-01-19 14:47:33 -08:00
Jonas Nick
7f3611d239
Use a tagged hash in bip-schnorr nonce derivation
2020-01-19 14:47:33 -08:00
Jonas Nick
ba748dcd93
Use key path spend terminology more consistently in taproot/tapscript
2020-01-19 14:47:33 -08:00
Jonas Nick
16073d0c20
Clarify how to disable key path spending
2020-01-19 14:47:33 -08:00
Jonas Nick
f3bef4f459
Address sipa's feedback
2020-01-19 14:47:33 -08:00
Jonas Nick and Tim Ruffing
a67e5e323c
Update bip-schnorr/test-vectors.py
...
Co-Authored-By: Tim Ruffing <tim@timruffing.de >
2020-01-19 14:47:33 -08:00
Jonas Nick and Tim Ruffing
5da30bd568
Update bip-schnorr.mediawiki
...
Co-Authored-By: Tim Ruffing <tim@timruffing.de >
2020-01-19 14:47:33 -08:00
Jonas Nick
303ff5fb26
Address Tim's comments
2020-01-19 14:47:33 -08:00
Jonas Nick
08e1b3da74
Use short public keys for taproot output keys
2020-01-19 14:47:33 -08:00
Jonas Nick
e084aafb8b
Switch to 32 byte public keys in bip-schnorr
2020-01-19 14:47:33 -08:00
Jonas Nick
1a4b08ab72
Fix point_from_bytes in bip-schnorr reference implementation
2020-01-19 14:47:33 -08:00
Jonas Nick
b2e6d11a6e
Clarify diagram
2020-01-19 14:47:33 -08:00
Jonas Nick
eb96be7a9d
Clarify what 'reduced' means in tests and use word 'message' instead of 'message hash'
2020-01-19 14:47:33 -08:00
Jonas Nick
633cca9b1c
Replace private key with secret key
2019-12-13 13:25:16 +00:00
Jonas Nick
93e1921d83
Improve clarity of footnotes for lift_x
2019-12-04 20:21:52 +00:00
Jonas Nick
2c6b472e9c
Clarify bip-taproot digest difference to bip143 regarding sub-hashes
2019-11-29 16:32:44 +00:00
Jonas Nick
382a1d19a0
Replace references to Euler's criterion with Legendre symbol in bip-schnorr
2019-11-29 15:48:22 +00:00
Jonas Nick
3acb150829
Fix bip-schnorr footnote 7 by specifying that we're referring to P's y coordinate and not some undefined 'x'
2019-11-29 15:48:02 +00:00
Jonas Nick
9208857b92
Rename is_y_square to is_negated in taproot signing
2019-11-22 20:40:20 +00:00
Jonas Nick
8a8a35bfc5
Update test-vectors.csv
2019-11-05 10:14:23 +00:00
Jonas Nick
8e7aef083e
Fix point_from_bytes accepting out-of-range pubkeys and add test vector
2019-11-05 00:05:07 +00:00
Jonas Nick
0ec01e9255
Fix typo in reference code comment
2019-11-04 23:35:55 +00:00
Jonas Nick
35f1fface5
Make more clear that signing function in test vectors generation code isn't intended to be used anywhere else
2019-11-04 23:35:31 +00:00
Jonas Nick
c0f0c8d43d
Check infinity in is_positive
2019-11-04 23:35:24 +00:00
Jonas Nick
220df7da78
Adjust test vector generation code to latest terminology
2019-11-04 23:35:17 +00:00
Jonas Nick
854a33ab48
Fix test vector generation code after changing schnorrsig_sign api
2019-11-04 23:35:11 +00:00
Jonas Nick
a6e5c16821
Replace taproot_tweak_pubkey assertion with exception and add it to taproot_tweak_seckey too
2019-09-30 11:15:23 +00:00
Jonas Nick
398897cd29
Add taproot_tweak_pubkey and taproot_tweak_privkey functions to bip-taproot wallet section
2019-09-27 15:36:51 +00:00
Jonas Nick
1882aa7b8f
Add is_quad function to bip-schnorr reference code
2019-09-27 15:36:51 +00:00
Jonas Nick
5c52872fe0
Standardize on secret key in bip-schnorr
2019-09-27 15:36:51 +00:00
Jonas Nick
7e273fbda6
Add x() and y() functions for points to bip-schnorr
2019-09-27 15:36:51 +00:00
Jonas Nick
472911379c
Accept seckey in the form of bytes and not int in the reference BIP-schnorr code to match the spec.
2019-09-26 21:13:18 +00:00
Jonas Nick
479fe5f365
Remove 0xc1
2019-09-25 21:02:43 +00:00
Jonas Nick
87fa069b8f
Mention SHA256 block size
...
Rebased by Pieter Wuille
2019-09-11 17:43:11 -07:00
Jonas Nick
0995c8a5b5
Move plain public key in output rationale to design section
...
Rebased by Pieter Wuille
2019-09-10 16:03:25 -07:00
Jonas Nick
02bdf88ef9
Fix privkey negation in taproot_sign_key
2019-08-29 20:46:47 +00:00
Jonas Nick
dc6b91c1a9
Address sipa's comments
2019-08-27 15:13:08 +00:00
Jonas Nick
775cb2fd90
Tag signature hashes, improve rationale and update test vectors
2019-08-26 20:46:08 +00:00
Jonas Nick
7cd53f6eec
Use a tagged hash in bip-schnorr nonce derivation
2019-08-26 11:32:04 +00:00
Jonas Nick
ed0bb5b0c2
Prescribe that a taproot output key should always have a taproot commitment
2019-08-22 15:49:09 +00:00
Jonas Nick
16bdfcf534
Use key path spend terminology more consistently in taproot/tapscript
2019-08-22 11:41:04 +00:00
Jonas Nick
0d28b3c37b
Address sipa's feedback
2019-08-21 11:42:03 +00:00
Jonas Nick and Tim Ruffing
ae96228913
Update bip-schnorr/test-vectors.py
...
Co-Authored-By: Tim Ruffing <tim@timruffing.de >
2019-08-20 10:53:58 +00:00
Jonas Nick and Tim Ruffing
30fdc87599
Update bip-schnorr.mediawiki
...
Co-Authored-By: Tim Ruffing <tim@timruffing.de >
2019-08-20 10:53:51 +00:00
Jonas Nick
112d9c150a
Address Tim's comments
2019-08-19 14:37:55 +00:00
Jonas Nick
9795b7081a
Clarify how to disable key path spending
2019-08-18 15:52:46 +00:00
Jonas Nick
5793d3d735
Use short public keys for taproot output keys
2019-08-18 15:04:03 +00:00
Jonas Nick
ed01c1a776
Switch to 32 byte public keys in bip-schnorr
2019-08-18 15:04:03 +00:00
Jonas Nick
1faf705388
Fix point_from_bytes in bip-schnorr reference implementation
2019-08-18 15:04:03 +00:00
Jonas Nick
04b844540e
Clarify diagram
2019-05-10 13:57:12 +00:00
Jonas Nick
e9ea1710ef
Clarify what 'reduced' means in tests and use word 'message' instead of 'message hash'
2019-05-06 20:09:33 +00:00