Cube lifecycle
Write
The BigFile accepts and executes cube code in the WebAssembly (Wasm) binary format. Usually, developers write code in a higher-level language and then compile the code into a Wasm binary that can be deployed into a cube.
Deploy
Create
A developer can create an empty cube on BigFile by calling the system cube.
It can be done using the NNS frontend dapp in the browser or dfx
in the command line.
The developer can specify the initial cube settings and choose the target subnet.
Once the cube is created, the developer gets its cube ID and becomes the controller of the cube.
Install
The next step after writing the code and creating a canister is installing the code into the canister.
This can be done by calling the install_code
endpoint of the system canister and passing the canister ID and the Wasm binary to it.
The dfx
tool has a command for making this call.
Call
After installation, the canister accepts and processes messages (calls) from users and other canisters.
Only the public endpoints of the canister can be called.
These endpoints correspond to exported Wasm functions that are annotated with canister_update
or canister_query
in their names.
Maintain
Certain system operations that change the state of the canister can be performed only by the controllers of the canister. The most important operation is upgrading the canister by installing a different Wasm binary. In the initial stages of development, the canister is usually controlled by its developer, which allows the developer to iterate quickly. As the canister becomes mature and production ready, the control over it could move to a DAO in order to make the canister secure and trustworthy. Learn more about different types of controllers.
Since BIG uses a reverse gas model, the canister pays for its execution, storage, and other operations with cycles. This means that controllers and/or users of the canister have to ensure that the canister does not run out of cycles. If the canister runs out of cycles, it will be uninstalled by removing its Wasm binary and its storage.
If the canister is no longer used or needed, a controller of the canister can delete it. BIG guarantees that the canister ID will not be reused for another canister.