Local Development
This guide covers the day-to-day development workflow with icp-cli.
The Development Cycle
Local development follows a simple loop:
Edit code → Build → Deploy → Test → RepeatStarting Your Session
Start the local network in the background:
icp network start -dVerify it’s running:
icp network pingMaking Changes
After editing your source code, deploy the changes:
icp deployThis rebuilds and redeploys all canisters. Deploy specific canisters:
icp deploy my-canisterTip: icp deploy always builds first. If you want to verify compilation before deploying, run icp build separately.
Testing Changes
Call methods on your canister:
icp canister call my-canister method_name '(arguments)'Example:
icp canister call backend get_user '("alice")'Viewing Project State
List canisters configured in this environment (the local environment is the default, targeting your local network):
icp canister listView the effective project configuration:
icp project showWorking with Multiple Canisters
Deploy all canisters:
icp deployDeploy specific canisters:
icp deploy frontendicp deploy backendBuild without deploying (for verification):
icp build # Build allicp build frontend # Build specific canisterResetting State
To start fresh with a clean network:
# Stop the current networkicp network stop
# Start a new network (previous state is discarded)icp network start -dThen redeploy your canisters:
icp deployNetwork Management
Check network status:
icp network statusView network details as JSON:
icp network status --jsonStop the network when done:
icp network stopTroubleshooting
Build fails with “command not found”
A required tool is missing. See the Installation Guide for:
- Rust toolchain — If error mentions
cargoorrustc - Motoko toolchain — If error mentions
mocormops - ic-wasm — If error mentions
ic-wasm
Network connection fails
Check if the network is running:
icp network pingIf not responding, restart:
icp network stopicp network start -dDeployment fails
- Verify the build succeeded:
icp build - Check network health:
icp network ping
Next Steps
- Deploying to Mainnet — Go live with your canisters