Canonical examples for building canisters on the Internet Computer with Rust. Each example is self-contained: follow its README to deploy it locally with icp-cli and run its tests. Most examples have a Motoko counterpart in ../motoko/ implementing the same Candid interface.
New to ICP? Start with hello_world — a full-stack canister with a frontend and the structural template for all examples. Then try who_am_i for user authentication with Internet Identity.
Prerequisites and dev-container setup are covered in the repository README.
hello_world— full-stack "Hello, world!" with a Rust backend and a Vite frontend.backend_only— the minimal canister: a singlegreetquery function, no frontend.backend_wasm64— the same minimal canister compiled for the Wasm64 target.who_am_i— sign in with Internet Identity and see the principal your app receives.
daily_planner— monthly calendar with notes and tasks; fetches historic facts via HTTPS outcalls.flying_ninja— 2D side-scroller game with an on-chain leaderboard.photo_gallery— upload and view photos served via the HTTP gateway with cacheable responses.llm_chatbot— chat with a large language model from a canister.
icp_transfer— hold ICP in a canister and send it to other accounts via the ICP ledger.receiving-icp— generate account identifiers and check balances to receive ICP.exchange-rates— query crypto and fiat exchange rates from the Exchange Rate Canister (XRC).stake_neuron_from_cli— stake ICP into an NNS neuron from a Rust CLI binary usingic-agent.
basic_bitcoin— send and receive Bitcoin (P2PKH, P2WPKH, P2TR addresses).basic_ethereum— send and receive Ether using threshold ECDSA.evm_block_explorer— fetch block data from Ethereum and other EVM chains via the EVM RPC canister.threshold-ecdsa— a threshold ECDSA signing oracle.threshold-schnorr— a threshold Schnorr (BIP340/BIP341, Ed25519) signing oracle.x509— issue and verify X.509 certificates with threshold signatures.
send_http_get— make aGETrequest to an external API from a canister.send_http_post— make aPOSTrequest to an external API from a canister.
inter-canister-calls— bounded-wait and unbounded-wait calls, retries, and attaching cycles.parallel_calls— parallel vs. sequential inter-canister calls.composite_query— query functions that call other canisters' queries.guards— how guard functions interact with asynchronous code.candid_type_generation— generate Rust types from an external canister's.didfile.
canister-info— retrieve metadata about any canister via the management canister.canister-snapshots— take and restore canister snapshots.canister-snapshot-download— download and upload canister snapshots.canister_logs— canister logging, traps, panics, and error handling.low_wasm_memory— react to low Wasm memory with theon_low_wasm_memoryhook.periodic_tasks— timers and heartbeats for scheduled execution.performance_counters— measure the work a canister performs.query_stats— read a canister's own query statistics.
image-classification— run an ONNX machine-learning model inside a canister.face-recognition— face detection and recognition with the Tract ONNX engine.qrcode— long-running image processing in a single message execution.simd— WebAssembly SIMD acceleration for compute-heavy workloads.
unit_testable_rust_canister— structure a canister for comprehensive unit testing.
The vetkeys/ directory contains examples for vetKeys, from the low-level API to complete applications: basic_vetkd, basic_ibe, basic_timelock_ibe, basic_bls_signing, password_manager, password_manager_with_metadata, and encrypted_notes_app_vetkd.
If you base your application on one of these examples, we recommend you familiarize yourself with and adhere to the security best practices for developing on the Internet Computer. The examples provided here may not implement all the best practices.