was experimenting with the solana cli i used solana-keygen new
command to generate a new keypair then imported the seedn phrase into my phantom but the public address displayed while in the cli is different to the public address on phantom. Any idea why this happens??
2 Answers
I think i have figured out the problem i will try to explain as i understood it this has something to do with Solana CLI using a slightly different derivation path for generating keypairs to what wallets typically use. The Solana CLI uses the path m/44'/501' to generate a single "root key". This root key can then be used to derive further child keys for specific purposes.
On the other hand, most Solana wallets use the path m/44'/501'/0'/0'. This path generates a specific child key from the root key, providing a direct path to a usable keypair.
So when creating a keypair from CLI be sure to define the derivation path using the solana-keygen new --no-outfile --derivation-path
command
A seed phrase can point to multiple addresses.
To get the address you generated from the CLI import the private key via Phantom.
The SK is stored as a byte array in ~/.config/solana/id.json
(Linux)