AlgoKit goal
AlgoKit goal command provides the user with a mechanism to run goal cli commands against the current AlgoKit LocalNet.
You can explore all possible goal commands by running algokit goal
e.g.:
1$ ~ algokit goal2 GOAL is the CLI for interacting Algorand software instance. The binary 'goal' is installed alongside the algod binary and is considered an integral part of the complete installation. The binaries should be used in tandem - you should not try to use a version of goal with a different version of algod.3
4 Usage:5 goal [flags]6 goal [command]7
8 Available Commands:9 account Control and manage Algorand accounts10 app Manage applications11 asset Manage assets12 clerk Provides the tools to control transactions13 completion Shell completion helper14 help Help about any command15 kmd Interact with kmd, the key management daemon16 ledger Access ledger-related details17 license Display license information18 logging Control and manage Algorand logging19 network Create and manage private, multi-node, locally-hosted networks20 node Manage a specified algorand node21 protocols22 report23 version The current version of the Algorand daemon (algod)24 wallet Manage wallets: encrypted collections of Algorand account keys25
26 Flags:27 -d, --datadir stringArray Data directory for the node28 -h, --help help for goal29 -k, --kmddir string Data directory for kmd30 -v, --version Display and write current build version and exit31
32 Use "goal [command] --help" for more information about a command.
For instance, running algokit goal report
would result in output like:
1$ ~ algokit goal report2 128856883223 3.12.2.dev [rel/stable] (commit #181490e3)4 go-algorand is licensed with AGPLv3.05 source code available at https://github.com/algorand/go-algorand6
7 Linux ff7828f2da17 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 GNU/Linux8
9 Genesis ID from genesis.json: sandnet-v110
11 Last committed block: 012 Time since last block: 0.0s13 Sync Time: 0.0s14 Last consensus protocol: future15 Next consensus protocol: future16 Round for next consensus protocol: 117 Next consensus protocol supported: true18 Last Catchpoint:19 Genesis ID: sandnet-v120 Genesis hash: vEg1NCh6SSXwS6O5HAfjYCCNAs4ug328s3RYMr9syBg=
If the AlgoKit Sandbox algod
docker container is not present or not running, the command will fail with a clear error, e.g.:
1$ ~ algokit goal2 Error: No such container: algokit_algod3 Error: Error executing goal; ensure the Sandbox is started by executing `algokit sandbox status`
1$ ~ algokit goal2 Error response from daemon: Container 5a73961536e2c98e371465739053d174066c40d00647c8742f2bb39eb793ed7e is not running3 Error: Error executing goal; ensure the Sandbox is started by executing `algokit sandbox status`
Working with Files in the Container
When interacting with the container, especially if you’re using tools like goal, you might need to reference files or directories. Here’s how to efficiently deal with files and directories:
Automatic File Mounting
When you specify a file or directory path in your goal
command, the system will automatically mount that path from your local filesystem into the container. This way, you don’t need to copy files manually each time.
For instance, if you want to compile a teal
file:
1algokit goal clerk compile /Path/to/inputfile/approval.teal -o /Path/to/outputfile/approval.compiled
Here, /Path/to/inputfile/approval.teal
and /Path/to/outputfile/approval.compiled
are paths on your local file system, and they will be automatically accessible to the goal
command inside the container.
Manual Copying of Files
In case you want to manually copy files into the container, you can do so using docker cp
:
1docker cp foo.txt algokit_algod:/root
This command copies the foo.txt
from your local system into the root directory of the algokit_algod
container.
Note: Manual copying is optional and generally only necessary if you have specific reasons for doing so since the system will auto-mount paths specified in commands.
Running multiple commands
If you want to run multiple commands or interact with the filesystem you can execute algokit goal --console
. This will open a Bash shell session on the algod
Docker container and from there you can execute goal directly, e.g.:
1$ algokit goal --console2Opening Bash console on the algod node; execute `exit` to return to original console3root@82d41336608a:~# goal account list4[online] C62QEFC7MJBPHAUDMGVXGZ7WRWFAF3XYPBU3KZKOFHYVUYDGU5GNWS4NWU C62QEFC7MJBPHAUDMGVXGZ7WRWFAF3XYPBU3KZKOFHYVUYDGU5GNWS4NWU 4000000000000000 microAlgos5[online] DVPJVKODAVEKWQHB4G7N6QA3EP7HKAHTLTZNWMV4IVERJQPNGKADGURU7Y DVPJVKODAVEKWQHB4G7N6QA3EP7HKAHTLTZNWMV4IVERJQPNGKADGURU7Y 4000000000000000 microAlgos6[online] 4BH5IKMDDHEJEOZ7T5LLT4I7EVIH5XCOTX3TPVQB3HY5TUBVT4MYXJOZVA 4BH5IKMDDHEJEOZ7T5LLT4I7EVIH5XCOTX3TPVQB3HY5TUBVT4MYXJOZVA 2000000000000000 microAlgos
Interactive Mode
Some goal
commands require interactive input from the user. By default, AlgoKit will attempt to run commands in non-interactive mode first, and automatically switch to interactive mode if needed. You can force a command to run in interactive mode by using the --interactive
flag:
1$ algokit goal --interactive wallet new algodev2Please choose a password for wallet 'algodev':3Please confirm the password:4Creating wallet...5Created wallet 'algodev'6Your new wallet has a backup phrase that can be used for recovery.7Keeping this backup phrase safe is extremely important.8Would you like to see it now? (Y/n): n
This is particularly useful when you know a command will require user input, such as creating new accounts, importing keys, or signing transactions.
For more details about the AlgoKit goal
command, please refer to the AlgoKit CLI reference documentation.