Looking for JS/Node.js code example to sign a transaction (with multiple UTXOs) with only the extended private key

0

Is there any Javascript code out there or examples on how to sign a transaction by using the extended-private-key?

What I am essentially looking for is code that will help derive the private key, that I can then use to sign an individual UTXO with.

Thanks in advance!

Prem Govind

Posted 2018-08-09T20:54:36.757

Reputation: 93

Answers

0

For anyone that might be interested in this, there is a great BIP32 library from the same people who created the bitcoinjs-lib and it has the tools to derive your private keys from the extended master-private-key.

const t = bip32.fromBase58(extPrivateKey, zenCashNetwork);

const derivedIndex = `${utxo.AddrType}/${utxo.AddrIndex}`;

const wifKey = t.derivePath(derivedIndex).toWIF();

In our case, we needed this to sign a ZenCash transaction

Prem Govind

Posted 2018-08-09T20:54:36.757

Reputation: 93