0

Goal: generate a few millions addresses and remember or store the private keys of each of them in an easy manner.

Using the most straighforward approach, that is, storing all of the addresses as "address / private key", alhtough will work, won't be optimal for me.

Q: Will a seed, or mnemonic, phrase help with this?

Namely, if I lose some of the private keys, will I be able to deduce them from a seed phrase? And how, in terms of code?

2 Answers 2

1
ganache-cli -m "my seed phrase seedy seedo phrase phrase" -a 1000000. 

should work. The -a gives you that many accounts and the quotes after -m are you're seed phrase. Don't know if 1M is above the limit (almost certain it is), but you could always just do 10k and then have the same seed phrase but change the last word for each iteration(e.g. "one", then "two")

Note, no idea why you're doing this, but be careful obviously if you're storing funds in these. Definitely don't recommend custodying crypto for folks

5
  • That's only a part of an answer. ==> if I **lose** some of the private keys, will I be able to deduce them from a seed phrase? And **how**, in terms of code?
    – Amanarajo
    Commented May 16, 2022 at 14:11
  • the seed phrase maps to private keys. Just give that command a try. You'll get a whole list of private keys. If you just remember the seed phrase, you remember the keys
    – thefett
    Commented May 16, 2022 at 15:32
  • That hasn't answered my question. Once again: given a seed phrase and an address derived from it, and nothing else -- how would I get the private key of an address?
    – Amanarajo
    Commented May 16, 2022 at 19:21
  • did you run the command? It literally spits out private keys
    – thefett
    Commented May 17, 2022 at 12:38
  • 1) Are you able to read or not? The fact that "it splitls out private keys" doesn't help me 2) Where did I say that I myself run a node?
    – Amanarajo
    Commented May 17, 2022 at 13:42
0

You can store all your private keys if you want but you don't have to. You just need your address paths and seed/mnemonic. If you have a seed or mnemonic, you can re-create all the private keys by using paths (smth like this: m/44'/60'/0'/0/0) so the addresses at any time. Here how it works:

Seed/Mnemonics 

   ↳master key pair

      ↳child_1 key pair

         ↳child_12 key pair(desired depth)

            ↳child_12_1 key pair
            ↳child_12_2 key pair
            ↳child_12_3 key pair
            ↳child_12_n key pair

m/44'/60'/0'/0/0 here m stand for root key, 44 is for BIP44 standard, 60 is network identifier for ethereum and zeros are depth level. So your paths will be like this for your key pairs or addresses:

m/44'/60'/0'/0/0

m/44'/60'/0'/0/1

m/44'/60'/0'/0/2

...

If you have these paths with master seed, you can create any of your addresses easily with no worries of losing private keys.

I didn't test but this code example implemented with nodejs looks nice gist

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.