2
votes

I am running the solana-keygen tool and am confused about its output. I was under the impression that the pubkey output by the first command should be the same as the one re-created using the second command. But they are different. What does the first one represent?

C:\Users\MSHIRAZ>solana-keygen new --no-outfile
Generating a new keypair

For added security, enter a BIP39 passphrase

NOTE! This passphrase improves security of the recovery seed phrase NOT the
keypair file itself, which is stored as insecure plain text

BIP39 Passphrase (empty for none):

=========================================================================
pubkey: Gu3nU5cW7W8mZesDUhjaym8e1mbsyUBey8fvhgnq7nMM
=========================================================================
Save this seed phrase and your BIP39 passphrase to recover your new keypair:
motor rate october crawl visa family prison hair annual fault tilt animal
=========================================================================

C:\Users\MSHIRAZ>solana-keygen pubkey prompt://
[pubkey recovery] seed phrase:
[pubkey recovery] If this seed phrase has an associated passphrase, enter it now. Otherwise, press ENTER to continue:
ADarcoVBd5USiMpycBGrhforf2EHqUJTc4YyByC7A8xP

C:\Users\MSHIRAZ>solana-keygen verify ADarcoVBd5USiMpycBGrhforf2EHqUJTc4YyByC7A8xP prompt://
[pubkey recovery] seed phrase:
[pubkey recovery] If this seed phrase has an associated passphrase, enter it now. Otherwise, press ENTER to continue:
Verification for public key: ADarcoVBd5USiMpycBGrhforf2EHqUJTc4YyByC7A8xP: Success
1

1 Answers

1
votes

The pubkey printed on create is the raw ed25519 keypair pubkey, while solana-keygen pubkey prompt:// prints the pubkey at m/44'/501'. If you run solana-keygen pubkey ASK it should print the original pubkey

There is currently an open PR to update the CLI but for now you can do as described above.

https://github.com/solana-labs/solana/issues/17325#issuecomment-844317674