Guides use of the Internet Computer (ICP) CLI (icp) for local networks, builds, deploys, canister operations, identities, cycles/tokens, recipe system, environments, and advanced features...
dfx command.dfx, map the request to the equivalent icp command(s).dfx, translate it to icp before responding.Default to these steps unless the user asks for a specific command:
Standard workflow (template-based):
icp new my-project (interactive prompts for template selection)cd my-projecticp network start -dicp deployicp canister call <canister> <method> '(...)'icp network status, icp canister status <canister>Non-interactive project creation:
icp new my-project --subfolder hello-world \
--define backend_type=rust \
--define frontend_type=react \
--define network_type=Default
Custom project with recipes:
mkdir my-project && cd my-projecticp.yaml with recipe configuration (see recipe section)icp network start -dicp deployRecipes (@dfinity/rust@v3.0.0, @dfinity/motoko@v4.0.0, @dfinity/asset-canister@v2.1.0, @dfinity/prebuilt@v2.0.0) provide best-practice configurations and reduce boilerplate. All recipes MUST include an explicit version.
Use -e/--environment when the user specifies a target (deploy uses environments; network start uses a network name or -e).
Use these to confirm the environment quickly:
icp --versionicp network listicp network status (or icp network ping --wait-healthy)Project lifecycle:
icp new - Create project from template (uses cargo-generate)icp build - Build canistersicp deploy - Deploy canisters (builds automatically)icp sync - Sync assets to asset canistericp project show - View expanded configuration (useful for recipes)Local network:
icp network start|status|ping|stopCanister operations:
icp canister create|install|call|status|delete|listicp canister start|stop - Control canister stateicp canister metadata <canister> <section> - Read metadata sectionsicp canister settings show|update|sync - Manage settingsicp canister top-up --amount <amount> <canister> - Add cyclesIdentities:
icp identity new|list|default|principal|import|export|rename|deleteicp identity account-id - Get ledger AccountIdentifiericp identity link hsm - Link HSM identity (PKCS#11)Cycles:
icp cycles balance|mint - Check and mint cyclesicp cycles transfer <amount> <receiver> - Transfer cyclesicp cycles mint --icp <amount> or --cycles <amount> - Convert ICP to cyclesTokens:
icp token balance - ICP token balanceicp token transfer <amount> <receiver> - ICP token transfericp token <LEDGER_ID> balance|transfer - ICRC-1 token operationsEnvironments:
icp environment list - List environments-e <env> for environment-specific commands-e ic for mainnet (not --mainnet)Arguments:
icp canister call <canister> <method> <arg> where arg can be a file pathicp canister install <canister> --args <arg> where arg can be a file pathRecipe selection:
@dfinity/ recipes for standard canister types@dfinity/rust@v3.0.0 - Rust canisters (config: package = Cargo package name)@dfinity/motoko@v4.0.0 - Motoko canisters (config: main = main .mo file, args required - see note below)@dfinity/asset-canister@v2.1.0 - Frontend assets (config: dir = asset directory)@dfinity/prebuilt@v2.0.0 - Pre-built WASM (config: path + sha256)@dfinity/rust@v3.0.0 (unversioned is not supported)args in recipe configuration is currently required (moc compiler flags). Use args: "" if no extra flags needed. Will become optional in a future Motoko recipe release.file://recipes/custom.hbsEnvironment strategy:
local if unspecified-e ic for IC mainnet (not --mainnet or --ic, removed since beta.5)-e staging, -e production.icp/<env>/canister_ids.jsonNetwork vs environment flags (-n vs -e):
-n (network): Use for token and cycles operations (icp token balance -n ic, icp cycles mint -n ic)-e (environment): Use for canister operations that reference canister names (icp deploy -e ic, icp canister status my-canister -e ic)icp token * and icp cycles * → use -n; icp deploy, icp canister *, icp build → use -eNetwork type:
Platform-specific:
Identity storage:
icp identity link hsm)Local development identity:
icp network start -d && icp deploy works out of the boxDeploy output:
icp deploy prints canister URLs after successful deploymenthttp://<canister-id>.localhost:8000Deployment mode:
--mode install|reinstall|upgrade only when user requests itResource allocation:
compute_allocation (0-100%) for performance guaranteesmemory_allocation for predictable billingfreezing_threshold (default 30 days, recommend 90 days for production)Canister settings:
log_visibility: controllers (default), public, or allowed_viewers with specific principalsenvironment_variables: Runtime key-value pairs for canister configurationwasm_memory_limit, wasm_memory_threshold: Memory controlsAmount format:
2T, 500m, 1.5b, 100k (trillion, million, billion, thousand)2_000_000_000_000Controller safety:
--force to skip confirmation (scripts only, dangerous)Legacy compatibility:
-e ic (not --mainnet or --ic, removed since beta.5)icp cycles transfer (not icp token cycles transfer, removed since beta.5)icp identity default (not icp identity use)dfx commands to icp equivalentsThese are frequent errors. Never produce these patterns:
dfx deploy → Correct: icp deploy (never use dfx)icp deploy --mainnet → Correct: icp deploy -e icicp identity use dev → Correct: icp identity default devicp token cycles transfer --to X --amount 2T → Correct: icp cycles transfer 2T X -n icicp token transfer --to X --amount 10 → Correct: icp token transfer 10 X -n icicp cycles mint --amount 5 → Correct: icp cycles mint --icp 5 -n ic or --cycles 5Ticp identity new prod --storage-mode keyring → Correct: icp identity new prod --storage keyring@dfinity/rust (no version) → Correct: @dfinity/rust@v3.0.0 (version required)icp new --recipe @dfinity/rust → Correct: icp new my-project (recipes go in icp.yaml, not in icp new)-e for token/cycles ops → Correct: Use -n ic for icp token and icp cycles commandsargs → Correct: Include args: "" in motoko v4.0.0 recipe configurationicp canister top-up for sending cycles to another user → Correct: icp canister top-up adds cycles to a canister you manage; icp cycles transfer sends cycles to any canister/principal@dfinity/rust@v3.0.0 (unversioned recipes are not supported)-e local, -e staging, -e ic-e/--environment or -n/--network when a target is named, but never both--identity when multiple identities might existLocal network:
localhost:8000. If icp network start fails, check and stop the other process with lsof -i :8000 and kill <PID>.icp network stop (use when finished with local testing).icp network status or icp network ping --wait-healthyRecipe errors:
icp project show to see expanded config and identify issuesEnvironment issues:
-e <env> matches intended environment with icp environment list.icp/<env>/canister_ids.json exists and has correct IDsicp canister settings sync to apply icp.yaml settings to deployed canistersDocker network problems:
docker ps)Cycles depletion:
icp canister top-up --amount 2T <canister>icp canister status regularlyfreezing_threshold to 90 days (7776000 seconds)Windows-specific:
Controller lockout:
--force flag (dangerous, scripts only)Large WASM:
Network naming:
-e ic or -n ic instead-e ic insteadThis skill provides quick-start guidance. For detailed information:
reference.mdexamples.mdbest-practices.mdUse tool calls to validate the latest CLI help and documentation.
CLI help (preferred when available locally):
{ "tool": "Shell", "command": "icp --help" }
{ "tool": "Shell", "command": "icp canister --help" }
{ "tool": "Shell", "command": "icp network --help" }
Docs pages (when the CLI isn't available or for citations):
Core documentation:
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/quickstart/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/tutorial/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/reference/cli/" }
Feature-specific guides:
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/guides/using-recipes/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/guides/creating-recipes/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/guides/managing-environments/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/guides/deploying-to-mainnet/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/guides/deploying-to-specific-subnets/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/guides/containerized-networks/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/guides/managing-identities/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/guides/tokens-and-cycles/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/guides/local-development/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/guides/installation/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/guides/creating-templates/" }
Concept documentation:
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/concepts/project-model/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/concepts/build-deploy-sync/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/concepts/environments/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/concepts/recipes/" }
Reference documentation:
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/reference/configuration/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/reference/canister-settings/" }
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/reference/environment-variables/" }
Migration:
{ "tool": "WebFetch", "url": "https://dfinity.github.io/icp-cli/0.1/migration/from-dfx/" }
Repo and releases:
{ "tool": "WebFetch", "url": "https://github.com/dfinity/icp-cli" }
{ "tool": "WebFetch", "url": "https://github.com/dfinity/icp-cli/releases" }
{ "tool": "WebFetch", "url": "https://github.com/dfinity/icp-cli-recipes" }
{ "tool": "WebFetch", "url": "https://forum.dfinity.org/t/icp-cli-announcements-and-feedback-discussion/60410" }
When replying to users:
icp network status, icp canister status).@dfinity/rust@v3.0.0).Use these to sanity-check outputs:
icp new my-project + icp.yaml with @dfinity/rust@v3.0.0-e staging, avoid -n-e ic (NOT --mainnet)icp cycles balance -n ic + icp canister top-up --amount 2T <canister> -e icicp canister top-up --amount 2T <canister>icp identity account-idicp project showicp cycles transfer 2T <canister-id> -n icicp identity export my-identity > backup.pemicp identity link hsm my-hsm --pkcs11-module <path> --key-id 01icp identity default my-identity (NOT icp identity use)Create project with template and deploy locally
Commands:
# Create with template (interactive)
icp new my-project
cd my-project
# Or non-interactive with specific options
icp new my-project --subfolder hello-world \
--define backend_type=rust \
--define frontend_type=react \
--define network_type=Default && cd my-project
# Start local network
icp network start -d
icp network status
# Deploy (builds automatically)
icp deploy
# Test
icp canister call backend greet '("World")'
# View expanded config (see what recipes generated)
icp project show
For Motoko: use --define backend_type=motoko (requires WSL on Windows).
Custom project with recipe-based icp.yaml
# icp.yaml
canisters:
- name: backend
recipe:
type: "@dfinity/rust@v3.0.0"
configuration:
package: backend
icp network start -d
icp deploy
icp canister call backend greet '("World")'
Multi-environment deployment (local → staging → IC mainnet)
Commands:
# 1. Develop and test locally
icp network start -d
icp deploy
icp canister status backend
# 2. Deploy to staging environment
icp deploy -e staging
icp canister status backend -e staging
# 3. Promote to IC mainnet
# IMPORTANT: Use -e ic (not --mainnet)
icp deploy -e ic
icp canister status backend -e ic
Environment-specific settings configured in icp.yaml:
canisters:
- name: backend
recipe:
type: "@dfinity/rust@v3.0.0"
configuration:
package: backend
environments:
- name: staging
network: ic
canisters: [backend]
settings:
backend:
compute_allocation: 20
- name: production
network: ic
canisters: [backend]
settings:
backend:
compute_allocation: 50
memory_allocation: 4294967296
Check cycles and top up (with human-readable amounts)
Commands:
# Check cycles balance
icp cycles balance -n ic
# Top up with human-readable amounts
icp canister top-up --amount 2T backend -e ic # 2 trillion
icp canister top-up --amount 500m backend -e ic # 500 million
# Transfer cycles (positional args: amount, receiver)
icp cycles transfer 1.5T rrkah-fqaaa-aaaaa-aaaaq-cai -n ic
# Check canister cycles
icp canister status backend -e ic
Supported formats: 1k, 1.5m, 2b, 4T, 1_000_000.
Get account ID and transfer tokens
Commands:
# Get your ledger AccountIdentifier
icp identity account-id
# Output: d4685b31b51450508aff0331584df7692a84467b680326f5c5f7d30ae711682f
# Transfer ICP tokens (positional args: amount, receiver)
icp token transfer 10.5 d4685b31b51450508aff0331584df7692a84467b680326f5c5f7d30ae711682f -n ic
# Check token balance
icp token balance -n ic
# ICRC-1 token (e.g., ckBTC)
icp token mxzaz-hqaaa-aaaar-qaada-cai balance -n ic
Core documentation:
Feature-specific guides:
Concept documentation:
Migration:
Repositories and releases: