<p>I'm using the following tool to generate a HD wallet:
<a href="https://iancoleman.io/bip39/" rel="nofollow noreferrer">https://iancoleman.io/bip39/</a></p>

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

<p>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:</p>

<p><a href="https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/ecpair.js#L29" rel="nofollow noreferrer">https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/ecpair.js#L29</a></p>

<p>Thanks! </p>

CC BY-SA 4.0
2019-01-08T10:20:21.170Z
Are you trying to sign with the HD private keys you generated on the site?
James C.
CC BY-SA 4.0
2019-01-08T10:24:29.970Z
If so, you will need to extract the private key from the HD private keys (in Extended Key format), which are encoded like this: https://teachbitcoin.io/wallets.html#/9
James C.
CC BY-SA 4.0
2019-01-08T10:40:09.287Z
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
CC BY-SA 4.0
2019-01-08T10:50:42.083Z
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.
CC BY-SA 4.0
2019-01-08T11:20:48.980Z
"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
CC BY-SA 4.0
2019-01-08T11:21:45.763Z
I'm still not sure how to get to the hexadecimal string as used in: https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/ecpair.js#L29

I managed to find the bip32 site: http://bip32.org
timothyylim
CC BY-SA 4.0
2019-01-08T11:45:15.553Z
I wrote my question a bit differently here: https://bitcoin.stackexchange.com/questions/83477/deriving-hex-private-key-from-a-hd-wallet
timothyylim
<transactions><private-key><bitcoinjs>
How do you sign transactions from a HD wallet?
timothyylim
# How do you sign transactions from a HD wallet?

(Asked by: username_0 on 2019-01-08)

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!

**Tags:** transactions, private-key, bitcoinjs

> **Comments:**
> **username_1**: Are you trying to sign with the HD private keys you generated on the site?  
> **username_1**: If so, you will need to extract the private key from the HD private keys (in Extended Key format), which are encoded like this: https://teachbitcoin.io/wallets.html#/9  
> **username_0**: 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?  
> **username_1**: 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?  
> **username_0**: "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?  
> **username_0**: I'm still not sure how to get to the hexadecimal string as used in: https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/ecpair.js#L29  I managed to find the bip32 site: http://bip32.org  
> **username_0**: I wrote my question a bit differently here: https://bitcoin.stackexchange.com/questions/83477/deriving-hex-private-key-from-a-hd-wallet  

---

## 0 answers

