Here's how to obtain a Solana account from a seed phrase.
Before we get into the actual commands, I'll clarify a few concepts.
solana-keygentool, it is possible to generate new seed phrases as well as derive a keypair from an existing seed phrase and (optional) passphrase1
This is what a 12-word Solana seed phrase looks like.
wish fatal benefit theory scheme burger scale guess switch chair cotton luggage
And this is what one of its corresponding accounts looks like. Specifically, I'm showing the seed phrase with an empty passphrase, which is not recommended as a good passphrase adds one more layer of security to your account.
As stated above, Solana provides the
solana-keygen command-line interface to derive keypairs from existing seed phrases and (optional) passphrases. This can be done with the
solana-keygen pubkey ASK
You should then obtain a Solana account that you can look at in Solana's explorer.
Let's create a new keypair—seed phrase and passphrase—and then derive it with
solana-keygen new command will save the key at
~/config/solana/id.json. You can use the
--no-outfile to only outputting your key on screen.
solana-keygen new --no-outfile
When prompted for a passphrase (twice), I used the following string.
# 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): # Enter same passphrase again: # # ============================================================================ # pubkey: 4WXWzSAzPWLs7M5vMGzcZP3puKQGTCVyWXtYEQaJKP1a # ============================================================================ # Save this seed phrase and your BIP39 passphrase to recover your new keypair: # decade can extra easy copy talk monkey meat buddy crash glue lift # ============================================================================
Here, the account is
4WXWzSAzPWLs7M5vMGzcZP3puKQGTCVyWXtYEQaJKP1a, which can be browsed in Solana's explorer.
If you omit the
solana-keygen will save your key pair as a JSON array at
~/config/solana/id.json in the format shown below. You can also specify the
-o flat to provide a custom path for the JSON key pairs to be saved.
solana-keygen new -o ~/Desktop/keypair.json
// keypair.json [49,21,188,192,1,119,112,63,145,159,153,136,201,251,34,120,155,24,35,79,187,18,54,109,196,59,155,28,32,45,35,190,132,136,69,221,208,223,184,50,3,123,157,23,248,183,98,232,226,66,205,114,148,137,240,157,79,214,127,224,101,118,159,65]
We've created the
4WXWzSAzPWLs7M5vMGzcZP3puKQGTCVyWXtYEQaJKP1a account, and we have its seed phrase and passphrase. If we move to a new machine or somehow lost our keys, here's how to recover (or derive) them.
solana-keygen pubkey ASK # Feed seed phrase when prompted decade can extra easy copy talk monkey meat buddy crash glue lift # Feed passphrase when prompted SomeSafeP4ssw0rdHere@97vmJ!9!7721 # Derived account 4WXWzSAzPWLs7M5vMGzcZP3puKQGTCVyWXtYEQaJKP1a
For more information, Read Solana's Paper Wallet documentation.
In case you want to send a token of appreciation my way, here's my Solana address. =)