I have a HD private key which I have derived from my mnemonic using the ethers library. I would now like to derive child addresses and corresponding private keys from it.

Does anybody know how I can do this?

This is how I have obtained the HD private key:

const xKey = ethers.Wallet.fromMnemonic(...)

Thanks in advance!

2 Answers 2


ethers.Wallet.fromMnemonic is used to create the master private key out of they mnemonic, but for creating new pairs of public and private keys I think you should use this method with different passphrase for each pair:

const HDNode  = await ethers.utils.HDNode.fromMnemonic(YOUR_MNEMONIC, null, YOUR_PASSPHRASE);

When you check the new generated HDNode inside of it you can see it contains the same mnenomic you used for the master private key.

const derived = xKey.derivePath("m/44'/60'/0'/0/0");

You should use the derivePath function of the master key, specifying the path of the derived keys.

See more bip-32 and hdnode.

  • FYI to others, this is the typical way we generate derived keys. We can simply increase the index to get more keys. "m/44'/60'/0'/0/n" See github.com/ethereum/EIPs/issues/84 for more info.
    – valem
    May 26, 2020 at 23:16

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.