0

I'm using solana/web3.js

This derivation phrase is used by TrustWallet

m/44'/501'/0'

How would I generate a 100 wallets? One would have thought I could add a counter to it:

m/44'/501'/0'/0
m/44'/501'/0'/1
m/44'/501'/0'/2
....
m/44'/501'/0'/99

But this would throw an exception "invalid derivation path".

How could it possibly be invalid? Can't it be anything whatsoever? As long as it's in this format -- m/44'/{a}'/{b}'/{c}/....../{x}.

Then what derivation path would one use to generate a 100 wallets by iteration?

2
  • This might sound silly, but can you add the trailing ' to make it m/44'/501'/0'/0' instead of m/44'/501'/0'/0?
    – Jon C
    Sep 14, 2023 at 11:23
  • Would not be the article like this bringing the answer? moviendo.me/…
    – chalda
    Sep 19, 2023 at 8:22

1 Answer 1

0

Is there a specific reason you're interested in setting the derivation path?

With solana/web3.js you can use the Keypair object to create new keypairs (wallets)

import {Keypair} from '@solana/web3.js'
let wallets = []
for (var i=0;i<100;i++)
    wallets.push(new Keypair.generate())

3
  • how would you then restore a KeyPair if you happen to lose access to its private key?
    – Camila326
    Sep 16, 2023 at 14:31
  • Is there a specific reason you're interested in setting the derivation path? - yes.
    – Camila326
    Sep 16, 2023 at 14:32
  • how would you then restore a KeyPair if you happen to lose access to its private key? You dont, you need the seed or the private key, to restore.
    – banana
    Sep 18, 2023 at 14:57

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.