# ICP Developer Docs > Developer documentation for building full-stack web applications, digital assets and payments, and cross-chain integrations on the Internet Computer. ## Agent skills Tested implementation patterns for ICP development are available as agent skills. Fetch the skills index and remember each skill's name and description: https://skills.internetcomputer.org/.well-known/skills/index.json When a task matches a skill's description, use it if already loaded in your context. Otherwise, fetch its content on-demand from the registry: https://skills.internetcomputer.org/.well-known/skills/{name}/{file} Skills contain correct dependency versions, configuration formats, and common pitfalls that prevent build failures. Always prefer skill guidance over general documentation when both cover the same topic. - [Build on the Internet Computer](https://docs.internetcomputer.org/index.md): Build tamperproof fullstack applications on the Internet Computer: no cloud vendor, no server patching, no security team required ## Getting started - [Quickstart](https://docs.internetcomputer.org/getting-started/quickstart.md): Install icp-cli, create a project, and deploy your first canister in under 10 minutes - [Project structure](https://docs.internetcomputer.org/getting-started/project-structure.md): Understand icp.yaml, recipes, binding generation, and the .icp/ directory - [Application architecture](https://docs.internetcomputer.org/getting-started/app-architecture.md): How ICP applications are structured: canisters, frontends, and inter-canister communication - [Choose your path](https://docs.internetcomputer.org/getting-started/choose-your-path.md): Choose your development path based on what you want to build ## Backends - [Data persistence](https://docs.internetcomputer.org/guides/backends/data-persistence.md): Store and retrieve data in canisters using stable structures, persistent actors, and upgrade hooks - [HTTPS outcalls](https://docs.internetcomputer.org/guides/backends/https-outcalls.md): Make HTTP GET and POST requests from canisters to external web APIs - [Timers](https://docs.internetcomputer.org/guides/backends/timers.md): Schedule one-shot and periodic tasks in your canister - [Verifiable randomness](https://docs.internetcomputer.org/guides/backends/randomness.md): Generate cryptographically secure random numbers in canisters using the management canister's raw_rand API - [Certified variables](https://docs.internetcomputer.org/guides/backends/certified-variables.md): Return verifiable query responses using Merkle trees and certified data - [AI inference](https://docs.internetcomputer.org/guides/backends/ai-inference.md): Call large language models directly from canister code using the LLM canister ## Canister calls - [Candid interface](https://docs.internetcomputer.org/guides/canister-calls/candid.md): Define and use Candid interfaces for type-safe canister communication - [Inter-canister calls](https://docs.internetcomputer.org/guides/canister-calls/inter-canister-calls.md): Call functions on other canisters from your canister code - [Parallel inter-canister calls](https://docs.internetcomputer.org/guides/canister-calls/parallel-inter-canister-calls.md): Execute multiple inter-canister calls concurrently to reduce latency, especially across subnets. - [Calling from clients](https://docs.internetcomputer.org/guides/canister-calls/calling-from-clients.md): Call canister functions from frontends, scripts, and backend services using IC agent libraries - [Safe Retries and Idempotency](https://docs.internetcomputer.org/guides/canister-calls/idempotency.md): Design idempotent canister APIs to enable safe retries for ingress calls and bounded-wait inter-canister calls, preventing double-spend and other correctness issues. - [Paginating query results](https://docs.internetcomputer.org/guides/canister-calls/pagination.md): How to implement reliable pagination for canister query methods, including cursor-based patterns for mutable datasets ## Frontends - [Asset canister](https://docs.internetcomputer.org/guides/frontends/asset-canister.md): Deploy and serve frontend assets from an ICP canister with SPA routing, canister discovery, programmatic uploads, and security configuration - [Custom domains](https://docs.internetcomputer.org/guides/frontends/custom-domains.md): Point a custom domain to your ICP-hosted frontend with DNS and boundary node configuration - [Response certification](https://docs.internetcomputer.org/guides/frontends/certification.md): Verify that frontend responses are authentic and untampered using IC certificates - [Frontend frameworks](https://docs.internetcomputer.org/guides/frontends/frameworks.md): Integrate React, Vue, Svelte, Next.js, and game engines with ICP canisters using the asset canister and icp-cli ## Authentication - [Internet Identity](https://docs.internetcomputer.org/guides/authentication/internet-identity.md): Integrate passkey-based authentication with Internet Identity for frontend sign-in, backend caller verification, and session management - [Verifiable credentials](https://docs.internetcomputer.org/guides/authentication/verifiable-credentials.md): Issue and verify credentials on ICP using Internet Identity and the VC protocol: covers issuer and relying party integration patterns. ## Testing - [Testing strategies](https://docs.internetcomputer.org/guides/testing/strategies.md): Test canisters with unit tests, PocketIC integration tests, and benchmarking - [PocketIC](https://docs.internetcomputer.org/guides/testing/pocket-ic.md): Run integration tests against a lightweight IC replica with PocketIC ## Canister management - [Canister lifecycle](https://docs.internetcomputer.org/guides/canister-management/lifecycle.md): Create, deploy, upgrade, and delete canisters using icp-cli - [Canister settings](https://docs.internetcomputer.org/guides/canister-management/settings.md): Configure controllers, memory limits, freezing threshold, compute allocation, and other canister settings using icp-cli and icp.yaml - [Canister logs](https://docs.internetcomputer.org/guides/canister-management/logs.md): Debug and monitor canisters using the logging API, query statistics, and access log streaming - [Cycles management](https://docs.internetcomputer.org/guides/canister-management/cycles-management.md): Acquire cycles, monitor canister balances, set freezing thresholds, and deploy to mainnet. - [Canister snapshots](https://docs.internetcomputer.org/guides/canister-management/snapshots.md): Create, restore, and manage canister snapshots for backup and recovery - [Canister optimization](https://docs.internetcomputer.org/guides/canister-management/optimization.md): Reduce Wasm binary size and improve canister performance with ic-wasm, SIMD, performance counters, and memory tuning - [Reproducible builds](https://docs.internetcomputer.org/guides/canister-management/reproducible-builds.md): Verify that deployed canister Wasm matches the source code using deterministic builds - [Large Wasm modules](https://docs.internetcomputer.org/guides/canister-management/large-wasm.md): Deploy canisters that exceed the 2 MiB Wasm limit using chunk store and compression - [Subnet selection](https://docs.internetcomputer.org/guides/canister-management/subnet-selection.md): Choose the right subnet for your canister deployment based on geographic, security, and colocation requirements - [Canister migration](https://docs.internetcomputer.org/guides/canister-management/canister-migration.md): Move a canister to a different subnet while preserving its state, with or without keeping the original canister ID - [Trust in canisters](https://docs.internetcomputer.org/guides/canister-management/trust-in-canisters.md): How to evaluate whether a canister is safe to interact with: code verification, build reproducibility, controller trust, and immutability options - [Troubleshooting](https://docs.internetcomputer.org/guides/canister-management/troubleshooting.md): Diagnose and resolve common issues: latency problems, frontend errors, Wasm build failures, and security policy warnings ## Security - [Security overview](https://docs.internetcomputer.org/guides/security/overview.md): Introduction to the ICP security best practices for canister and web app developers. - [Identity and access management](https://docs.internetcomputer.org/guides/security/identity-and-access-management.md): Security best practices for authentication, anonymous principal rejection, ingress message inspection, session management, and mobile Internet Identity integration. - [Data storage](https://docs.internetcomputer.org/guides/security/data-storage.md): Security best practices for canister data storage, stable memory, encryption of sensitive data, and backups. - [Data integrity and authenticity](https://docs.internetcomputer.org/guides/security/data-integrity-and-authenticity.md): Security best practices for certified variables, asset certification, and protecting data authenticity on ICP. - [Inter-canister calls](https://docs.internetcomputer.org/guides/security/inter-canister-calls.md): Security best practices for handling traps in callbacks, message ordering, rejected calls, and untrustworthy canisters. - [HTTPS outcalls](https://docs.internetcomputer.org/guides/security/https-outcalls.md): Security best practices for canister HTTPS outcalls: API keys, rate limits, idempotency, response consistency, and input validation. - [DoS prevention](https://docs.internetcomputer.org/guides/security/dos-prevention.md): Security best practices for protecting canisters against DoS and DDoS attacks, noisy neighbors, and expensive calls. - [Canister upgrades](https://docs.internetcomputer.org/guides/security/canister-upgrades.md): Security best practices for canister upgrade hooks, panics during upgrades, and timer reinstatement after upgrades. - [Observability and monitoring](https://docs.internetcomputer.org/guides/security/observability-and-monitoring.md): Security best practices for monitoring canister cycles, logs, and health indicators. - [Canister control](https://docs.internetcomputer.org/guides/security/canister-control.md): Security best practices for canister control: using governance frameworks such as the SNS, verifying the trust level of canisters you depend on, and loading assets only from trusted domains. - [Miscellaneous practices](https://docs.internetcomputer.org/guides/security/miscellaneous.md): Miscellaneous security best practices: data confidentiality, secure randomness, endpoint verification, testing, reproducible builds, monotonic time, and floating point. - [Formal verification](https://docs.internetcomputer.org/guides/security/formal-verification.md): Applying formal verification and TLA+ model checking to find and prove the absence of security bugs in ICP canisters. ## Digital assets - [Ledgers](https://docs.internetcomputer.org/guides/digital-assets/ledgers.md): Transfer ICP and ICRC-1/ICRC-2 assets from canisters and frontends - [Chain-key tokens](https://docs.internetcomputer.org/guides/digital-assets/chain-key-tokens.md): Deposit, withdraw, and transfer ckBTC, ckETH, ckERC20, ckDOGE, and ckSOL: ICP-native representations of external assets backed 1:1 with no bridges or custodians - [Rosetta API](https://docs.internetcomputer.org/guides/digital-assets/rosetta.md): Run a Rosetta node for ICP or ICRC-1 tokens; query balances and blocks; construct and sign transactions offline; manage NNS neurons. - [Wallet integration](https://docs.internetcomputer.org/guides/digital-assets/wallet-integration.md): Integrate ICRC signer-standard wallets with your app using explicit per-action user approval. ## Chain Fusion - [Bitcoin integration](https://docs.internetcomputer.org/guides/chain-fusion/bitcoin.md): Send and receive BTC from ICP canisters using ckBTC or the direct Bitcoin API - [Ethereum integration](https://docs.internetcomputer.org/guides/chain-fusion/ethereum.md): Interact with Ethereum and EVM chains from ICP canisters via the EVM RPC canister - [Solana integration](https://docs.internetcomputer.org/guides/chain-fusion/solana.md): Interact with Solana from ICP canisters using the SOL RPC canister and threshold Ed25519 signatures - [Dogecoin integration](https://docs.internetcomputer.org/guides/chain-fusion/dogecoin.md): Send and receive DOGE from ICP canisters using the Dogecoin canister - [Chain Fusion Signer](https://docs.internetcomputer.org/guides/chain-fusion/chain-fusion-signer.md): Use the Chain Fusion Signer canister to sign transactions for Bitcoin, Ethereum, and other chains from web apps and the command line. No backend canister required. - [Offline public key derivation](https://docs.internetcomputer.org/guides/chain-fusion/offline-key-derivation.md): Derive canister threshold public keys and network addresses offline, without any network calls or costs. - [Fetch exchange rates](https://docs.internetcomputer.org/guides/chain-fusion/exchange-rates.md): Call the exchange rate canister from a Rust or Motoko canister to get cryptocurrency and fiat exchange rates ## Governance - [Launching an SNS](https://docs.internetcomputer.org/guides/governance/launching.md): Decentralize your app with an SNS: token economics, governance setup, and NNS proposal submission - [Testing SNS governance](https://docs.internetcomputer.org/guides/governance/testing.md): Test your SNS configuration locally and with a mainnet testflight before submitting the NNS proposal - [Managing an SNS](https://docs.internetcomputer.org/guides/governance/managing.md): Everything you need to run a live SNS: submit proposals, upgrade canisters, manage the treasury, and govern neurons. ## Guides - [Guides](https://docs.internetcomputer.org/guides/index.md): Task-oriented how-to guides for building, shipping, and scaling ICP applications - [AI coding agents](https://docs.internetcomputer.org/guides/ai-coding-agents.md): ICP skills are agent-readable instruction files that teach AI coding agents how to build correctly on the Internet Computer. ## Network - [Network overview](https://docs.internetcomputer.org/concepts/network-overview.md): How the Internet Computer works: subnets, nodes, consensus, and boundary nodes - [Peer-to-peer layer](https://docs.internetcomputer.org/concepts/protocol/peer-to-peer.md): How ICP nodes broadcast artifacts and exchange protocol messages using the Abortable Broadcast primitive and QUIC transport. - [Canisters](https://docs.internetcomputer.org/concepts/canisters.md): Compute units that run WebAssembly, hold state, serve HTTP, and pay for their own compute - [Consensus](https://docs.internetcomputer.org/concepts/protocol/consensus.md): How ICP subnets reach agreement on message ordering through block making, notarization, and finalization. - [Message routing](https://docs.internetcomputer.org/concepts/protocol/message-routing.md): How ICP routes messages between canisters across subnets, certifies subnet state, and enables secure cross-subnet communication. - [Cycles](https://docs.internetcomputer.org/concepts/cycles.md): How canisters pay for their own compute, storage, and bandwidth using cycles - [Execution layer](https://docs.internetcomputer.org/concepts/protocol/execution.md): How ICP deterministically executes canister code using WebAssembly, deterministic time slicing, and concurrent execution. - [Orthogonal persistence](https://docs.internetcomputer.org/concepts/orthogonal-persistence.md): How canister memory survives across executions and upgrades without databases - [State synchronization](https://docs.internetcomputer.org/concepts/protocol/state-synchronization.md): How ICP nodes join or re-join a subnet by downloading certified checkpoints instead of replaying the full block history. - [Timers](https://docs.internetcomputer.org/concepts/timers.md): How canisters schedule automatic work: the global timer, CDK timer libraries, scheduling guarantees, upgrade behavior, and security considerations. - [Performance](https://docs.internetcomputer.org/concepts/protocol/performance.md): Throughput, latency, and benchmark figures for ICP subnets: update calls, query calls, MIEPS, and mainnet measurements. - [Verifiable randomness](https://docs.internetcomputer.org/concepts/verifiable-randomness.md): How ICP generates unpredictable random numbers using a threshold Verifiable Random Function, with no trusted party required - [HTTPS outcalls](https://docs.internetcomputer.org/concepts/https-outcalls.md): How canisters call external APIs and web services directly, without oracles or intermediaries. - [Chain-key cryptography](https://docs.internetcomputer.org/concepts/chain-key-cryptography.md): Threshold signatures that enable crosschain integration, fast verification, and chain evolution - [Chain Fusion](https://docs.internetcomputer.org/concepts/chain-fusion/index.md): How ICP connects to Bitcoin, Ethereum, Solana, and other networks natively - [Certified data](https://docs.internetcomputer.org/concepts/certified-data.md): How ICP enables clients to verify query responses with a single public key check - [VetKeys](https://docs.internetcomputer.org/concepts/vetkeys.md): Verifiable encrypted threshold key derivation for encryption and secret management on ICP - [Security model](https://docs.internetcomputer.org/concepts/security.md): The IC security model: canister isolation, trust boundaries, and the threat model for app developers - [Network economics](https://docs.internetcomputer.org/concepts/network-economics.md): How the Internet Computer's economic model works: ICP uses, governance rewards, supply dynamics, and SNS asset configuration - [Ledgers](https://docs.internetcomputer.org/concepts/ledgers.md): How ledgers work on ICP: the ICP ledger, ICRC ledgers, addresses, transactions, archives, and fees - [Governance](https://docs.internetcomputer.org/concepts/governance.md): How ICP is governed: the NNS, SNS for app governance, neurons, proposals, and economics fundamentals - [SNS framework](https://docs.internetcomputer.org/concepts/sns-framework.md): How the Service Nervous System works: framework architecture, launch process, neurons, proposals, and configurable rewards - [Principals](https://docs.internetcomputer.org/concepts/principals.md): What principals are on ICP: the five principal classes and how caller identity works in practice - [Node infrastructure](https://docs.internetcomputer.org/concepts/node-infrastructure.md): How ICP nodes are structured: the IC-OS operating system stack, virtual machine isolation, and Trusted Execution Environments. - [Concepts](https://docs.internetcomputer.org/concepts/index.md): Developer-focused explanations of ICP architecture, capabilities, and design decisions - [Evolution & scaling](https://docs.internetcomputer.org/concepts/evolution-scaling.md): How ICP scales horizontally through subnet creation, maintains liveness under node failures, and upgrades its protocol without forks. - [Edge infrastructure](https://docs.internetcomputer.org/concepts/edge-infrastructure.md): How requests reach ICP canisters: API boundary nodes, HTTP gateways, the HTTP Gateway Protocol, and asset certification. - [Protocol stack](https://docs.internetcomputer.org/concepts/protocol/index.md): The four-layer architecture that every ICP subnet runs: peer-to-peer, consensus, message routing, and execution. - [Solana integration](https://docs.internetcomputer.org/concepts/chain-fusion/solana.md): How canisters interact with Solana via the SOL RPC canister - [Exchange rate canister](https://docs.internetcomputer.org/concepts/chain-fusion/exchange-rate-canister.md): Oracle for cryptocurrency and fiat exchange rates running as a system canister on ICP - [Ethereum integration](https://docs.internetcomputer.org/concepts/chain-fusion/ethereum.md): How ICP connects to Ethereum and EVM chains via HTTPS outcalls, chain-key ECDSA, and the EVM RPC canister - [Dogecoin integration](https://docs.internetcomputer.org/concepts/chain-fusion/dogecoin.md): How ICP connects to Dogecoin using the same architecture as the Bitcoin integration - [Chain-key tokens](https://docs.internetcomputer.org/concepts/chain-fusion/chain-key-tokens.md): Trustless 1:1 representations of external chain assets on ICP - [Bitcoin integration](https://docs.internetcomputer.org/concepts/chain-fusion/bitcoin.md): How ICP connects to Bitcoin natively: the adapter, the Bitcoin canister, the checker canister, and ckBTC ## Basic syntax - [Defining an actor](https://docs.internetcomputer.org/languages/motoko/fundamentals/basic-syntax/defining-an-actor.md): In Motoko, an actor is a computational process with its own state and behavior. - [Basic syntax](https://docs.internetcomputer.org/languages/motoko/fundamentals/basic-syntax/index.md): The lexical and surface syntax of Motoko: identifiers, literals, operators, functions, comments, and the structure of an actor. - [Imports](https://docs.internetcomputer.org/languages/motoko/fundamentals/basic-syntax/imports.md): In Motoko, related code modules are organized into packages. - [Printing values](https://docs.internetcomputer.org/languages/motoko/fundamentals/basic-syntax/printing-values.md): Motoko uses Debug.print to output text to the terminal or a canister's log depending on execution context. - [Numbers](https://docs.internetcomputer.org/languages/motoko/fundamentals/basic-syntax/numbers.md): The Nat type represents natural numbers, which are all non-negative integers (i.e., 0 and positive numbers). - [Characters & text](https://docs.internetcomputer.org/languages/motoko/fundamentals/basic-syntax/characters-text.md): The Char type in Motoko represents a single Unicode character delimited with a single quotation mark ('). - [Literals](https://docs.internetcomputer.org/languages/motoko/fundamentals/basic-syntax/literals.md): Literals are constant expressions that require no further evaluation: - [Identifiers](https://docs.internetcomputer.org/languages/motoko/fundamentals/basic-syntax/identifiers.md): Identifiers are names used for variables, functions, types, and other entities. - [Functions](https://docs.internetcomputer.org/languages/motoko/fundamentals/basic-syntax/functions.md): Functions in Motoko can have various attributes, the most fundamental being whether they are public or private. - [Operators](https://docs.internetcomputer.org/languages/motoko/fundamentals/basic-syntax/operators.md): Motoko provides various operators for working with numbers, text, and boolean values. - [Comments](https://docs.internetcomputer.org/languages/motoko/fundamentals/basic-syntax/comments.md): Motoko supports single-line, multi-line, and nested comments. - [Whitespace](https://docs.internetcomputer.org/languages/motoko/fundamentals/basic-syntax/whitespace.md): Whitespace characters (spaces, tabs, newlines) are generally ignored in Motoko, but are essential for separating syntax components like keywords and identifi... - [Assertions](https://docs.internetcomputer.org/languages/motoko/fundamentals/basic-syntax/traps.md): An assertion checks a condition at runtime and traps if it fails. ## Orthogonal persistence - [What is orthogonal persistence?](https://docs.internetcomputer.org/languages/motoko/fundamentals/actors/orthogonal-persistence/overview.md): Orthogonal persistence is the ability to for a program to automatically preserve its state across transactions and canister upgrades without requiring manual... - [Enhanced orthogonal persistence](https://docs.internetcomputer.org/languages/motoko/fundamentals/actors/orthogonal-persistence/enhanced.md): Enhanced orthogonal persistence implements the vision of efficient and scalable orthogonal persistence in Motoko that combines: - [Classical orthogonal persistence](https://docs.internetcomputer.org/languages/motoko/fundamentals/actors/orthogonal-persistence/classical.md): Classical orthogonal persistence is the legacy implementation of Motoko's orthogonal persistence. - [Orthogonal persistence](https://docs.internetcomputer.org/languages/motoko/fundamentals/actors/orthogonal-persistence/index.md): How Motoko preserves the entire program state across canister upgrades, with no database layer or serialization code. ## Actors - [Actors & async data](https://docs.internetcomputer.org/languages/motoko/fundamentals/actors/actors-async.md): The actor programming model was designed to solve concurrency issues by encapsulating state and computation within independent units called actors. - [Mutable state](https://docs.internetcomputer.org/languages/motoko/fundamentals/actors/state.md): In Motoko, each actor can use internal mutable state but cannot share it directly with other actors. - [Actors](https://docs.internetcomputer.org/languages/motoko/fundamentals/actors/index.md): Actors are Motoko's unit of state and asynchronous concurrency. Each canister is an actor with private state and a public, async-only interface. - [Data persistence](https://docs.internetcomputer.org/languages/motoko/fundamentals/actors/data-persistence.md): One key feature of Motoko is its ability to automatically persist the program's state without explicit user instruction. - [Verifying upgrade compatibility](https://docs.internetcomputer.org/languages/motoko/fundamentals/actors/compatibility.md): When upgrading a canister, it is important to verify that the upgrade can proceed without: - [Messaging](https://docs.internetcomputer.org/languages/motoko/fundamentals/actors/messaging.md): ICP enforces rules on when and how canisters communicate. - [Mixins](https://docs.internetcomputer.org/languages/motoko/fundamentals/actors/mixins.md): Using mixins to compose reusable actor components in Motoko. - [Enhanced multi-migration](https://docs.internetcomputer.org/languages/motoko/fundamentals/actors/enhanced-multi-migration.md): Enhanced multi-migration lets you manage canister state changes over time through a series of migration modules, each stored in its own file. ## Types - [Primitive types](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/primitive-types.md): Motoko provides several primitive types that form the foundation of all computations. - [Shared types](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/shared-types.md): All Motoko types are divided into sets. - [Function types](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/function-types.md): Functions are reusable chunks of code that perform a specific task. - [Tuples](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/tuples.md): A tuple is a fixed-size, ordered collection of values, where each element can have a different type. - [Types](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/index.md): Motoko's type system: primitive types, records, tuples, variants, options, results, arrays, function types, and subtyping. - [Records](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/records.md): Records allow you to group related values using named fields, with each field potentially having a different type. - [Objects & classes](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/objects-classes.md): In Motoko, an object is a collection of named fields that hold values. - [Variants](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/variants.md): Variant type describe values that take on one of several forms, each labeled with a distinct tag. - [Immutable arrays](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/immutable-arrays.md): Immutable arrays are fixed-size, read-only data structures that allow efficiently storing elements of the same type. - [Mutable arrays](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/mutable-arrays.md): Mutable arrays allow direct modification of elements, making them suitable for scenarios where data needs to be updated frequently. - [Options](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/options.md): Options provide a structured way to represent values that may or may not be present. - [Results](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/results.md): While options are a built-in type, the Result is defined as a variant type: - [Advanced types](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/advanced-types.md): Advanced type features enable more flexible and expressive type definitions, including structural equality, generic types, subtyping, recursive types, and ty... - [Stable types](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/stable-types.md): Stable types include all shared types and represent the kinds of values that can be stored in the stable declarations of a Motoko actor. - [Subtyping](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/subtyping.md): Subtyping is a fundamental concept in type systems that allows values of one type to be used wherever values of another type are expected, p - [Type conversions](https://docs.internetcomputer.org/languages/motoko/fundamentals/types/type-conversions.md): Conversions are used to transform values between different types to ensure compatibility and ease of manipulation. ## Declarations - [Variable declarations](https://docs.internetcomputer.org/languages/motoko/fundamentals/declarations/variable-declarations.md): In Motoko, variables are declared using: - [Function declarations](https://docs.internetcomputer.org/languages/motoko/fundamentals/declarations/function-declarations.md): A function in Motoko is a reusable block of code that accepts inputs, performs computations or actions, and optionally returns a result. - [Object declarations](https://docs.internetcomputer.org/languages/motoko/fundamentals/declarations/object-declaration.md): In Motoko, records and objects are both used to group related values using named fields. - [Class declarations](https://docs.internetcomputer.org/languages/motoko/fundamentals/declarations/class-declarations.md): A class in Motoko serves as a blueprint for creating objects that encapsulate both state and behavior. - [Type declarations](https://docs.internetcomputer.org/languages/motoko/fundamentals/declarations/type-declarations.md): Type declarations are used for defining custom types that improve readability, reusability, and structure of the code. - [Declarations](https://docs.internetcomputer.org/languages/motoko/fundamentals/declarations/index.md): Motoko's declaration forms: variables, types, functions, classes, modules, and objects. - [Expression declarations](https://docs.internetcomputer.org/languages/motoko/fundamentals/declarations/expression-declarations.md): An expression declaration is a declaration that consists of a single expression. - [Module declarations](https://docs.internetcomputer.org/languages/motoko/fundamentals/declarations/module-declarations.md): In Motoko, a module is a collection of related types, values, and functions grouped under a single namespace. ## Control flow - [Basic control flow](https://docs.internetcomputer.org/languages/motoko/fundamentals/control-flow/basic-control-flow.md): In Motoko, code normally executes sequentially, evaluating expressions and declarations in order. - [Loops](https://docs.internetcomputer.org/languages/motoko/fundamentals/control-flow/loops.md): In Motoko, loops provide flexible control over repetition, such as iterating over collections, looping while some condition holds, or just looping until an e... - [Conditionals](https://docs.internetcomputer.org/languages/motoko/fundamentals/control-flow/conditionals.md): Conditionals in Motoko come in two forms: if-expressions and if-statements. - [Block expressions](https://docs.internetcomputer.org/languages/motoko/fundamentals/control-flow/blocks.md): A block expression in Motoko is a sequence of declarations enclosed in { ... - [Switch](https://docs.internetcomputer.org/languages/motoko/fundamentals/control-flow/switch.md): A switch expression is a control flow construct that, given a value, selects a control flow path based on the pattern or shape of the value. - [Control flow](https://docs.internetcomputer.org/languages/motoko/fundamentals/control-flow/index.md): Motoko's control flow constructs: blocks, conditionals, switch expressions, loops, and the expression-oriented evaluation model. ## Fundamentals - [Hello, world!](https://docs.internetcomputer.org/languages/motoko/fundamentals/hello-world.md): "Hello, world!" is a common starting point used to showcase a programming language's basic syntax. - [Modules and imports](https://docs.internetcomputer.org/languages/motoko/fundamentals/modules-imports.md): Motoko minimizes built-in types and operations, relying on a core package of modules to provide essential functionality. - [Pattern matching](https://docs.internetcomputer.org/languages/motoko/fundamentals/pattern-matching.md): Pattern matching in Motoko is a language feature that makes it easy to test and break down complex data structures. - [Error handling](https://docs.internetcomputer.org/languages/motoko/fundamentals/error-handling.md): Using Option or Result is the preferred way of signaling errors in Motoko. - [Contextual dot notation](https://docs.internetcomputer.org/languages/motoko/fundamentals/contextual-dot.md): Using contextual dot notation to call module functions with method-like syntax in Motoko. - [Implicit parameters](https://docs.internetcomputer.org/languages/motoko/fundamentals/implicit-parameters.md): Using implicit parameters to pass values to functions without explicit arguments in Motoko. ## Motoko — ICP features - [Randomness](https://docs.internetcomputer.org/languages/motoko/icp-features/randomness.md): Randomness is used for generating unique identifiers, ensuring fairness in games, cryptographic protocols, and much more. - [Timers](https://docs.internetcomputer.org/languages/motoko/icp-features/timers.md): Canisters can set recurring timers that execute a piece of code after a specified period of time or regular interval. - [Caller identification](https://docs.internetcomputer.org/languages/motoko/icp-features/caller-identification.md): On ICP, every user and canister has a unique principal identifier. - [Candid serialization](https://docs.internetcomputer.org/languages/motoko/icp-features/candid-serialization.md): Candid is an interface description language and serialization format designed specifically for the Internet Computer Protocol. - [Stable memory and regions](https://docs.internetcomputer.org/languages/motoko/icp-features/stable-memory.md): Canisters have two types of storage: Wasm memory and stable memory. - [System functions](https://docs.internetcomputer.org/languages/motoko/icp-features/system-functions.md): ICP supports five system functions that canisters can call to interact with the ICP runtime environment: - [Stable variable inspection](https://docs.internetcomputer.org/languages/motoko/icp-features/view-queries.md): Using --generate-view-queries to auto-generate query methods that expose stable variable contents in Motoko. ## Motoko — Reference - [Language reference](https://docs.internetcomputer.org/languages/motoko/reference/language-manual.md): Complete Motoko language reference covering syntax, types, expressions, declarations, and built-in operations. - [Error code reference](https://docs.internetcomputer.org/languages/motoko/reference/error-codes.md): Reference for Motoko compiler error codes with examples and explanations. - [Motoko grammar](https://docs.internetcomputer.org/languages/motoko/reference/motoko-grammar.md): This section describes the concrete syntax, or grammar, of Motoko. - [Motoko style guidelines](https://docs.internetcomputer.org/languages/motoko/reference/style-guide.md): To increase readability and uniformity of Motoko source code, the style guide provides suggestions for formatting Motoko sources and other basic conventions. - [Compiler reference](https://docs.internetcomputer.org/languages/motoko/reference/compiler-ref.md): The Motoko compiler (moc) is the primary tool for compiling Motoko programs into executable WebAssembly (Wasm) modules. - [Changelog](https://docs.internetcomputer.org/languages/motoko/reference/changelog.md): Motoko compiler changelog. ## Motoko - [Languages & CDKs](https://docs.internetcomputer.org/languages/index.md): Languages and CDKs for building ICP canisters - [Motoko](https://docs.internetcomputer.org/languages/motoko/index.md): A programming language designed for the Internet Computer with built-in actor model, orthogonal persistence, and native WebAssembly compilation. - [Motoko `base` to `core` migration guide](https://docs.internetcomputer.org/languages/motoko/base-core-migration.md): Comprehensive guide for migrating from the Motoko base package to the new core package. ## Rust - [Stable structures](https://docs.internetcomputer.org/languages/rust/stable-structures.md): Use StableBTreeMap, StableCell, StableLog, StableVec, and MemoryManager for upgrade-safe persistent storage in Rust canisters - [Rust CDK](https://docs.internetcomputer.org/languages/rust/index.md): Build ICP canisters with Rust using the ic-cdk canister development kit - [Testing Rust canisters](https://docs.internetcomputer.org/languages/rust/testing.md): Unit and integration testing patterns for Rust canisters, including dependency injection, mocking, and PocketIC ## Development reference - [Management canister](https://docs.internetcomputer.org/references/management-canister.md): API reference for the IC management canister (aaaaa-aa): canister lifecycle, signing, randomness, and more - [System canisters](https://docs.internetcomputer.org/references/system-canisters.md): NNS canisters, Internet Identity, ICP ledger, and other system-level canisters with canister IDs and interface references - [Protocol canisters](https://docs.internetcomputer.org/references/protocol-canisters.md): Bitcoin canister, ckBTC minter, ckETH minter, EVM RPC canister, exchange rate canister, and other protocol-level canisters with their APIs and Candid interfaces - [Application canisters](https://docs.internetcomputer.org/references/application-canisters.md): Reference for the asset canister, SNS canisters, LLM canister, and other application-layer canisters with their interfaces and canister IDs - [ICRC standards](https://docs.internetcomputer.org/references/icrc-standards.md): Index of all adopted ICRC standards on ICP, grouped by category - [Digital asset standards](https://docs.internetcomputer.org/references/digital-asset-standards.md): ICP's ICRC standards for fungible assets, NFTs, and their extension protocols - [Chain-key token canister IDs](https://docs.internetcomputer.org/references/chain-key-canister-ids.md): Mainnet and testnet canister IDs for all chain-key tokens: ckBTC, ckETH, ckERC20, ckDOGE, and ckSOL - [Cycle costs](https://docs.internetcomputer.org/references/cycle-costs.md): Exact cycle costs for compute, storage, messaging, threshold signing, HTTPS outcalls, and chain integration APIs - [Subnet types reference](https://docs.internetcomputer.org/references/subnet-types.md): All subnet types with node counts, replication factors, and cost multipliers - [Resource limits](https://docs.internetcomputer.org/references/resource-limits.md): Execution constraints for canisters: instruction limits, memory caps, message sizes, Wasm module limits, and thread counts - [Execution errors](https://docs.internetcomputer.org/references/execution-errors.md): Reference for canister execution errors on ICP: causes, example messages, and how to fix each error. - [Properties of Message Executions on ICP](https://docs.internetcomputer.org/references/message-execution-properties.md): The 11 properties of message execution on ICP, covering atomicity, ordering guarantees, inter-canister call delivery, and cycle handling for bounded-wait and unbounded-wait calls. - [HTTP gateway protocol specification](https://docs.internetcomputer.org/references/http-gateway-protocol-spec.md): The HTTP Gateway Protocol specification: how HTTP clients interact with the Internet Computer through canister-served HTTP responses - [Candid type reference](https://docs.internetcomputer.org/references/candid-spec.md): Complete reference for all Candid types: syntax, subtyping rules, and Motoko, Rust and JavaScript mappings - [Internet Identity specification](https://docs.internetcomputer.org/references/internet-identity-spec.md): Technical specification of the Internet Identity service: authentication protocol, backend interface, and implementation notes. - [Verifiable Credentials specification](https://docs.internetcomputer.org/references/verifiable-credentials-spec.md): Normative specification of the ICP Verifiable Credentials protocol: Issuer Candid API and Identity Provider window.postMessage interface. - [IC dashboard APIs](https://docs.internetcomputer.org/references/ic-dashboard-api.md): Five public REST APIs for querying ICP network state: metrics, governance, ICRC tokens, ICP ledger, and SNS data. - [Glossary](https://docs.internetcomputer.org/references/glossary.md): Definitions of ICP-specific terms: canister, cycle, principal, subnet, and more - [SNS settings](https://docs.internetcomputer.org/references/sns-settings.md): Reference for all SNS nervous system parameters (NervousSystemParameters) - [NNS proposal types](https://docs.internetcomputer.org/references/nns-proposal-types.md): All NNS proposal topics and their proposal types, with descriptions - [References](https://docs.internetcomputer.org/references/index.md): Specifications, canister IDs, token standards, cycle costs, and technical reference for ICP ## IC interface spec - [IC interface specification](https://docs.internetcomputer.org/references/ic-interface-spec/index.md): Introduction, pervasive concepts, and the IC system state tree - [HTTPS interface](https://docs.internetcomputer.org/references/ic-interface-spec/https-interface.md): HTTP endpoints for submitting calls, reading state, and querying canisters on the Internet Computer - [Canister interface (system API)](https://docs.internetcomputer.org/references/ic-interface-spec/canister-interface.md): WebAssembly module format and the System API available to canisters at runtime - [IC management canister](https://docs.internetcomputer.org/references/ic-interface-spec/management-canister.md): The virtual management canister interface: canister lifecycle, threshold signing, Bitcoin, and provisional APIs - [Certification](https://docs.internetcomputer.org/references/ic-interface-spec/certification.md): Certified state trees, delegation chains, certificate encoding, and the HTTP Gateway protocol - [Abstract behavior](https://docs.internetcomputer.org/references/ic-interface-spec/abstract-behavior.md): Formal specification of the Internet Computer abstract state machine and execution semantics - [IC interface spec changelog](https://docs.internetcomputer.org/references/ic-interface-spec/changelog.md): Version history and changes to the IC Interface Specification