Motoko examples
Core Motoko
These examples show the Motoko language as a backend language for the IC, operating directly with clients, without a front end component.
Basic
counter
-- basic (stable) variable demo.hello_cycles
-- basic cycles demo.who_am_i
-- basic caller identification demo.
Intermediate
classes
-- dynamic actor (class) instantiation.pub-sub
-- multiple canisters, with publisher-subscriber inter-canister calls.icrc2-swap
-- deposit, swap, and withdraw two ICRC-2 tokens.
Minimal front end.
These examples use a minimal front end component.
random_maze
-- random maze generation, with IC-based randomness.cert_var
-- simple certified variable (a single 32-bit number), with client-side certificate validation.minimal-counter-dapp
-- counter dapp with minimal front end.
Full stack.
These examples use a "conventional" front end component (via React.Component
).
life
-- demonstrates upgrades among three versions and stable state migration.superheroes
-- CRUD-like demo service.
Security Considerations and Security 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.