0

This question is not about how to recover, but how does metamask recover my 2nd account?

my setup:

windows 10
latest chrome browser
latest metamask plugin
goerli testnet

I had set up a metamask wallet with 2 accounts on computer A. I got

   paraphrase
   Account 1
   Account 2

Both accounts had ETH balances.

Now I wanted to make them accessible from computer B.

On computer B,

1. I installed metamask plugin into my browser. 
2. I used the paraphrase (got from computer A) to restore my wallet in metamask.
3. this restored my Account 1.
4. To restore "Account 2", I clicked "Create Account", and typed "Account 2" as name. 
5. This didn't create a new account, 
6. but actually restored my "Account 2" from computer A, and I saw my ETH balance.

How did this work? or where metamask stored or retrieved "Account 2" information?

1 Answer 1

1

The mnemonic phrases are specified in bip-39

This BIP describes the implementation of a mnemonic code or mnemonic sentence -- a group of easy to remember words -- for the generation of deterministic wallets.

It means you can generate the accounts 0,1,2,3,... (the private keys) from the paraphrase always the same.

The derivation path is used to generate the private key:

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

For Ethereum, the values are predefined - except for the address_index - which is the account number, and look like this (account 0)

m/44’/60’/0’/0

So to generate any account 0,1,... for the mnemonic it would be with ethers library:

ethers.Wallet.fromMnemonic(myMnemonic, `m/44'/60'/0'/${accountNumber}`);
2
  • thank you for your post. I understood that paraphrase is mapped to private key, but I thought it is only for Account 1. Do you mean Account 2's private key is also mapped to the same paraphrase? Then are the public addresses of the two accounts derived from the same paraphrase?
    – oldpride
    Feb 13 at 6:20
  • 1
    @oldpride Yes, they are derived from the same paraphrase, but it is impossible to generate the address1, nor key1, just by knowing the address2 and key2. Also if have address1 and address2 - you won't know, they are derived from the same mnemonic
    – tenbits
    Feb 23 at 12:07

Your Answer

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

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