How can I export my Anchor's private key in order to import it on Phantom.
solana config get
Displays a Keypair Path
but I'm not sure how to turn the byte array within into my private key.
Solana Stack Exchange is a question and answer site for Solana software users and developers. It only takes a minute to sign up.
Sign up to join this communityPhantom accetps the array as a Private key.
Just copy the contents of the id.json
and paste it in the import private key in Phantom.
Found on the deep coffins of reddit:
That id.json
file on the Keypair Path
indeed holds your private key.
To export it, the following terminal commands suffices:
cat <Keypair file path>
# copy the result and:
python -c "print(bytes(<paste the array here>).hex())"
Now in phantom, click on your account icon, browse into your accounts
, select the import private key
option and paste the result from the python command there.
Finally, to verify everything went as planned, switch to the devnet
within phantom, run:
solana airdrop 1
# or
solana airdrop 1 <your public key> --url devnet
And check the transaction on your phantom wallet.