Solana CLI: Use an other Phantom address

960 Views Asked by At

I configured Solana CLI with a wallet address and now I want to change it.

I did the following steps in order to swap to the new Phantom address I want to use :

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

then I inserted my seed phrase and finally I got this output :

Recovered pubkey Bw...35h. Continue? (y/n): y
Wrote recovered keypair to ~/.config/solana/id.json

which is exactly the address I want to use ! But then when I check using solana address or solana-keygen pubkey I keep getting the old address :

solana-keygen pubkey
63...95x

solana address
63...95x

What am I missing ?

2

There are 2 best solutions below

0
On BEST ANSWER

Simple solution:

   solana config set -k ~/.config/solana/keypair.json 

Edit

0
On

You can always check for Solana's current configuration using:

solana config get

After that check and make sure that the keypair your solana-cli is currently pointing to is actually the keypair you want in this case it might be pointing to the old keypair file

In order to change this use

solana config set --keypair <path_to_your_keypair>

For example

solana config set --keypair ~/.config/solana/id.json

I hope this helps!