Skip to main content

Install

Beginner
Developing canisters

Compiled Wasm modules must be installed into a canister using the dfx canister install command from the project's directory:

dfx canister install <canister-name> --network=<NETWORK>

When a canister's code is installed, the following components are created:

  • The canister's code in the form of a canister module.

  • The canister's state, including the canister's memory and global values.

  • Additional IC-specific information, such as the canister's input and output queues.

Canister installation is done automatically in the background of the dfx deploy command. However, there may be certain workflows where installing Wasm into a canister manually is necessary.

Installing a gzip-compressed WebAssembly module

The size of programs that can be installed on ICP is currently limited to 10 MiB. WebAssembly modules that are (slightly) larger than 10 MiB can still be installed on ICP by using gzip file compression before uploading. ICP will then decompress the file and install the contained WebAssembly module.

The WebAssembly module is compressed using gzip and then uploaded by dfx canister install. You may need to add --mode reinstall or --mode upgrade when uploading the module to an existing canister.

gzip my-canister.wasm
dfx canister install my-canister --wasm my-canister.wasm.gz

Compression is currently not supported by dfx deploy.

Common errors related to installation and Wasm modules include: