|
1 | 1 | --- |
2 | 2 | title: "Principals" |
3 | | -description: "What principals are on ICP: the identity model, principal classes, canister control, and how authentication works" |
| 3 | +description: "What principals are on ICP: the five principal classes and how caller identity works in practice" |
4 | 4 | --- |
5 | 5 |
|
6 | 6 | A **principal** is any entity that can authenticate with the Internet Computer and be identified when calling a canister. Principals are the building block of identity and access control on ICP: canisters use them to identify callers, enforce permissions, and determine which entities have control over which resources. |
@@ -31,42 +31,10 @@ Unsigned request → 2vxsx-fae (anonymous principal) |
31 | 31 |
|
32 | 32 | This means that from a canister's perspective, all callers are principals. There is no separate "user object" or session token: the principal is the identity. |
33 | 33 |
|
34 | | -## Canister control |
35 | | - |
36 | | -Canisters are managed by their **controllers**: a list of principals (users, other canisters, or DAOs) that have permission to perform management operations on the canister. Controllers can: |
37 | | - |
38 | | -- Upgrade the canister's Wasm module. |
39 | | -- Change canister settings (compute allocation, memory allocation, freezing threshold). |
40 | | -- Start or stop the canister. |
41 | | -- Delete the canister and claim its remaining cycles. |
42 | | -- Add or remove other controllers. |
43 | | - |
44 | | -The control structure can take several forms: |
45 | | - |
46 | | -| Control structure | Who is the controller | Effect | |
47 | | -|---|---|---| |
48 | | -| Centralized | A single developer's principal | Full developer control; standard for development | |
49 | | -| Multi-signature | A multi-signer wallet like [Orbit](https://orbitwallet.io/) | Requires multiple keys to approve changes | |
50 | | -| DAO-governed | An SNS governance canister | Upgrades require a governance proposal | |
51 | | -| No controller | Empty controller list | Immutable canister; code can never be changed | |
52 | | - |
53 | | -When a canister has no controllers, it is **immutable**: no one can modify its code or settings. Users who want to trust that a canister's behavior will never change can verify this on the [ICP Dashboard](https://dashboard.internetcomputer.org). |
54 | | - |
55 | | -## Canister upgrades and stable memory |
56 | | - |
57 | | -When a controller upgrades a canister, the new Wasm module replaces the old one. By default, Wasm heap memory is cleared on upgrade because the new module may have a different memory layout. However, **stable memory is always preserved** across upgrades: it is explicitly managed by the canister (via system API calls) and designed to survive code changes. |
58 | | - |
59 | | -The runtime runs upgrade hooks atomically around the code swap: |
60 | | -1. `pre_upgrade` (or `system func preupgrade` in Motoko): save any heap data to stable memory. |
61 | | -2. New Wasm module is installed. |
62 | | -3. `post_upgrade` (or `system func postupgrade`): read data back from stable memory into the new heap layout. |
63 | | - |
64 | | -If the `pre_upgrade` hook traps, the upgrade is aborted and the canister continues running the old code. If `post_upgrade` traps, the new code is installed but the canister is left in a failed state. |
65 | | - |
66 | 34 | ## Next steps |
67 | 35 |
|
68 | | -- [Canisters](canisters.md): how canisters work, lifecycle, and message types |
| 36 | +- [Canisters](canisters.md): how canisters work, controllers, lifecycle, and message types |
69 | 37 | - [Authentication](../guides/authentication/internet-identity.md): integrating Internet Identity and other authentication providers |
70 | 38 | - [IC Interface Specification: Principals](../references/ic-interface-spec/index.md#principal): the formal specification |
71 | 39 |
|
72 | | -<!-- Upstream: informed by Learn Hub articles "What is a Principal?", "Canister Control" (migrated, source retired) --> |
| 40 | +<!-- Upstream: informed by Learn Hub article "What is a Principal?" (migrated, source retired) --> |
0 commit comments