Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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: mops package 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

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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 PRINCIPAL to add one.

  6. Using ExperimentalCycles in mo:core -- In mo:core 2.0, the module is renamed to Cycles. import ExperimentalCycles "mo:base/ExperimentalCycles" will fail. Use import Cycles "mo:core/Cycles".

  7. Using icp cycles transfer to 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 status will not show the cycles as received, and the canister keeps burning down its real balance toward freezing with no indication anything went wrong. Use icp canister top-up <canister> --amount <N> -e ic instead, which deposits cycles directly onto the canister via the management canister. See "Top Up a Canister" below for both commands side by side.

  8. Using -n ic on a command that names a canister -- -n/--network and -e/--environment are different selectors and conflict with each other; passing both is an error. A canister name can only be resolved through an environment, so -n fails 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 instead
    

    So -e ic for anything naming a canister (top-up, status, settings update, create), and -n ic for 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. Load icp-cli for the full flag rules.

Implementation

Motoko

Checking and Accepting Cycles

import Cycles "
Полный SKILL.md на GitHub

Установить cycles-management в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

LICENSESOURCE.mdTRUST.auto.yaml

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), без исполняемых скриптов.

Похожие скиллы

Сравнить cycles-management с