Recreate keyfile from seed not working from command line

Please help with this issue

I want to test that I can recreate a keyfile using a seed phrase, using the Solana command line, but I get different results

This is what I do …

P.S the keys and seeds listed here are throwaway ones. I dont care about them.
I know that you should not share your seed phrase

=================================================================

1) create the keyfile

C:>solana-keygen new
Generating a new keypair

For added security, enter a BIP39 passphrase

NOTE! This passphrase improves security of the recovery seed phrase NOT the
keypair file itself, which is stored as insecure plain text

BIP39 Passphrase (empty for none):

Wrote new keypair to C:\Users\Admin.config\solana\id.json

pubkey: 3gTiVmwV4uXTpnKTaEC5RXY7ra8gpnuNQ4MG7XUy7Qng

Save this seed phrase and your BIP39 passphrase to recover your new keypair:
matrix gather hotel old quick family adapt live magnet hurry limit awesome

Looks good so far. The public key (wallet) and seed phrase are listed above
Lets try to recreate the keyfile using the same seed phrase and verify that public key / wallet matches the pubkey above

C:>rem delete the keyfile

C:>del C:\Users\Admin.config\solana\id.json

C:>rem create keyfile using the seed (from above)

C:>solana-keygen pubkey prompt://
[pubkey recovery] seed phrase:
[pubkey recovery] If this seed phrase has an associated passphrase, enter it now. Otherwise, press ENTER to continue:

<at this point I enter the seed phrase from above, then press ENTER>

Then this is displayed …

J4uPfcP3JVqzqE6EXP6ajhHyPt1yqcJRqSsihsF1Vhph

I was expecting to see the same public key that was listed above, but it is different

Maybe I am getting confused with public and private keys

Please assist with showing me how I can recreate a keyfile based on the seed phrase

Thank you

1 Like

Hi @OzJedi and welcome to the forum! :wave:

This is one of the most confusing things for beginners in Solana, and it’s not your fault. The docs and CLI don’t make the process very clear.

If you want to recover the original private key from the seed phrase you run:

solana-keygen recover ASK

They key point is that specifying ASK instead of prompt:// will return the keypair that was displayed when you first ran solana-keygen new.

Without going into detail, ASK means “give me the ‘master’ keypair for this seed phrase”. The prompt:// says “give me the default Solana CLI derived keypair for this seed phrase”.

You can derive a nearly unlimited amount of different keypairs from one seed phrase.

See this post for more info: