This tutorial works with a private network. Make sure to look at the private network tutorial for help with creating a private network.
Create the Private Network
See the creating private network tutorial for details on the network template.
goal network create -r ~/net1 -n private -t <path_to_template.json>
Start the Network
goal network start -r ~/net1
You can check that the status of the network is working by running the following command:
goal network status -r ~/net1
Create a New Account
Creating an account will create a new address and add it to the existing wallet that was created on the node when the network started. To create the account run the following goal command:
goal account new -d ~/net1/Primary
This will create an account on the Primary node in the private network. This command will also return the newly created account. You can list the accounts no the Primary node by running the following goal command:
goal account list -d ~/net1/Primary
If you used the template referenced in the private network tutorial this command will list out two accounts.
[online] L467TQNJX2XKQAV5RXWUTFDVQZNV544B6IKCIQ5YTGIFMIF5SADETSZYGM L467TQNJX2XKQAV5RXWUTFDVQZNV544B6IKCIQ5YTGIFMIF5SADETSZYGM 500000000000000 [offline] Unnamed-0 XSQBZKANPREDRAMKVH5DIGDWOKDSUVWYCUSVY3DDLVRLRSKRVF7G6AT5EI 0 *Default
Add a Participation Key
As covered in the protocol overview guide, in order for an account to participate in consensus an account must have a participation key. This key can be generated using the goal command line tool for the new account
goal account addpartkey -a [NewlyCreatedAccount] --roundFirstValid 100 --roundLastValid 3000 -d ~/net1/Primary
In addition to a participation key an account. needs to have funds (ie stake) and the account must be placed online. In this tutorial, we can simply use goal to send tokens from an account on the Primary node to the newly created account.
goal clerk send -a 1000 -f [ExistingAccount] -t [NewlyCreatedAccount] -d ~/net1/Primary
If you list the accounts again on the primary node the newly created account should now have 1000 tokens. Note that this may take a few seconds to be reflected as the block has to be approved in consensus and written to the blockchain. Finally, you can put the newly created account online by running:
goal account changeonlinestatus -a [NewlyCreatedAccount] -o true -d ~/net1/Primary
This will create a transaction and will go through consensus, like any other transaction. Once the transaction is approved and written to the blockchain, running
goal account list should show the account is online.
Shutdown and Delete the Private Network
In order to prevent multiple copies of the Algorand processes from running, you may want to shut down and delete the private network when you are finished testing. To do this run the following commands:
goal network stop -r ~/net1 goal network delete -r ~/net1