0

If I have my 12 words (and passphrase) and I want to re-create the json file that represents the wallet, what are the steps to accomplish this?

Edit: The method I used to create the wallet is as follows:

solana-keygen new --outfile test_wallet.json

2
  • can you elaborate the source software that originally generated the seed phrase? it makes a difference as to how you recover
    – trent.sol
    Jul 26, 2022 at 18:24
  • @trent.sol - Thanks for having me clarify that. I am currently testing everything using either JSON RPC APIs and/or the various CLIs. I have edited my description above. Also, given the potential for ambiguity, it might be helpful to future visitors to include some background about why different wallets need different ways to recover. Just a thought... though that could get covered in a separate question.
    – OCDev
    Jul 27, 2022 at 13:25

3 Answers 3

2

@krishnna's answer is correct implicitly. The explicit command would be more like:

solana-keygen recover --outfile recovered-wallet.json ASK

The pertinent part being the addition of the ASK positional parameter, which tells solana-keygen recover to use raw ed25519 keypair derivation rather than bip32-ed25519/slip0010 as would be used for a wallet originating from something like a hardware or web wallet. The latter case is described here for those interested

1
  • Pending the typo fix per my edit, this answers exactly what I was asking. Thanks!
    – OCDev
    Aug 1, 2022 at 4:36
3

To restore the wallet for a given mnemonic if you have CLI installed you can use solana-keygen

solana-keygen recover

To know more - Solana Cookbook

1

Solana CLI also comes with a tool to 'recover' a wallet to a keypair with your mnemonic seed phrase.

solana-keygen recover 'prompt:?key=0/0' --outfile keypair.json

If you have multiple accounts in your Phantom wallet, you increment the first number after ?key=

For example, 0/0 will target the first wallet, 1/0 will target the second, and so on.

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.