Closed nbass closed 4 years ago
Your code doesn't have txn
anywhere. How did you get it?
I converted this in the following way:
function toHexString(byteArray) {
return Array.prototype.map.call(byteArray, function (byte) {
return ('0' + (byte & 0xFF).toString(16)).slice(-2);
}).join('');
}
...
tx.signInput(0, keyPair);
const txn = this.toHexString(tx.data.getTransaction(), 'hex');
The reason I didn't do tx.toBase64()
is because the second signer asked me to change this into hex
and send it
Second signer is looking forward to the following:
0100000001e77457975db0320623c097096216374a5abc79f75e20eb6b193234c86f3275de0100000092000047304402201c8eec772929d6c516bddc8fc2457b032440aafc874aacf2202926e75f232c2f02205bb5c79e1cb50e02c6daf01b7b46252ff653b30c40d6dfd24c296f186b3923fe0147522102719b2a6857356abd3fa4db602b11713e0a3727b579622341d18def72320779b8210399c60f9e91f5a67995de7ded11e8207712022fee91949c2cf9957a4aff8adf0752aeffffffff01e8030000000000001976a9144d1606a1397e8873cf6b936219fc426757ae36a888ac00000000
But my hex is following:
0200000001e77457975db0320623c097096216374a5abc79f75e20eb6b193234c86f3275de0100000000ffffffff01e8030000000000001976a9144d1606a1397e8873cf6b936219fc426757ae36a888ac00000000
psbt.data.getTransaction()
is an internal method that should only be called from inside of the Psbt class.
psbt.extractTransaction()
is the only way to get a Transaction out of Psbt.
Use psbt.toHex()
or psbt.toBase64()
and have the second signer use Psbt.fromHex()
or Psbt.fromBase64()
to recreate the Psbt for signing.
My second signer is using c#, so they can't use bitcoinjs-lib. Is there any other way? Thanks for the answer, though! You have been a great help
NBitcoin (C#) supports Psbt.
It is a widely used standard.
Thank you! We follow your help, this will probably be solved.
My code:
And, my txn.ins[0]:
I wonder why the scriptSig is empty. Even without this, is this txn still valid? I'm little confused...