Creating An Algorand Wallet

Follow

Creating a new wallet

Wallets are collections of addresses and their corresponding keys. Every node can have one or more wallets, but each node only has one default wallet. When running goal account or clerk commands the default wallet will be used unless the -w option is used. This option allows commands to be executed for a specific wallet. You can also change the default wallet by using the goal wallet -f option. This tutorial walks through creating a wallet and adding an account to it.

Start the Network

You can list the accounts a node manages by running the following command:

goal account list -d ~/net1/Primary

Add a new Wallet

You can list the current wallets a node manages by running the following command:

goal wallet list -d ~/net1/Primary

Which should return output similar to the following text. 

##################################################
Wallet: unencrypted-default-wallet (default)
ID: 58575db964e9c84bacfe9aaefa6799d8
##################################################

This node only has the default wallet created when we created the private network. By default, this is unencrypted, which is not ideal.  

To create a new wallet run this command.

goal wallet new MyWallet -d ~/net1/Primary

This will create a wallet and you will be prompted to enter the password for the wallet. In addition, you will be given the option to retrieve the mnemonic/backup phrase should you ever need to recover the wallet.

Please choose a password for wallet 'MyWallet': 
Please confirm the password: 
Creating wallet...
Created wallet 'MyWallet'
Your new wallet has a backup phrase that can be used for recovery.
Keeping this backup phrase safe is extremely important.
Would you like to see it now? (Y/n): Y
Your backup phrase is printed below.
Keep this information safe -- never share it with anyone!

ankle symptom tenant estate acoustic swarm extend uphold rescue code must exhaust lyrics client skill tray stuff undo original atom stairs ten pole abandon uncle

If you ever need to recover the wallet you can specify that using the -r option with the goal wallet new command.

goal wallet new MyWallet -r -d ~/net1/Primary

If you list the wallets again you will see the newly created one.

##################################################
Wallet: MyWallet
ID: 8b916462b5b3f078f58a3feb6cd726bb
##################################################
Wallet: unencrypted-default-wallet (default)
ID: 58575db964e9c84bacfe9aaefa6799d8
##################################################

Set the Default Wallet

You can now set the default wallet with goal like:

goal wallet -f MyWallet -d ~/net1/Primary

Add an Account to the Wallet

You can use the goal account commands to list accounts in the new wallet. 

goal account list -d ~/net1/Primary

You should see this message “Did not find any account. Please import or create a new one.”
However, if you look at the unencrypted-default-wallet wallet you will see the account balance using the -w flag.

goal account list -d ~/net1/Primary -w unencrypted-default-wallet
[online]	YNG5HO2ICZBX43YO4WFC23R7SYUEIJRDUULECUC2BEIJOQFULNNL6JXFWM YNG5HO2ICZBX43YO4WFC23R7SYUEIJRDUULECUC2BEIJOQFULNNL6JXFWM	
5000020000000000 microAlgos

You can also use the goal account commands to add accounts in the new wallet. 

goal account new -d ~/net1/Primary
goal account list -d ~/net1/Primary

You can also specify the wallet when creating an account.

goal account new -w MyWallet -d ~/net1/Primary

You can list the accounts.

goal account list -d ~/net1/Primary

Your account list should look similar to this.


[offline] Unnamed-1	DZEP2GVN5HFPG3EBJ7R7DFHBGZGYQ7TEVMW5UVYB5O46XZS3ZVAQZ2F6SI 0 microAlgos
[offline] Unnamed-0 673GRF6NA7HRVWG4E5NIHOPCC4MBFDYZOUQ6KLYBPYWC34HTHVCX7FMZYM 0 microAlgos *Default

You can list the wallets.

goal wallet list -d ~/net1/Primary

Your wallet list should look similar to this.


##################################################
Wallet:	MyWallet (default)
ID:	8b916462b5b3f078f58a3feb6cd726bb
##################################################
Wallet:	unencrypted-default-wallet
ID:	58575db964e9c84bacfe9aaefa6799d8
##################################################
 
Reference article:
 
Note:  The wallet cannot connect to the Blockdaemon node with our auth token.  It works without the BD token and works with Algorand's API token
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.