1
0
Fork 0
mirror of https://github.com/bitcoin/bips.git synced 2025-03-04 11:08:05 +01:00

BIP341: add bip340_aux_rand argument to taproot_sign_key

This commit is contained in:
Darius Parvin 2022-10-09 14:36:32 -07:00
parent 6545b81022
commit e24f685971

View file

@ -245,10 +245,10 @@ TapTweak = tagged_hash("TapTweak", p + ABCDE)
'''Spending using the key path''' A Taproot output can be spent with the secret key corresponding to the <code>internal_pubkey</code>. To do so, a witness stack consists of a single element: a [[bip-0340.mediawiki|BIP340]] signature on the signature hash as defined above, with the secret key tweaked by the same <code>h</code> as in the above snippet. See the code below:
<source lang="python">
def taproot_sign_key(script_tree, internal_seckey, hash_type):
def taproot_sign_key(script_tree, internal_seckey, hash_type, bip340_aux_rand):
_, h = taproot_tree_helper(script_tree)
output_seckey = taproot_tweak_seckey(internal_seckey, h)
sig = schnorr_sign(sighash(hash_type), output_seckey)
sig = schnorr_sign(sighash(hash_type), output_seckey, bip340_aux_rand)
if hash_type != 0:
sig += bytes([hash_type])
return [sig]