const mnemonic= 'clown shiver beach wheel this mixture emotion illness fatigue amateur talent bitter'

    const seed =   Buffer.from('408fb4ad29e82ae696c857795fa94c0aad444578effa428ddd1b969b35f96f298911c9b066a6dda3cc47ed85d903be61b67fe97895a8bc68d1a20ce014b7ae80', 'hex')

    const hdwallet= HDWallet.fromSeed(seed)
    var pubkey=hdwallet.derive(`m/44'/60'/0'/0/0`).getPublicKey().toString('hex');
    var privateKey=hdwallet.derive(`m/44'/60'/0'/0/0`).getPrivateKey().toString('hex');
    var address=`0x${hdwallet.derive(`m/44'/60'/0'/0/0`).getAddress().toString('hex')}`;

What am I missing? How to iterate derivation path to get new address every time?

1 Answer 1


Derivation path follows this convention:

m / purpose' / coin_type' / account' / change / address_index

So you can increase address_index from 0 to get new addresses from same mnemonic.

For more details: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki

  • yeah i know that but i don't want to do that manually every time Mar 29, 2019 at 6:12
  • i want to itearate index on every request by it self i am stuck in that Mar 29, 2019 at 6:13
  • That sounds like a good use for a backend database :-) Each time you call this routine, do an atomic table update to get the next index. Your index can have really large numbers so it should keep working for a long time. Jul 17, 2019 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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