cycles-management
БесплатноБез исполняемых скриптовНе проверенManage cycles and canister lifecycle. Covers cycle balance checks, top-ups, freezing thresholds, canister creation, and ICP-to-cycles conversion via the CMC…
от jiayaoqijia★ 81 звезда на GitHubОб этом скилле
Cycles & Canister Management
What This Is
Cycles are the computation fuel for canisters on Internet Computer. Every canister operation (execution, storage, messaging) burns cycles. When a canister runs out of cycles, it freezes and is eventually uninstalled -- its code and data are deleted, but its metadata (canister ID, controllers, settings) survives. 1 trillion cycles (1T) costs approximately 1 USD equivalent in ICP (the exact rate is set by the NNS and fluctuates with ICP price via the CMC).
Note: icp-cli uses the cycles ledger (um5iw-rqaaa-aaaaq-qaaba-cai) by default. The cycles ledger is a single canister that tracks cycle balances for all principals, similar to a token ledger. Commands like icp cycles balance, icp cycles mint, and icp canister top-up go through the cycles ledger. There is no legacy wallet concept in icp-cli. The programmatic patterns below (accepting cycles, creating canisters via management canister) remain the same regardless of which funding mechanism is used.
Prerequisites
- For Motoko:
mopspackage manager,core = "2.0.0"in mops.toml - For Rust:
ic-cdk >= 0.19
Canister IDs
| Service | Canister ID | Purpose |
|---|---|---|
| Cycles Minting Canister (CMC) | rkp4c-7iaaa-aaaaa-aaaca-cai |
Converts ICP to cycles, creates canisters |
| Cycles Ledger | um5iw-rqaaa-aaaaq-qaaba-cai |
Tracks cycle balances for all principals |
| Management Canister | aaaaa-aa |
Canister lifecycle (create, install, stop, delete, status) |
The Management Canister (aaaaa-aa) is a virtual canister -- it does not exist on a specific subnet but is handled by every subnet's execution layer.
Mistakes That Break Your Build
Running out of cycles silently freezes the canister -- There is no warning. A frozen canister stops executing messages but keeps paying rent for its memory and allocations, so the balance continues to drain. When it reaches zero the canister is uninstalled: code and data are gone permanently, and only the metadata (canister ID, controllers, settings) remains. Set a freezing threshold and monitor balances.
Not setting freezing_threshold -- Default is 30 days. If your canister burns cycles fast (high traffic, large stable memory), 30 days may not be enough warning. Set it higher for production canisters. The freezing threshold defines how many seconds worth of idle cycles the canister must retain before it freezes.
Confusing local vs mainnet cycles -- Local replicas give canisters virtually unlimited cycles. Code that works locally may fail on mainnet because the canister has insufficient cycles. Always test with realistic cycle amounts before mainnet deployment.
Sending cycles to the wrong canister -- Cycles sent to a canister cannot be retrieved. There is no refund mechanism for cycles transferred to the wrong principal. Double-check the canister ID before topping up.
Forgetting to set the canister controller -- If you lose the controller identity, you permanently lose the ability to upgrade, top up, or manage the canister. Always add a backup controller. Use
icp canister settings update --add-controller PRINCIPALto add one.Using ExperimentalCycles in mo:core -- In mo:core 2.0, the module is renamed to
Cycles.import ExperimentalCycles "mo:base/ExperimentalCycles"will fail. Useimport Cycles "mo:core/Cycles".Using
icp cycles transferto fund a canister --icp cycles transfer <amount> <principal>moves cycles between cycles-ledger balances, the same as a token transfer between accounts. Passing a canister's principal as the recipient credits that principal's cycles-ledger balance, not the canister's actual execution/compute cycle balance --icp canister statuswill not show the cycles as received, and the canister keeps burning down its real balance toward freezing with no indication anything went wrong. Useicp canister top-up <canister> --amount <N> -e icinstead, which deposits cycles directly onto the canister via the management canister. See "Top Up a Canister" below for both commands side by side.Using
-n icon a command that names a canister ---n/--networkand-e/--environmentare different selectors and conflict with each other; passing both is an error. A canister name can only be resolved through an environment, so-nfails on it:icp canister status backend -n ic # Error: Specifying a network is not supported if you are targeting a canister # by name, specify an environment insteadSo
-e icfor anything naming a canister (top-up,status,settings update,create), and-n icfor commands that take a principal or no canister at all (cycles mint,cycles balance,cycles transfer). This is why the mainnet examples below mix the two flags. Loadicp-clifor the full flag rules.
Implementation
Motoko
Checking and Accepting Cycles
import Cycles "
Установить cycles-management в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл cycles-management?
Manage cycles and canister lifecycle. Covers cycle balance checks, top-ups, freezing thresholds, canister creation, and ICP-to-cycles conversion via the CMC. Use when working with cycles, canister funding, freezing threshold, frozen canister, out of cycles, top-up, canister creation, or cycle balance. Do NOT use for wallet-to-dApp integration or ICRC signer flows — use wallet-integration instead.
Как установить скилл cycles-management?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cycles-management запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic