Algorand supports the concept of mulisignature accounts. All transactions from multisignature accounts must be signed by multiple keys. The number of required signatures will depend on how the multisignature account is set up. This tutorial covers creating a multisignature account, handling multiple signatures and submitting the transaction to 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 Multisignature Account
Before creating the new multisignature account you will have to add at least one additional account to one of the nodes from the default template. To do this see the creating a new account tutorial for information on how to do this action. You can see the accounts on the primary node by using the
goal account list -d ~/net1/Primary
To create the new multisignature account run the following command:
goal account multisig new [FirstAccount] [SecondAccount] -k 2 -d ~/net1/Primary
This command will create a multisignature account. Notice that when creating it, you need to specify a list of other accounts that are associated with this multisignature account. The threshold parameter specifies the number of signatures required to create a transaction from this new account. So in this example we associate it with two accounts and require both to sign in order to make a transaction.
If you use the
goal account list -d ~/net1/Primary command you will see the newly created account. Before creating a transaction from this new account we must first deposit some tokens into the account. Use the
goal clerk send command to do this from an account that has tokens in the private network.
goal clerk send -a 10000 -f [AccountWithTokens] -t [NewMultiSignatureAccount] -d ~/net1/Primary
This will deposit 10000 tokens into the new account.
Create a Transaction and Sign it
Now that the new multisignature account has tokens to we can use goal to write out an unsigned transaction from this account. To do this use the following goal command:
goal clerk send -a 5000 -f [NewMultiSignatureAccount] -t [AnyOtherAccount] -o ./Trans.tx -d ~/net1/Primary
This will write out the unsigned transaction to a file named Trans.tx. If you try to submit this to the private network it will fail. To sign it, this account requires two signatures. So each account must run the goal multisig sign command:
goal clerk multisig sign -t ./Trans.tx -a [FirstAccount] -d ~/net1/Primary goal clerk multisig sign -t ./Trans.tx -a [SecondAccount] -d ~/net1/Primary
Submit the Signed Transaction
Now that the signatures are completed you can either use the REST API or the
goal clerk rawsend command to submit the transaction.
goal clerk rawsend -f ./Trans.tx -d ~/net1/Primary
The transaction will be submitted and approved. Give the network a few seconds to process the transaction and you should be able to use the
goal account list command to see the change.
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