To develop on the Internet Computer with Rust, We needs to install necessary dependencies according to the quick start guide in the IC developer docs.
As we work on WSL2
, we first install rustup
on the Ubuntu VM:
curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh
To verify the installation:
rustup --version
# OUTPUT: rustup 1.25.1 (bb60b1e89 2022-07-12)
rustc --version
# OUTPUT: rustc 1.62.1 (e092d0b6b 2022-07-16)
cargo --version
# OUTPUT: cargo 1.62.1 (a748cf5a3 2022-06-08)
Here, rustup
is a command line tool for managing Rust versions and associated tools, rustc
is the rust language core (compiler). and cargo
is Rust’s build system and package manager.
In order to works with IC, the Rust tool chain must be at version 1.46.0, or later.
Also in order to works with IC, we need to install the ic-cdk-optimizer
utility using cargo:
cargo install ic-cdk-optimizer
We can use the following command to check the installations:
cargo search ic
We need to use a tool namedDFX
, which is the default Canister Software Development Kit package maintained by the DFINITY foundation.
To install it:
sh -ci "$(curl -fsSL https://smartcontracts.org/install.sh)"
To verify the installation:
dfx --version
# OUTPUT: dfx 0.11.1
Node.js
is necessary for rendering the front-end assets in IC development, however, it is not needed for canister development in general.
The IC support all stable versions of Node.js starting with 12. You can install 12, 14, or 16. But Node 17 does not support Webpack’s api proxy tool, so npm start
may not work correctly. In this project, we use the version 16.
To install it:
sudo apt-get update
curl -s https://deb.nodesource.com/setup_16.x | sudo bash
sudo apt install nodejs -y
To verify the installation:
node --version
# OUTPUT: v16.14.2
Some information in this note come from the following external links: