I’ve seen many questions being raised about tweaking the public key for Taproot, but I was able to do that while using a rusty Bitcoin box (see below):
let secp = Secp256k1::new();
let private_key = PrivateKey::from_wif(private_key_wif).expect("Invalid private key");
let public_key = private_key.public_key(&secp);
let mut original_pubkey_bytes = public_key.to_bytes();
original_pubkey_bytes.remove(0);
let tap_tweak_hash = TapTweakHash::from_key_and_tweak(UntweakedPublicKey::from_slice(&original_pubkey_bytes)?, None);
let tweaked_pub_key = XOnlyPublicKey::from_slice(&original_pubkey_bytes)?.add_tweak(&secp, &tap_tweak_hash.to_scalar())?;
But how do you adjust the private key using Bitcoin Last Crate? I was unable to find a suitable module or structure for this because it is required for the keypass spending method.
Discover more from Earlybirds Invest
Subscribe to get the latest posts sent to your email.