Bitcoin Forum
July 27, 2024, 12:45:38 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to sign taroot's psbt data with bitcoinjs  (Read 42 times)
DanielAThompson27@gmail.c (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
July 23, 2024, 01:17:59 AM
 #1

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?
DanielAThompson27@gmail.c (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
July 23, 2024, 03:27:00 AM
 #2

Thanks, it's solved
OcTradism
Hero Member
*****
Offline Offline

Activity: 1820
Merit: 833



View Profile WWW
July 23, 2024, 04:49:25 AM
 #3

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

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits.
..........UNLEASH..........
THE ULTIMATE
GAMING EXPERIENCE
DUELBITS
FANTASY
SPORTS
████▄▄█████▄▄
░▄████
███████████▄
▐███
███████████████▄
███
████████████████
███
████████████████▌
███
██████████████████
████████████████▀▀▀
███████████████▌
███████████████▌
████████████████
████████████████
████████████████
████▀▀███████▀▀
.
▬▬
VS
▬▬
████▄▄▄█████▄▄▄
░▄████████████████▄
▐██████████████████▄
████████████████████
████████████████████▌
█████████████████████
███████████████████
███████████████▌
███████████████▌
████████████████
████████████████
████████████████
████▀▀███████▀▀
/// PLAY FOR  FREE  ///
WIN FOR REAL
..PLAY NOW..
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!