Cycles Ledger

From Internet Computer Wiki
Revision as of 12:52, 22 March 2024 by Thomas.locher (talk | contribs)
Jump to: navigation, search

Overview

The cycles ledger is a canister that simplifies the management of cycles.

Instead of creating one or more cycles wallets, which the developer controls and manages, the cycles ledger is a global ledger under the control of the NNS. That is, the burden of managing cycles wallets themselves is lifted.

The cycles ledger complies with the IRCR-1, ICRC-2, and (the upcoming) ICRC-3 standards. As a result, the cycles ledger can also be integrated into applications and services that work ICRC tokens.

The cycles ledger (canister ID: um5iw-rqaaa-aaaaq-qaaba-cai) runs on the uzr34 system subnet.

Architecture

The following figure depicts the involved components and their interactions at a high level.

High-level overview of the cycles ledger architecture.


In addition to the standard ICRC ledger functionality, the cycles ledger interacts with the cycles minting canister of the NNS and user canisters to provide the cycles ledger-specific functionality, such as transferring cycles as well as creating canisters with cycles. Concretely, it provides the following functionality:

  1. deposit credits the sent cycles to the given principal ID.
  2. withdraw sends the given number of cycles to the given canister.
  3. withdraw_from sends the given number of cycles to the given canister taking the funds from a given account.
  4. create_canister creates a new canister using cycles.
  5. create_canister_from creates a new canister using cycles taken from a given account.


The cycles balance of an account on the cycles ledger can be increased in the following ways:

  1. Calling deposit with cycles attached.
  2. Calling notify_mint_cycles on the cycles minting canister (CMC) after having deposited ICP in a user-specific subaccount of the CMC's account on the ICP ledger.
  3. Calling icrc1_transfer or icrc2_transfer_from on the cycles ledger to transfer cycles.


Due to the tight interaction with the NNS, in particular the CMC, the cycles ledger is to be controlled by the NNS root canister.

It is important to point out that the cycles ledger does not provide the functionality to call arbitrary other canisters with cycles (unlike cycles wallets). The reason is that open call contexts may cause the cycles ledger to become stuck.

If this functionality is needed, a developer can still spin up a cycles wallet - and load it with cycles using the cycles ledger.

See also