1

I'm trying to figure out how to get my pubkey that is the default account for my file system wallet. I know where the json file is located (i.e. ~/.config/solana/id.json) and of course I looked into it. It's just an array of numbers, I can probably figure out what base the file is in and convert it to get my pub and private keys, but there has to be some kind of built in solana cli command to do this. Can anyone help?

3 Answers3

1

The solana cli usage reference said that both

solana address

and

solana-keygen pubkey

can be used to get the pubkey.

By default, it get the pubkey from the private key stored in ~/.config/solana/id.json

Yuchen
  • 81
  • 5
0

Ok, I was using the wrong cli tool. I thought it was in "solana-keygen" but the command was:

    solana address
0

if you want to get the pubkey of a keypair in a file you can also use the following command:

solana-keygen pubkey file.json
oraodev
  • 51
  • 3