Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Rust examples

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.

Getting started

  • hello_world — full-stack "Hello, world!" with a Rust backend and a Vite frontend.
  • backend_only — the minimal canister: a single greet query 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.

Full-stack applications

  • 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.

Tokens and payments

  • 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 using ic-agent.

Chain fusion and signing

  • 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.

HTTPS outcalls

  • send_http_get — make a GET request to an external API from a canister.
  • send_http_post — make a POST request to an external API from a canister.

Inter-canister patterns

Canister operations and system features

Compute and AI

  • 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.

Testing

Encryption with vetKeys

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.

Security considerations and best practices

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.