This document contains the help content for the icp command-line program.
Command Overview:
icp↴icp build↴icp canister↴icp canister call↴icp canister create↴icp canister delete↴icp canister install↴icp canister list↴icp canister metadata↴icp canister settings↴icp canister settings show↴icp canister settings update↴icp canister settings sync↴icp canister start↴icp canister status↴icp canister stop↴icp canister top-up↴icp cycles↴icp cycles balance↴icp cycles mint↴icp deploy↴icp environment↴icp environment list↴icp identity↴icp identity default↴icp identity import↴icp identity list↴icp identity new↴icp identity principal↴icp network↴icp network list↴icp network ping↴icp network start↴icp network status↴icp network stop↴icp network update↴icp new↴icp project↴icp project show↴icp sync↴icp token↴icp token balance↴icp token transfer↴
Usage: icp [OPTIONS] [COMMAND]
build— Build canisterscanister— Perform canister operations against a networkcycles— Mint and manage cyclesdeploy— Deploy a project to an environmentenvironment— Show information about the current project environmentsidentity— Manage your identitiesnetwork— Launch and manage local test networksnew— Create a new ICP project from a templateproject— Display information about the current projectsync— Synchronize canisterstoken— Perform token transactions
-
--project-root-override <PROJECT_ROOT_OVERRIDE>— Directory to use as your project root directory. If not specified the directory structure is traversed up until an icp.yaml file is found -
--debug— Enable debug loggingDefault value:
false -
--identity-password-file <FILE>— Read identity password from a file instead of prompting
Build canisters
Usage: icp build [OPTIONS] [CANISTERS]...
<CANISTERS>— Canister names (if empty, build all canisters in environment)
-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used
Perform canister operations against a network
Usage: icp canister <COMMAND>
call— Make a canister callcreate— Create a canister on a networkdelete— Delete a canister from a networkinstall— Install a built WASM to a canister on a networklist— List the canisters in an environmentmetadata— Read a metadata section from a canistersettings— Commands to manage canister settingsstart— Start a canister on a networkstatus— Show the status of canister(s)stop— Stop a canister on a networktop-up— Top up a canister with cycles
Make a canister call
Usage: icp canister call [OPTIONS] <CANISTER> <METHOD> [ARGS]
-
<CANISTER>— Name or principal of canister to target When using a name an environment must be specified -
<METHOD>— Name of canister method to call into -
<ARGS>— String representation of canister call argumentsIf not provided, an interactive prompt will be launched to help build the arguments.
-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used--identity <IDENTITY>— The user identity to run this command as
Create a canister on a network
Usage: icp canister create [OPTIONS] <CANISTER>
<CANISTER>— Name or principal of canister to target When using a name an environment must be specified
-
-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument -
-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used -
--identity <IDENTITY>— The user identity to run this command as -
--controller <CONTROLLER>— One or more controllers for the canister. Repeat--controllerto specify multiple -
--compute-allocation <COMPUTE_ALLOCATION>— Optional compute allocation (0 to 100). Represents guaranteed compute capacity -
--memory-allocation <MEMORY_ALLOCATION>— Optional memory allocation in bytes. If unset, memory is allocated dynamically -
--freezing-threshold <FREEZING_THRESHOLD>— Optional freezing threshold in seconds. Controls how long a canister can be inactive before being frozen -
--reserved-cycles-limit <RESERVED_CYCLES_LIMIT>— Optional reserved cycles limit. If set, the canister cannot consume more than this many cycles -
-q,--quiet— Suppress human-readable output; print only canister IDs, one per line, to stdout -
--cycles <CYCLES>— Cycles to fund canister creation (in raw cycles)Default value:
2000000000000 -
--subnet <SUBNET>— The subnet to create canisters on
Delete a canister from a network
Usage: icp canister delete [OPTIONS] <CANISTER>
<CANISTER>— Name or principal of canister to target When using a name an environment must be specified
-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used--identity <IDENTITY>— The user identity to run this command as
Install a built WASM to a canister on a network
Usage: icp canister install [OPTIONS] <CANISTER>
<CANISTER>— Name or principal of canister to target When using a name an environment must be specified
-
-m,--mode <MODE>— Specifies the mode of canister installationDefault value:
autoPossible values:
auto,install,reinstall,upgrade -
--wasm <WASM>— Path to the WASM file to install. Uses the build output if not explicitly provided -
-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument -
-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used -
--identity <IDENTITY>— The user identity to run this command as
List the canisters in an environment
Usage: icp canister list [OPTIONS]
-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used
Read a metadata section from a canister
Usage: icp canister metadata [OPTIONS] <CANISTER> <METADATA_NAME>
<CANISTER>— Name or principal of canister to target When using a name an environment must be specified<METADATA_NAME>— The name of the metadata section to read
-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used--identity <IDENTITY>— The user identity to run this command as
Commands to manage canister settings
Usage: icp canister settings <COMMAND>
show— Show the status of a canisterupdate— Change a canister's settings to specified valuessync— Synchronize a canister's settings with those defined in the project
Show the status of a canister.
By default this queries the status endpoint of the management canister. If the caller is not a controller, falls back on fetching public information from the state tree.
Usage: icp canister settings show [OPTIONS] <CANISTER>
<CANISTER>— canister name or principal to target. When using a name, an enviroment must be specified
-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used--identity <IDENTITY>— The user identity to run this command as-i,--id-only— Only print the canister ids--json— Format output in json-p,--public— Show the only the public information. Skips trying to get the status from the management canister and looks up public information from the state tree
Change a canister's settings to specified values
Usage: icp canister settings update [OPTIONS] <CANISTER>
<CANISTER>— Name or principal of canister to target When using a name an environment must be specified
-
-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument -
-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used -
--identity <IDENTITY>— The user identity to run this command as -
-f,--force— Force the operation without confirmation prompts -
--add-controller <ADD_CONTROLLER>— Add one or more principals to the canister's controller list -
--remove-controller <REMOVE_CONTROLLER>— Remove one or more principals from the canister's controller list.Warning: Removing yourself will cause you to lose control of the canister.
-
--set-controller <SET_CONTROLLER>— Replace the canister's controller list with the specified principals.Warning: This removes all existing controllers not in the new list. If you don't include yourself, you will lose control of the canister.
-
--compute-allocation <COMPUTE_ALLOCATION> -
--memory-allocation <MEMORY_ALLOCATION> -
--freezing-threshold <FREEZING_THRESHOLD> -
--reserved-cycles-limit <RESERVED_CYCLES_LIMIT> -
--wasm-memory-limit <WASM_MEMORY_LIMIT> -
--wasm-memory-threshold <WASM_MEMORY_THRESHOLD> -
--log-visibility <LOG_VISIBILITY> -
--add-log-viewer <ADD_LOG_VIEWER> -
--remove-log-viewer <REMOVE_LOG_VIEWER> -
--set-log-viewer <SET_LOG_VIEWER> -
--add-environment-variable <ADD_ENVIRONMENT_VARIABLE> -
--remove-environment-variable <REMOVE_ENVIRONMENT_VARIABLE>
Synchronize a canister's settings with those defined in the project
Usage: icp canister settings sync [OPTIONS] <CANISTER>
<CANISTER>— Name or principal of canister to target When using a name an environment must be specified
-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used--identity <IDENTITY>— The user identity to run this command as
Start a canister on a network
Usage: icp canister start [OPTIONS] <CANISTER>
<CANISTER>— Name or principal of canister to target When using a name an environment must be specified
-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used--identity <IDENTITY>— The user identity to run this command as
Show the status of canister(s).
By default this queries the status endpoint of the management canister. If the caller is not a controller, falls back on fetching public information from the state tree.
Usage: icp canister status [OPTIONS] [CANISTER]
<CANISTER>— An optional canister name or principal to target. When using a name, an enviroment must be specified
-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used--identity <IDENTITY>— The user identity to run this command as-i,--id-only— Only print the canister ids--json— Format output in json-p,--public— Show the only the public information. Skips trying to get the status from the management canister and looks up public information from the state tree
Stop a canister on a network
Usage: icp canister stop [OPTIONS] <CANISTER>
<CANISTER>— Name or principal of canister to target When using a name an environment must be specified
-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used--identity <IDENTITY>— The user identity to run this command as
Top up a canister with cycles
Usage: icp canister top-up [OPTIONS] --amount <AMOUNT> <CANISTER>
<CANISTER>— Name or principal of canister to target When using a name an environment must be specified
--amount <AMOUNT>— Amount of cycles to top up-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used--identity <IDENTITY>— The user identity to run this command as
Mint and manage cycles
Usage: icp cycles <COMMAND>
balance— Display the cycles balancemint— Convert icp to cycles
Display the cycles balance
Usage: icp cycles balance [OPTIONS]
-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used--identity <IDENTITY>— The user identity to run this command as
Convert icp to cycles
Usage: icp cycles mint [OPTIONS]
--icp <ICP>— Amount of ICP to mint to cycles--cycles <CYCLES>— Amount of cycles to mint. Automatically determines the amount of ICP needed-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used--identity <IDENTITY>— The user identity to run this command as
Deploy a project to an environment
Usage: icp deploy [OPTIONS] [NAMES]...
<NAMES>— Canister names
-
-m,--mode <MODE>— Specifies the mode of canister installationDefault value:
autoPossible values:
auto,install,reinstall,upgrade -
--subnet <SUBNET>— The subnet to use for the canisters being deployed -
--controller <CONTROLLER>— One or more controllers for the canisters being deployed. Repeat--controllerto specify multiple -
--cycles <CYCLES>— Cycles to fund canister creation (in cycles)Default value:
2000000000000 -
--identity <IDENTITY>— The user identity to run this command as -
-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used
Show information about the current project environments
Usage: icp environment <COMMAND>
list— Display a list of enviroments
Display a list of enviroments
Usage: icp environment list
Manage your identities
Usage: icp identity <COMMAND>
default— Display the currently selected identityimport— Import a new identitylist— List the identitiesnew— Create a new identityprincipal— Display the principal for the current identity
Display the currently selected identity
Usage: icp identity default [NAME]
<NAME>— Identity to set as default. If omitted, prints the current default
Import a new identity
Usage: icp identity import [OPTIONS] <--from-pem <FILE>|--read-seed-phrase|--from-seed-file <FILE>> <NAME>
<NAME>— Name for the imported identity
-
--storage <STORAGE>— Where to store the private keyDefault value:
keyringPossible values:
plaintext,keyring,password -
--from-pem <FILE>— Import from a PEM file -
--read-seed-phrase— Read seed phrase interactively from the terminal -
--from-seed-file <FILE>— Read seed phrase from a file -
--decryption-password-from-file <FILE>— Read the PEM decryption password from a file instead of prompting -
--storage-password-file <FILE>— Read the storage password from a file instead of prompting (for --storage password) -
--assert-key-type <ASSERT_KEY_TYPE>— Specify the key type when it cannot be detected from the PEM file (danger!)
List the identities
Usage: icp identity list
Create a new identity
Usage: icp identity new [OPTIONS] <NAME>
<NAME>— Name for the new identity
-
--storage <STORAGE>— Where to store the private keyDefault value:
keyringPossible values:
plaintext,keyring,password -
--storage-password-file <FILE>— Read the storage password from a file instead of prompting (for --storage password) -
--output-seed <FILE>— Write the seed phrase to a file instead of printing to stdout
Display the principal for the current identity
Usage: icp identity principal [OPTIONS]
--identity <IDENTITY>— The user identity to run this command as
Launch and manage local test networks
Usage: icp network <COMMAND>
list—ping— Try to connect to a network, and print out its statusstart— Run a given networkstatus— Get status information about a running networkstop— Stop a background networkupdate— Update icp-cli-network-launcher to the latest version
Usage: icp network list
Try to connect to a network, and print out its status
Usage: icp network ping [OPTIONS] [NAME]
Examples:
# Ping default 'local' network
icp network ping
# Ping explicit network
icp network ping mynetwork
# Ping using environment flag
icp network ping -e staging
# Ping using ICP_ENVIRONMENT variable
ICP_ENVIRONMENT=staging icp network ping
# Name overrides ICP_ENVIRONMENT
ICP_ENVIRONMENT=staging icp network ping local
# Wait until healthy
icp network ping --wait-healthy
-
<NAME>— Name of the network to use.Takes precedence over -e/--environment and the ICP_ENVIRONMENT environment variable when specified explicitly.
-
-e,--environment <ENVIRONMENT>— Use the network configured in the specified environment.Cannot be used together with an explicit network name argument. The ICP_ENVIRONMENT environment variable is also checked when neither network name nor -e flag is specified.
-
--wait-healthy— Repeatedly ping until the replica is healthy or 1 minute has passed
Run a given network
Usage: icp network start [OPTIONS] [NAME]
Examples:
# Use default 'local' network
icp network start
# Use explicit network name
icp network start mynetwork
# Use environment flag
icp network start -e staging
# Use ICP_ENVIRONMENT variable
ICP_ENVIRONMENT=staging icp network start
# Name overrides ICP_ENVIRONMENT
ICP_ENVIRONMENT=staging icp network start local
# Background mode with environment
icp network start -e staging -d
-
<NAME>— Name of the network to use.Takes precedence over -e/--environment and the ICP_ENVIRONMENT environment variable when specified explicitly.
-
-e,--environment <ENVIRONMENT>— Use the network configured in the specified environment.Cannot be used together with an explicit network name argument. The ICP_ENVIRONMENT environment variable is also checked when neither network name nor -e flag is specified.
-
-d,--background— Starts the network in a background process. This command will exit once the network is running. To stop the network, use 'icp network stop'
Get status information about a running network
Usage: icp network status [OPTIONS] [NAME]
Examples:
# Get status of default 'local' network
icp network status
# Get status of explicit network
icp network status mynetwork
# Get status using environment flag
icp network status -e staging
# Get status using ICP_ENVIRONMENT variable
ICP_ENVIRONMENT=staging icp network status
# Name overrides ICP_ENVIRONMENT
ICP_ENVIRONMENT=staging icp network status local
# JSON output
icp network status --json
-
<NAME>— Name of the network to use.Takes precedence over -e/--environment and the ICP_ENVIRONMENT environment variable when specified explicitly.
-
-e,--environment <ENVIRONMENT>— Use the network configured in the specified environment.Cannot be used together with an explicit network name argument. The ICP_ENVIRONMENT environment variable is also checked when neither network name nor -e flag is specified.
-
--json— Format output as JSON
Stop a background network
Usage: icp network stop [OPTIONS] [NAME]
Examples:
# Stop default 'local' network
icp network stop
# Stop explicit network
icp network stop mynetwork
# Stop using environment flag
icp network stop -e staging
# Stop using ICP_ENVIRONMENT variable
ICP_ENVIRONMENT=staging icp network stop
# Name overrides ICP_ENVIRONMENT
ICP_ENVIRONMENT=staging icp network stop local
-
<NAME>— Name of the network to use.Takes precedence over -e/--environment and the ICP_ENVIRONMENT environment variable when specified explicitly.
-
-e,--environment <ENVIRONMENT>— Use the network configured in the specified environment.Cannot be used together with an explicit network name argument. The ICP_ENVIRONMENT environment variable is also checked when neither network name nor -e flag is specified.
Update icp-cli-network-launcher to the latest version
Usage: icp network update
Create a new ICP project from a template
Under the hood templates are generated with cargo-generate. See the cargo-generate docs for a guide on how to write your own templates: https://docs.rs/cargo-generate/0.23.7/cargo_generate/
Usage: icp new [OPTIONS] <NAME>
<NAME>— Directory to create / project name; if the name isn't in kebab-case, it will be converted to kebab-case unless--forceis given
-
--subfolder <SUBFOLDER>— Specifies the subfolder within the template repository to be used as the actual template -
-g,--git <GIT>— Git repository to clone template from. Can be a URL (likehttps://github.com/dfinity/icp-cli-project-template), a path (relative or absolute)Default value:
https://github.com/dfinity/icp-cli-templates -
-b,--branch <BRANCH>— Branch to use when installing from git -
-t,--tag <TAG>— Tag to use when installing from git -
-r,--revision <REVISION>— Git revision to use when installing from git (e.g. a commit hash) -
-p,--path <PATH>— Local path to copy the template from. Can not be specified together with --git -
-f,--force— Don't convert the project name to kebab-case before creating the directory. Note thaticp-cliwon't overwrite an existing directory, even if--forceis given -
-q,--quiet— Opposite of verbose, suppresses errors & warning in output Conflicts with --debug, and requires the use of --continue-on-error -
--continue-on-error— Continue if errors in templates are encountered -
-s,--silent— If silent mode is set all variables will be extracted from the template_values_file. If a value is missing the project generation will fail -
--vcs <VCS>— Specify the VCS used to initialize the generated template -
-i,--identity <IDENTITY>— Use a different ssh identity -
--gitconfig <GITCONFIG_FILE>— Use a different gitconfig file, if omitted the usual $HOME/.gitconfig will be used -
-d,--define <DEFINE>— Define a value for use during template expansion. E.g--define foo=bar -
--init— Generate the template directly into the current dir. No subfolder will be created and no vcs is initialized -
--destination <PATH>— Generate the template directly at the given path -
--force-git-init— Will enforce a fresh git init on the generated project -
-o,--overwrite— Allow the template to overwrite existing files in the destination -
--skip-submodules— Skip downloading git submodules (if there are any)
Display information about the current project
Usage: icp project <COMMAND>
show— Outputs the project's effective yaml configuration
Outputs the project's effective yaml configuration.
The effective yaml configuration includes:
-
implicit networks
-
implicit environments
-
processed recipes
Usage: icp project show
Synchronize canisters
Usage: icp sync [OPTIONS] [CANISTERS]...
<CANISTERS>— Canister names (if empty, sync all canisters in environment)
-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used--identity <IDENTITY>— The user identity to run this command as
Perform token transactions
Usage: icp token [TOKEN] <COMMAND>
balance—transfer—
-
<TOKEN>— The token to execute the operation on, defaults toicpDefault value:
icp
Usage: icp token balance [OPTIONS]
-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used--identity <IDENTITY>— The user identity to run this command as
Usage: icp token transfer [OPTIONS] <AMOUNT> <RECEIVER>
<AMOUNT>— Token amount to transfer<RECEIVER>— The receiver of the token transfer
-n,--network <NETWORK>— Name of the network to target, conflicts with environment argument-e,--environment <ENVIRONMENT>— Override the environment to connect to. By default, the local environment is used--identity <IDENTITY>— The user identity to run this command as
This document was generated automatically by
clap-markdown.