Skip to main content




Canisters contain both code and state. Once you have written the code for a canister, the canister doesn't exist until it is registered with IC, either locally or the mainnet.

A canister can be created without first compiling any code. When canisters are created with dfx canister create, they are empty and do not contain program code. The code must be compiled into Wasm and installed into the empty canister before it can be deployed.

Creating canisters

When a canister is created, either locally or on the mainnet, the following steps happen:

  • The canister ID is registered with the local replica or the mainnet for each canister in the project's dfx.json file.

  • The following canister components are created:

    - List of controllers.

    - Cycles balance.

    - Reserved cycles balance.

    - Canister status.

    - Resource reservations.
  • The canister's ID is returned in the command line.

To create a canister locally, the dfx canister create command can be used:

dfx canister create hello_world // Create a canister locally
dfx canister create hello_world --network ic // Create a canister on the mainnet
dfx canister create --all --network ic // Create all canisters in the project's dfx.json file

Creating a canister on the mainnet will cost cycles

At this step, settings can be configured for the canister using the optional flags. View the full list of settings that can be configured.

Once your canister has been created, it is ready to be compiled.

Next steps