🚧 This site is always under construction. 🚧

How to generate a keypair from a Phantom wallet with multiple addresses


I have a “secret recovery phrase” aka “seed phrase” from an address in my Phantom wallet; how can I generate a file system wallet / keypair in order to use it with Solana CLI?


Assuming you have installed Solana CLI, run the following command:

$ solana-keygen recover 'prompt:?key=0/0' --outfile ~/.config/solana/whateveryouwant.json

When using the prompt argument, the command will immediately ask you for the seed phrase. After entering it, it will show you the public key (the wallet address) and ask you to confirm before writing the file to wherever you specify with the --outfile option.

Huge thanks to Matt Mazur for writing a super helpful blog post about this 👆.

If you have multiple wallets in Phantom, you will need to change the number in the prompt: argument to recover different wallets. For example, prompt:?key=1/0 to get the next one. And prompt:?key=2/0 to get the one after that. For me, the order of those indexes was not the same as the list order in Phantom, so I had to try them one-by-one until I found the one I was looking for.

Huge thanks to @zicklag on the Solana forum for helping me figure out this last bit!