|
July 23, 2024, 01:17:59 AM |
|
const psbtdata = bitcoin.Psbt.fromBase64('cHNidP8BAP0zAQIAAAACe6hpGYbsE3F7nF5M5sPIj63hB+/Gk6OX365hkOlzWbEFAAAAAP////+MKZJFhWtwxzSpGnelRzB3q5D533ymThr75ko15gR+DAIAAAAA/////wYQJwAAAAAAABYAFBDmp2yebwctpktA/wnQFed0rNPoIgIAAAAAAAAiUSCe9a8LWuYH0DuOroeU42lXZihRkaPfY+MOpiQ7pvNeZyICAAAAAAAAFgAUEOanbJ5vBy2mS0D/CdAV53Ss0+gAAAAAAAAAABtqXRgAxp2sATKXve/8ywEBAAC2oMfDrqjmCQIiAgAAAAAAABYAFJ61NjgWMz/tfd9RG+jnPL+QqC/n4OQOAAAAAAAiUSAJlh2k2v6/FWVALlQfWILFJF3Bnv+MZr2QwLrZGlgcGQAAAAAAAQErkhMPAAAAAAAiUSCe9a8LWuYH0DuOroeU42lXZihRkaPfY+MOpiQ7pvNeZwEDBIEAAAABFyDC0FkGA1Hx240xdRZ6pmmIJPJy9y+75j4whodc+MBP3QABAR8iAgAAAAAAABYAFBDmp2yebwctpktA/wnQFed0rNPoAQMEgQAAAAAAAAAAAAA='); const network = bitcoin.networks.testnet; const keyPair = ECPair.fromPrivateKey(Buffer.from('01da42c71e332f13aea72eef9c947ded5fc022124049f62e7d99656dd67176b7', 'hex'), { network: network }); const tweakedChildNode1 = child.tweak( bitcoin.crypto.taggedHash("TapTweak", internalPubkey) ); psbtdata.signInput(0, tweakedChildNode1,0);
psbtdata.finalizeAllInputs();
const signedTransaction = psbtdata.extractTransaction().toHex();
console.log("Signed Transaction:", signedTransaction);
This is my code, but there are always errors in the signature. I want to sign the psbt data of taroot. What is the problem?
|