Skip to content
Merged
30 changes: 29 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ Each example's README follows this structure:
```markdown
# <Example Title>

<ICP Ninja badge + callout — eligible examples only; see "ICP Ninja badge" below>

<2-3 sentences describing what the example demonstrates>

## Build and deploy from the command line
Expand All @@ -389,8 +391,34 @@ Rust: `icp build backend && candid-extractor target/wasm32-unknown-unknown/relea
```

- Say **"canister"**, not "smart contract" — in READMEs and code comments alike.
- Each README links to its counterpart in the other language.
- **No back-references:** do not add a "View this sample's code on GitHub" link or a cross-language "also available in \<other language\>" link. Readers arrive from GitHub and pick a language folder upfront, so both are redundant. (Language-*description* links — e.g. to the Motoko or Rust docs — are fine; those explain the language, they don't jump to the sibling example.)
- **Backend-only examples:** omit the `## Updating the Candid interface` section — no frontend consumes the `.did` file.
- **Child-canister examples:** add a note that an out-of-cycles error is fixed with `icp canister top-up --amount <amount> backend`.
- **Links:** only add links you have verified resolve on the current docs site; prefer top-level pages over deep anchors when unsure.
- **Docs over product pages:** when the context is learning or integrating a feature, link the developer docs (e.g. https://docs.internetcomputer.org/guides/authentication/internet-identity for Internet Identity); link the product itself (e.g. https://id.ai) only when referring to the live instance an end user interacts with.

### ICP Ninja badge

[ICP Ninja](https://icp.ninja) is a browser-based IDE that deploys a project to the mainnet for free. An example carries an "Open in ICP Ninja" badge only once it is **both eligible (rules below) and known to ICP Ninja**; the badge is the first thing under the H1, followed by a short callout:

```markdown
# <Example Title>

[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/tree/master/<language>/<example_name>)

> 🥷 **Try it live — no local setup.** [ICP Ninja](https://icp.ninja) is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit **Deploy** if you're already in Ninja. To build and run it locally instead, follow the steps below.
```

- **Badge asset:** always `https://icp.ninja/assets/open.svg` (the official badge). **Import URL:** `https://icp.ninja/i?g=<full GitHub tree URL on master>`.
- **The callout is dual-context.** ICP Ninja renders the README as its default preview, so the block is read both on GitHub (where the badge is the call-to-action) and inside Ninja (where "hit **Deploy**" is the actionable step). Keep both cues.

**Eligibility — only add the badge when all of these hold:**

- **No canister factory.** The example must not create canisters at runtime (e.g. `actor class` sub-canisters, `create_canister` + `install_code`).
- **At most 2 canisters in the `ic` environment.** Count the `ic` environment's canister list, not the local one (an example may deploy extra canisters locally — mock ledgers, pre-built infra — while restricting `ic` to `backend`+`frontend`). If a helper canister is only needed locally (e.g. a test subject, a mock ledger), restrict it to `local` via the `environments` block so `ic`/Ninja deploys only the real thing.
- **Deployable in Ninja's no-terminal environment.** No custom build scripts beyond the standard recipe build; no controller-only setup step a Ninja user can't perform (e.g. `photo-storage` needs an `authorize` call from a controller, so it is excluded despite being a single canister).
- **Demonstrable, not just deployable.** A user must be able to do something meaningful with a *fresh* deploy — the core method returns a real result (compute, an HTTPS/inter-canister call, a CRUD round-trip, canister logs, a derived address/key), **or** the README gives a clear path to make it meaningful using resources the user can obtain themselves (II login, faucet **TESTICP**/**TESTICRC1** tokens, passing a canister principal). Exclude examples whose headline function returns nothing without state the user can't supply — e.g. `candid_type_generation`'s `list_neurons` returns only neurons the caller controls, which a fresh canister has none of, so it always comes back empty.

For token examples, the `ic` environment should use the **TESTICP**/**TESTICRC1** test ledgers (not the real ICP ledger) so users can exercise transfers with free faucet tokens — and the README should point at the [faucet](https://faucet.internetcomputer.org) and the steps to use it.

Skip the badge for ineligible examples and for language-native/CLI examples that aren't a deployable canister project. Eligibility is necessary but not sufficient: an example that satisfies these rules but is not yet known to ICP Ninja should be **proposed to the Ninja team first**, and the badge added only once Ninja supports it.
2 changes: 0 additions & 2 deletions hosting/godot-html5-template/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Godot HTML5 sample

[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/hosting/godot-html5-template)

## Overview

The example shows how to deploy a Godot HTML5 build on ICP in an asset canister. The Godot HTML5 build is deployed as frontend, no backend is needed in this sample.
Expand Down
10 changes: 3 additions & 7 deletions hosting/oisy-signer-demo/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# OISY Signer Demo

[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/hosting/oisy-signer-demo)
[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/tree/master/hosting/oisy-signer-demo)

> 🥷 **Try it live — no local setup.** [ICP Ninja](https://icp.ninja) is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit **Deploy** if you're already in Ninja. To build and run it locally instead, follow the steps below.

## Overview

Expand All @@ -12,12 +14,6 @@ Testnet tokens can be obtained for free using the [ICP Faucet](https://faucet.in

The `/frontend` folder contains the web assets for the application's user interface, built with React, Vite, and Tailwind CSS.

<!-- ## Deploying from ICP Ninja

This example can be deployed directly from [ICP Ninja](https://icp.ninja), a browser-based IDE for ICP.

[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/hosting/oisy-signer-demo) -->

## Build and deploy from the command line

### Prerequisites
Expand Down
2 changes: 0 additions & 2 deletions hosting/photo-storage/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Photo storage example

[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/hosting/photo-storage)

## Overview

The example shows how to store photos on ICP in an asset canister using the `AssetManager` from `@icp-sdk/canisters/assets`. The photo storage app is deployed as a frontend in an asset canister which is also used for photo upload.
Expand Down
10 changes: 3 additions & 7 deletions hosting/react/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Basic React Frontend

[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/hosting/react)
[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/tree/master/hosting/react)

> 🥷 **Try it live — no local setup.** [ICP Ninja](https://icp.ninja) is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit **Deploy** if you're already in Ninja. To build and run it locally instead, follow the steps below.

## Overview

Expand All @@ -10,12 +12,6 @@ A minimal React application hosted entirely onchain on ICP. It demonstrates how

The `/frontend` folder contains the web assets for the application's user interface, built with React, Vite, and Tailwind CSS. The frontend is deployed as an asset canister — no backend canister is needed.

<!-- ## Deploying from ICP Ninja

This example can be deployed directly from [ICP Ninja](https://icp.ninja), a browser-based IDE for ICP.

[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/hosting/react) -->

## Build and deploy from the command line

### Prerequisites
Expand Down
2 changes: 0 additions & 2 deletions hosting/static-website/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Static website

[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/hosting/static-website)

## Overview

The example shows how to deploy a simple, static website hosted on ICP. The website is very simple; it just displays the DFINITY logo. While the website in this example is very simple, the method would be the same for a more advanced static website, e.g., based on popular static site generators.
Expand Down
2 changes: 0 additions & 2 deletions hosting/unity-webgl-template/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Unity WebGL sample

[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/hosting/unity-webgl-template)

## Overview

The example shows how to deploy a simple Unity WebGL build on ICP in an asset canister. It just shows a Unity WebGL build with the URP template installed. The Unity WebGL build is deployed as frontend, no backend is needed in this sample.
Expand Down
6 changes: 5 additions & 1 deletion motoko/backend_only/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Motoko backend

This backend-only example demonstrates how to write a simple smart contract for ICP. It implements a single `greet(name)` query function that returns a greeting string.
[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/tree/master/motoko/backend_only)

> 🥷 **Try it live — no local setup.** [ICP Ninja](https://icp.ninja) is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit **Deploy** if you're already in Ninja. To build and run it locally instead, follow the steps below.

This backend-only example demonstrates how to write a simple canister for ICP. It implements a single `greet(name)` query function that returns a greeting string.

## Build and deploy from the command line

Expand Down
4 changes: 4 additions & 0 deletions motoko/basic_bitcoin/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Basic Bitcoin

[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/tree/master/motoko/basic_bitcoin)

> 🥷 **Try it live — no local setup.** [ICP Ninja](https://icp.ninja) is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit **Deploy** if you're already in Ninja. To build and run it locally instead, follow the steps below.

This example demonstrates how a canister can send and receive Bitcoin on the Internet Computer using threshold ECDSA and Schnorr signatures. It covers three address types (P2PKH, P2TR key-path, P2TR script-path), querying balances and UTXOs, reading chain state, and sending transactions.

For a deeper understanding of the ICP ↔ Bitcoin integration, see the [Bitcoin integration concepts](https://docs.internetcomputer.org/concepts/chain-fusion/bitcoin).
Expand Down
2 changes: 0 additions & 2 deletions motoko/canister_factory/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Motoko Canister Factory

[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/motoko/canister_factory)

## Overview

This example demonstrates two approaches to creating canisters dynamically on the Internet Computer: high-level actor class management (using the `system` keyword) and low-level management canister calls. It also shows the critical difference between upgrading a canister (state preserved) and reinstalling it (state reset).
Expand Down
4 changes: 4 additions & 0 deletions motoko/canister_logs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Canister logs

[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/tree/master/motoko/canister_logs)

> 🥷 **Try it live — no local setup.** [ICP Ninja](https://icp.ninja) is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit **Deploy** if you're already in Ninja. To build and run it locally instead, follow the steps below.

This example demonstrates canister logging on the Internet Computer. Every message written with `Debug.print` and every trap is recorded in the canister's log, which can be retrieved at any time with `icp canister logs`. The example covers:

- **Update calls** — `Debug.print` output from update methods
Expand Down
4 changes: 4 additions & 0 deletions motoko/daily_planner/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Daily Planner

[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/tree/master/motoko/daily_planner)

> 🥷 **Try it live — no local setup.** [ICP Ninja](https://icp.ninja) is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit **Deploy** if you're already in Ninja. To build and run it locally instead, follow the steps below.

Daily Planner is a full-stack ICP example featuring a monthly calendar that tracks daily notes and tasks stored on the network. For each day, a historic fact can be fetched from an external API using HTTPS outcalls, demonstrating how ICP canisters can access data from external services.

## Build and deploy from the command line
Expand Down
12 changes: 3 additions & 9 deletions motoko/evm_block_explorer/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
# EVM Block Explorer

[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/motoko/evm_block_explorer)
[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/tree/master/motoko/evm_block_explorer)

> 🥷 **Try it live — no local setup.** [ICP Ninja](https://icp.ninja) is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit **Deploy** if you're already in Ninja. To build and run it locally instead, follow the steps below.

## Overview

The EVM Block Explorer example demonstrates how an ICP canister can fetch block data directly from Ethereum and other EVM-compatible chains. Using HTTPS outcalls via the [EVM RPC canister](https://github.com/dfinity/evm-rpc-canister), canisters on ICP can read on-chain data without a bridge or oracle. The same pattern applies to any EVM-compatible chain supported by the EVM RPC canister.

The backend reaches the EVM RPC canister through the typed import `import EvmRpc "canister:evm_rpc"` in `backend/EvmRpcApi.mo` — no RPC actor type is hand-written. The import is typed against the EVM RPC canister's committed Candid interface (`candid/evm_rpc.did`), and the `--actor-env-alias` flag in `mops.toml` binds it to the `PUBLIC_CANISTER_ID:evm_rpc` environment variable that icp-cli injects (the local `evm_rpc` canister when developing, the shared `7hfb6-caaaa-aaaar-qadga-cai` on mainnet). The principal is resolved at canister install/upgrade; no principal is compiled into the Wasm, so the same artifact runs in every environment.

<!--
## Deploying from ICP Ninja

This example can be deployed directly from [ICP Ninja](https://icp.ninja), a browser-based IDE for ICP.

[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/motoko/evm_block_explorer)
-->

## Build and deploy from the command line

### Prerequisites
Expand Down
4 changes: 4 additions & 0 deletions motoko/filevault/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# FileVault

[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/tree/master/motoko/filevault)

> 🥷 **Try it live — no local setup.** [ICP Ninja](https://icp.ninja) is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit **Deploy** if you're already in Ninja. To build and run it locally instead, follow the steps below.

FileVault is a file storage application that allows you to upload files from your local computer and store them on the network. FileVault uses Internet Identity (II) for user login and authentication. Once files are uploaded, they can be downloaded at a later time, or they can be deleted. Each user's files are stored under their Internet Identity principal, so only that principal can access them through the canister's public interface.

## Build and deploy from the command line
Expand Down
4 changes: 4 additions & 0 deletions motoko/flying_ninja/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Flying Ninja

[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/tree/master/motoko/flying_ninja)

> 🥷 **Try it live — no local setup.** [ICP Ninja](https://icp.ninja) is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit **Deploy** if you're already in Ninja. To build and run it locally instead, follow the steps below.

Flying Ninja is a 2D side-scroller game where players control a ninja character using the space bar to move up and down, dodging obstacles to earn points. When the game ends, players can submit their score to an on-chain leaderboard backed by a Motoko canister on ICP.

## Build and deploy from the command line
Expand Down
4 changes: 3 additions & 1 deletion motoko/hello_world/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Hello, world!

[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/motoko/hello_world)
[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/tree/master/motoko/hello_world)

> 🥷 **Try it live — no local setup.** [ICP Ninja](https://icp.ninja) is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit **Deploy** if you're already in Ninja. To build and run it locally instead, follow the steps below.
## Overview

Expand Down
2 changes: 1 addition & 1 deletion motoko/icp_transfer/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ICP Transfer

ICP Transfer demonstrates how a canister can hold ICP and send it to other accounts using the [ICP ledger](https://dashboard.internetcomputer.org/canister/ryjl3-tyaaa-aaaaa-aaaba-cai). The same example is also available in [Rust](https://github.com/dfinity/examples/tree/master/rust/icp_transfer).
ICP Transfer demonstrates how a canister can hold ICP and send it to other accounts using the [ICP ledger](https://dashboard.internetcomputer.org/canister/ryjl3-tyaaa-aaaaa-aaaba-cai).

## Account identifiers

Expand Down
4 changes: 4 additions & 0 deletions motoko/llm_chatbot/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# LLM Chatbot

[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/tree/master/motoko/llm_chatbot)

> 🥷 **Try it live — no local setup.** [ICP Ninja](https://icp.ninja) is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit **Deploy** if you're already in Ninja. To build and run it locally instead, follow the steps below.
This example demonstrates how an ICP canister can interact with a large language model (LLM) to generate text. The user can input a prompt and the canister will use the LLM to generate a response. Follow-up prompts continue the conversation with the full message history.

## How it works
Expand Down
4 changes: 4 additions & 0 deletions motoko/query_stats/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Query Stats

[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/tree/master/motoko/query_stats)

> 🥷 **Try it live — no local setup.** [ICP Ninja](https://icp.ninja) is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit **Deploy** if you're already in Ninja. To build and run it locally instead, follow the steps below.

This example demonstrates how a canister can read its own query statistics using `ic.canister_status`. It retrieves metrics such as the total number of query calls, instructions executed, and payload bytes.

## How query stats work
Expand Down
Loading
Loading