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

It’s straightforward to generate a file system wallet form a seed phrase:

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

But Phantom only has ONE seed phrase even if you have multiple wallets. When I use the command above, it generates a keypair for the first wallet in Phantom, but it’s not the one I’m trying to recover.

How do I create a file system wallet / keypair in this situation?

Hey @emersonthis you can get the next account in the phantom wallet by incrementing the first number after the key= in the command you give above, like this:

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

Just keep adding to that number to get the next keys in a row!

@zicklag This is EXACTLY what I needed! Thank you so much!

I’ve been digging for days and haven’t been able to find any documentation on the prompt: argument. Is that documented somewhere?

Interesting side note: For me the correct index was not the same as order of appearance in my Phantom wallet. As mentioned above, I had to test one-by-one until I found the right one.

1 Like

Awesome! I’m so glad it helped!

Kind of

The topic is somewhat covered in the docs in Hierarchical Derivation, but the real information is actually in the BIP32 and BIP44, which are full-blown specifications of how the key derivation process works, not friendly guides of how things work in Solana.

It took me a while to comb through those when another user ran into confusion with the topic, and now I finally understand how it works, but there wasn’t an great guide on it.

I also went over it in a bit more detail in this thread on the forum.

Oh, that is interesting. I don’t know why that would be, but at least you got it!

1 Like