0

This question already has an answer here:

I'm using the following tool to generate a HD wallet: https://iancoleman.io/bip39/

However, it gives quite a few different private keys and I'm not sure which one is used to sign transactions with.

I'm using the bitcoinjs-lib to create an EC pair but I'm not sure how to go from the private keys generated to a hexidecimal string:

https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/ecpair.js#L29

Thanks!

marked as duplicate by JBaczuk, Community Jan 9 at 7:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Are you trying to sign with the HD private keys you generated on the site? – James C. Jan 8 at 10:20
  • If so, you will need to extract the private key from the HD private keys (in Extended Key format), which are encoded like this: teachbitcoin.io/wallets.html#/9 – James C. Jan 8 at 10:24
  • Yes, thanks that's a great resource! I'll look into extracting the private key from the extended key format. Do I extract from the account extended key or the BIP32 one? – timothyylim Jan 8 at 10:40
  • Extended keys are described in BIP32, and which private key u need to sign with depends on the output. In addition to priv/pubkey, extended keys simply contain the chaincode information required to derive further children. There is a master extended key pair from which all children are derived. The account key I presume u mean the parent of all child keys in that acct, such as m/44’/0’/0’/0? – James C. Jan 8 at 10:50
  • "which private key u need to sign with depends on the output" -> I assume it is because you need to sign with the specific private key that generates the address that the input is coming from? – timothyylim Jan 8 at 11:20