Author

Topic: How to sign taroot's psbt data with bitcoinjs (Read 59 times)

hero member
Activity: 1722
Merit: 801
If your username represents your actual email address, it will be target of many spam PMs include scam, phishing emails. You did choose a bad username that breaks your privacy and security of not only that email but also many accounts related to that email address.

Forum account: security, privacy, and recovery
newbie
Activity: 0
Merit: 0
Thanks, it's solved
newbie
Activity: 0
Merit: 0
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?
Jump to: