Skip to content
This new developer portal is under construction. For complete documentation, please refer to the old developer portal.

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 goal
2
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 accounts
10
app Manage applications
11
asset Manage assets
12
clerk Provides the tools to control transactions
13
completion Shell completion helper
14
help Help about any command
15
kmd Interact with kmd, the key management daemon
16
ledger Access ledger-related details
17
license Display license information
18
logging Control and manage Algorand logging
19
network Create and manage private, multi-node, locally-hosted networks
20
node Manage a specified algorand node
21
protocols
22
report
23
version The current version of the Algorand daemon (algod)
24
wallet Manage wallets: encrypted collections of Algorand account keys
25
26
Flags:
27
-d, --datadir stringArray Data directory for the node
28
-h, --help help for goal
29
-k, --kmddir string Data directory for kmd
30
-v, --version Display and write current build version and exit
31
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 report
2
12885688322
3
3.12.2.dev [rel/stable] (commit #181490e3)
4
go-algorand is licensed with AGPLv3.0
5
source code available at https://github.com/algorand/go-algorand
6
7
Linux ff7828f2da17 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 GNU/Linux
8
9
Genesis ID from genesis.json: sandnet-v1
10
11
Last committed block: 0
12
Time since last block: 0.0s
13
Sync Time: 0.0s
14
Last consensus protocol: future
15
Next consensus protocol: future
16
Round for next consensus protocol: 1
17
Next consensus protocol supported: true
18
Last Catchpoint:
19
Genesis ID: sandnet-v1
20
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 goal
2
Error: No such container: algokit_algod
3
Error: Error executing goal; ensure the Sandbox is started by executing `algokit sandbox status`
1
$ ~ algokit goal
2
Error response from daemon: Container 5a73961536e2c98e371465739053d174066c40d00647c8742f2bb39eb793ed7e is not running
3
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:

1
algokit 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:

1
docker 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.:

Terminal window
1
$ algokit goal --console
2
Opening Bash console on the algod node; execute `exit` to return to original console
3
root@82d41336608a:~# goal account list
4
[online] C62QEFC7MJBPHAUDMGVXGZ7WRWFAF3XYPBU3KZKOFHYVUYDGU5GNWS4NWU C62QEFC7MJBPHAUDMGVXGZ7WRWFAF3XYPBU3KZKOFHYVUYDGU5GNWS4NWU 4000000000000000 microAlgos
5
[online] DVPJVKODAVEKWQHB4G7N6QA3EP7HKAHTLTZNWMV4IVERJQPNGKADGURU7Y DVPJVKODAVEKWQHB4G7N6QA3EP7HKAHTLTZNWMV4IVERJQPNGKADGURU7Y 4000000000000000 microAlgos
6
[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:

Terminal window
1
$ algokit goal --interactive wallet new algodev
2
Please choose a password for wallet 'algodev':
3
Please confirm the password:
4
Creating wallet...
5
Created wallet 'algodev'
6
Your new wallet has a backup phrase that can be used for recovery.
7
Keeping this backup phrase safe is extremely important.
8
Would 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.