Skip to content

Latest commit

 

History

History
121 lines (87 loc) · 4.44 KB

README.md

File metadata and controls

121 lines (87 loc) · 4.44 KB

Aptos Command Line Interface (CLI)

The aptos CLI is a command line tool for developing Move smart contracts, interacting with the Aptos blockchain, and operating Aptos nodes.

This crate builds the aptos binary. For conceptual guides and tutorials, see the Aptos CLI documentation.

Installation

Prebuilt binaries are the recommended way to install the CLI:

Once installed, update the CLI in place with:

aptos update aptos

To build from this repository instead, see Building from source.

Update notices

When both stdout and stderr are terminals and CI is not set to a true value (true, t, 1, yes or y, in any case), the CLI checks for a newer release every 3 days, retrying once after a day if a check fails or does not complete, and prints a notice on stderr after the command's output. The check queries the Homebrew formula API (formulae.brew.sh) for Homebrew installs and the GitHub API (api.github.com) otherwise, and is skipped for source builds and OS package-manager installs. The next check time is stored in ~/.aptos/update_check.json; until ~/.aptos exists (for example after aptos init), no check runs. Set APTOS_DISABLE_UPDATE_CHECK=1 to disable it.

Getting started

Initialize a profile, which stores a key pair and network settings in .aptos/config.yaml in the current directory:

aptos init

Then create and publish a Move package:

aptos move init --name my_package   # Scaffold a new package
aptos move compile                  # Compile it
aptos move test                     # Run its unit tests
aptos move publish                  # Publish it on chain

Run a local network to develop against, instead of a public network:

aptos node run-localnet

See Setting up the CLI for profile and network configuration details.

Command groups

Every command is grouped under a top-level subcommand:

Group Purpose
account Create and fund accounts, inspect resources, transfer APT, and rotate keys
config Manage CLI profiles, global settings, and shell completions
genesis Set up a genesis transaction for a new chain
governance Propose, vote on, and verify on-chain governance proposals
info Show build information about the CLI
init Initialize the current directory for use with the CLI
key Generate and inspect keys, and extract peer information
move Compile, test, publish, and interact with Move packages
multisig Create and approve transactions for multisig accounts
node Operate validators and full nodes, and run a local network
stake Manage stake, staking contracts, and delegated voters
update Update the CLI and the tools it depends on

Discovering commands

The CLI is self-documenting. Append --help at any level to list the available subcommands and arguments:

aptos --help                # All command groups
aptos move --help           # Commands within a group
aptos move publish --help   # Arguments for a single command

Use -h for a short summary and --help for the full description of each argument.

Shell completions make the commands easier to explore interactively:

aptos config generate-shell-completions --shell zsh --output-file <path>

Supported shells are bash, elvish, fish, powershell, and zsh.

Building from source

Build the CLI from a checkout of aptos-core:

cargo build -p aptos            # Debug binary at target/debug/aptos
cargo build -p aptos --release  # Release binary at target/release/aptos

Helper scripts for release and minimal builds live in scripts/cli at the repository root.

Further reading