0

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.

2 Answers 2

1

Phantom 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.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.