Skip to content

Latest commit

 

History

History
163 lines (105 loc) · 2.4 KB

File metadata and controls

163 lines (105 loc) · 2.4 KB

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 → Repeat

Starting Your Session

Start the local network in the background:

icp network start -d

Verify it's running:

icp network ping

Making Changes

After editing your source code, deploy the changes:

icp deploy

This rebuilds and redeploys all canisters. Deploy specific canisters:

icp deploy my-canister

Tip: 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:

icp canister list

View the effective project configuration:

icp project show

Working with Multiple Canisters

Deploy all canisters:

icp deploy

Deploy specific canisters:

icp deploy frontend
icp deploy backend

Build without deploying (for verification):

icp build           # Build all
icp build frontend  # Build specific canister

Resetting State

To start fresh with a clean network:

# Stop the current network
icp network stop

# Start a new network (previous state is discarded)
icp network start -d

Then redeploy your canisters:

icp deploy

Network Management

Check network status:

icp network status

View network details as JSON:

icp network status --json

Stop the network when done:

icp network stop

Troubleshooting

Build fails with "command not found"

Ensure your language toolchain is installed and in PATH:

  • Rust: rustup target add wasm32-unknown-unknown
  • Motoko: mops toolchain init

Network connection fails

Check if the network is running:

icp network ping

If not responding, restart:

icp network stop
icp network start -d

Deployment fails

  1. Verify the build succeeded: icp build
  2. Check network health: icp network ping

Next Steps

Browse all documentation →