Skip to main content

Introduction to Developing Canisters in Rust

Rust is a powerful and type-sound modern programming language with an active developer community. Because Rust compiles to WebAssembly, it offers a rich development environment for writing dapps to run on the Internet Computer blockchain. To help pave the way for writing dapps in Rust that can be deployed on the Internet Computer blockchain, DFINITY provides the Rust canister development kit (Rust CDK) to simplify the process.

The CDK consists of the following crates:

  1. The core of Rust CDK is the ic-cdk crate. It provides the core methods that enable Rust programs to interact with the Internet Computer blockchain system API.

  2. The ic-cdk-macros crate defines the procedural macros (e.g. update, query, import) that facilitate building operation endpoints and APIs.

  3. Also, the ic-cdk-timers crate provides an API to schedule multiple and periodic tasks.

There are a few examples to get you started building Rust Canisters.

Also, it is much easier to use dfx instead of setting up the project from scratch. See the Rust Quickstart for a simple walkthrough.