Skip to content
/ cdk-rs Public

Rust canister development kit for the Internet Computer.

License

Notifications You must be signed in to change notification settings

dfinity/cdk-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

929fd0b · Dec 19, 2024
Dec 4, 2024
Mar 1, 2023
Dec 4, 2024
Sep 17, 2024
Jul 13, 2023
Dec 4, 2024
Dec 4, 2024
Dec 19, 2024
May 28, 2024
Nov 1, 2023
Sep 22, 2020
Dec 19, 2024
Dec 19, 2024
Oct 28, 2024
Aug 15, 2024
May 6, 2024
Dec 4, 2024

Repository files navigation

Rust Canister Development Kit

Documentation Crates.io License Downloads CI

Rust CDK provides tools for building Canisters on Internet Computer (IC).

You may be looking for:

If you are looking for a crate to communicate with existing canisters on IC, you may want to check agent-rs.

Introduction

A canister is a WebAssembly (wasm) module that can run on the Internet Computer.

To be a canister, a wasm module should communicate with the execution environment using Canister interfaces (System API).

This repo provides libraries and tools to facilitate developing canisters in Rust.

  • ic0: Internet Computer System API binding.
  • ic-cdk: Internet Computer Canister Development Kit.
  • ic-cdk-bindgen: Generate Rust bindings from Candid to make inter-canister calls.
  • ic-cdk-macros: Annotate functions with attribute macros to make them exposed public interfaces.
  • ic-cdk-timers: The library implements multiple and periodic timers.
  • candid-extractor: A CLI tool to extract candid definition from canister WASM.
  • ic-certified-map: An implementation of map which support certified queries.
  • ic-ledger-types: Type definitions to communicate with the ICP ledger canister.

Rust CDK in Action

In Cargo.toml:

[lib]
crate-type = ["cdylib"]

[dependencies]
ic-cdk = "0.15"
candid = "0.10" # required if you want to define Candid data types

Then in Rust source code:

#[ic_cdk::query]
fn hello() -> String{
    "world".to_string()
}

Check tutorial for a detailed guidance.