Post
Topic
Board Development & Technical Discussion
Re: Need help reversing bitcoinutils "tagged_hash" to generate Taproot addresses
by
BTCW
on 16/01/2024, 16:41:35 UTC
Code:
hashlib.sha256(bytes.fromhex('e80fe1639c9ca050e3af1b39c143c63e429cbceb15d940fbb5c5a1f4af57c5e9' + 'e80fe1639c9ca050e3af1b39c143c63e429cbceb15d940fbb5c5a1f4af57c5e9' + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798')).hexdigest()

does not give

Code:
da4710964f7852695de2da025290e24af6d8c281de5a0b902b7135fd9fd74d21
It's not supposed to give 0xda47... because that is your tweaked public key. You need to compute the hash above multiplied by generator point to get a new point (pubkey) and then add that to your original public key to get 0xda47...

Code:
t = SHA256(SHA256("TapTweak") | SHA256("TapTweak") | pub_bytes)
pub_tweak = pub + (t * G).
Convert the hash bytes to t in big endian order.
t*G is EC point multiplication (just like you'd get pubkey from a private key)
+ is EC point addition.

So, in Python?