0

Due to secruity reasons, unavailablity of private keys on my end and as per project requirements I need to build back end apis where I will provide a PSBT raw transaction hex (having multiple inputs) to front end, On front end, user will add their mnemonics and will sign all the psbt inputs individually, once all inputs are signed then a final signed raw tx hex get created.

Upon receiving signed hex I will broadcast it to the btc node and return the txid to the front end.

I am unable to find any way to sign psbt raw transaction inputs ( which is generated from btc node ) using "bitcoinjs-lib".

Could anyone please suggest how can I achieve this.

Regards, Giri

0

PSBT class in bitcoinjs: https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/psbt.js

Example:

https://github.com/bitcoinjs/bitcoinjs-lib/blob/533d6c2e6d0aa4111f7948b1c12003cf6ef83137/test/integration/transactions.spec.ts#L19

https://github.com/bitcoinjs/bitcoinjs-lib/blob/533d6c2e6d0aa4111f7948b1c12003cf6ef83137/test/integration/transactions.spec.ts#L61

2
  • Thanks for your input @Prayank, but I need to use raw transaction which have mulitple inputs and sign each input, But the links you have shared above doing opposite i.e. generating signed raw hex by using multiple inputs. – Surinder kumar Nov 16 '20 at 7:29
  • Maybe I misunderstood the issue. You can also create an issue in the GitHub repository as well. This issue looks similar: github.com/bitcoinjs/bitcoinjs-lib/issues/1620 – Prayank Nov 16 '20 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.