The open-source, command-line tools inspect the Algorand blockchain, and also compose, sign, and submit transactions to Algorand. See https://www.algorand.com/.
go get src.d10.dev/algo/cmd/...
Algo tools require an
algod node. Set up the node first, then put the
connection details into file
$HOME/.config/algo/algo.cfg. For example if
Algorand has provided you a token to use with the "hackathon" testnet node,
the file looks like this:
[algod] address = http://hackathon.algodev.network:9100 token = _PASTE_TOKEN_HERE_
Here's a description of how to send algos from one account to another.
First, create two accounts:
algo-key generate -count=2
algo-key generate operation saves secret key information to two files
named ADDRESS.algo-key. These contain private key information, so do not
share them with anyone. Don't move or rename the files, as
find them by address when signing later in the tutorial.
Next, create a paper backup of the private key information:
algo-key backup -nick DEMO *.algo-key
This command runs interactively, you will be prompted on the command line.
When shown the secret mnemonic, write it down and store the copy securely.
(Optionally, skip writing down the mnemonic for testnet accounts; however,
algo-key backup because doing so create additional configuration
The "-nick DEMO" argument gives the new accounts nicknames. This will make
them easy to refer to. In this example, two configuration files "DEMO-1.cfg"
and "DEMO-2.cfg" should be created by
algo-key backup. These configuration
files include newly created public addresses. The ".cfg" files are not
secrets, the ".algo-key" files are secrets.
Next, move the address configuration files where
algo can find them:
mv *.cfg $HOME/.config/algo/
Check the balances on these accounts. They are brand new, you will see zero algos.
algo account DEMO-1 DEMO-2
Note that the "-v" flag makes
algo more verbose. Try:
algo -v account DEMO-1
to see the entire address of the account with nicknam "DEMO-1". Copy the full address. If using testnet, visit the Algorand testnet faucet. Paste the address there to receive testnet algos.
At this point, you should have a balance of algos in DEMO-1 account. The remainder of this tutorial constructs a payment to send ten algos from DEMO-1 to DEMO-2.
algo payment to compose a pay transaction:
algo -as DEMO-1 payment DEMO-2 10
Note that "-as ADDRESS" is a flag on the
algo command that specifies which
account must sign the transaction. In the case of payment, it is the
originating account. The next argument,
payment, is the "operation" of the
algo command; in this case, construct a payment transaction. The final
arguments specify the beneficiary "DEMO-2" and the amount, 10 algos.
The output of
algo payment is a JSON-encoded transaction. The details are
not important, but if you're curious, you can inspect the output and see the
amount field (note that it is micro-algos), the transaction fee, and all the
other details. Address are encoded differently in the JSON, so don't be
surprised not to see the full address of DEMO-1 or DEMO-2.
algo payment composed a transaction but did nothing else. To
complete the payment, we must sign and submit the transaction. In Algo
tools, the compose, sign, and submit steps are three distinct operations.
This allows signing to be isolated to a secure environment. For convenience
though, the three steps can be "pipelined" together, and that's what we'll
algo -as DEMO-1 payment DEMO-2 10 | algo-key sign | algo submit
The above pipeline composes a transaction, exactly as before. The
JSON-encoded transaction is sent to
algo-key sign, which adds a signature.
To do so,
algo-key must find the ".algo-key" file that was created
earlier. Finally the transaction with signature is sent to
which broadcasts the transaciton to our
algod node, and from there to the
Lastly, check that our account balances have changed. You should see that DEMO-2 now has a positive balance:
algo account DEMO-1 DEMO-2
algo can compose other transaction types, which can be signed
and submitting as described above. See
algo -h for a description of all
Configure an Algorand Standard Asset. See https://developer.algorand.org/docs/asa
Creates an Algorand Standard Asset. See https://developer.algorand.org/docs/asa
pay transaction, to send Algos from one account to another.
Submit one (or more) signed transactions.
Optional arguments are files containing JSON-encoded signed transactions
If no arguments,
algo submit expects JSON-encoded signed transaction(s) on
algo-key [FLAGS...] OPERATION [OPFLAGS...]
generate operation creates a new keypair. The public address and
private mnemonic are saved to the a file. The file saved is named after
the public address: "ADDRESS.algo-key".
Creates multisign addresses for Algorand.
A multisign address is produced by combining several Algorand addresses.
This operation expects a list of addresses on stdin. If you have multiple
address in .cfg files, as produced by
algo-key backup, you can generate a
multisign address with:
grep "address" *.cfg | algo-key genmulti -m 2 -n 3
(algo-key will use a regexp to parse addresses from the results of
Signs Algorand transaction(s).
Optional arguments are files, containing JSON-encoded transactions to sign.
If no arguments, JSON-encoded transactions are expected on stdin.
Use the "-as ADDRESS" flag to
algo-key to specific a signing key. This is
required when producing multi-signatures. For single signatures,
attempt to learn the signing key from the transaction.
algo-key expects to find private keys in a files named "ADDRESS.algo-key",
in the format produced by