Skip to main content
Version: master

The Leo Command Line Interface

The Leo CLI is a command line interface tool that comes equipped with the Leo compiler.

tip

You can print the list of commands by running leo --help

Commands​

  • abi - Generate an ABI JSON file from a compiled .aleo bytecode file.
  • account - Create a new Aleo account, sign and verify messages.
    • new - Generates a new Aleo account.
    • import - Derive an Aleo account from a private key.
    • sign - Sign a message using your Aleo private key.
    • verify - Verify a message and signature from an Aleo address.
  • add - Add a new onchain or local dependency to the current project.
  • build - Compile the current project.
  • clean - Clean the build and output artifacts.
  • deploy - Deploy a program to the Aleo network.
  • devnet - Initialize a local devnet.
  • devnode - Run a local lightweight devnode.
  • execute - Execute a program and produce a transaction containing a proof.
  • new - Create a new Leo project in a new directory.
  • query - Query live data and state from the Aleo network.
    • block - Query block information.
    • transaction - Query transaction information.
    • program - Query program source code and live mapping values.
    • stateroot - Query the latest stateroot.
    • committee - Query the current committee.
    • mempool - Query transactions and transmissions from the memory pool.
    • peers - Query peer information.
  • remove - Remove a dependency from the current project.
  • run - Run a program without producing a proof.
  • test - Run the test cases for a Leo project.
  • update - Update dependencies in leo.lock within the manifest requirements.
  • upgrade - Upgrade a deployed program on the Aleo network.
  • synthesize - Generate proving and verifying keys for a program.
  • fmt - Format Leo source files. (plugin)
  • plugins - List installed CLI plugins.

Universal Flags​

These flags are available to use alongside all commands in the Leo CLI.

--help​

-h​

Prints available commands and flags.

--version​

-V​

Prints the currently installed version of Leo.

-q​

Suppresses the CLI output.

-d​

Prints out additional information for debugging if possible.

--path <PATH>​

Specifies the path to Leo program root folder. Defaults to ./.

--home <HOME>​

Specifies the path to the .aleo program registry. This is where programs downloaded from the network will be cached. Defaults to ~/.aleo/registry.

--json-output[=<PATH>]​

Saves structured JSON output to disk.

  • Default location: build/json-outputs/<command>.json
  • Custom file: --json-output=my-results.json

The value must be attached with = (for example --json-output=my-results.json). With no value, the default location is used.

Supported commands: build, deploy, upgrade, run, execute, test, query, synthesize. For build, the JSON contains the program checksum and each entry/view function checksum (see leo build --checksums).

Examples
# Save to default location (build/json-outputs/run.json)
leo run --json-output main 1u32 2u32

# Save to custom path
leo execute main --json-output=my-results.json

# Write the program and function checksums to build/json-outputs/build.json
leo build --json-output

--package <NAME>​

-p <NAME>​

Targets a specific workspace member by name. The name can be the member directory, program name, or program name without the .aleo suffix. For example, use token.aleo. leo update does not accept this option; use leo update NAME to select a dependency. Use this option only in a workspace. If workspace.json does not exist, the command reports an error.