Topping up canisters

From Internet Computer Wiki
Jump to: navigation, search

Using dfx

There are two options to top up any canister: By depositing cycles, or by converting ICP to cycles directly.

Depositing cycles

If you have a cycles wallet configured, you can take any amount of cycles from it and deposit them directly into a canister. To do so, use

   dfx canister --network ic deposit-cycles <canister id> <amount of cycles>

As an example, to send 10 trillion cycles (TC) to canister fg7gi-vyaaa-aaaal-qadca-cai, you would run

   dfx canister --network ic deposit-cycles fg7gi-vyaaa-aaaal-qadca-cai 10000000000000

Using ICP directly

If you have ICP that you want to use to top up any canister, you can run

   dfx ledger --network ic top-up <canister id> --amount <amount of ICP to convert>

As an example, to top up canister fg7gi-vyaaa-aaaal-qadca-cai with 10.3 ICP, you can run

   dfx ledger --network ic top-up fg7gi-vyaaa-aaaal-qadca-cai --amount 10.3

Using NNS

To use ICP to top up a canister via NNS frontend dapp, follow these steps:

  1. Go to the "My canisters" tab
  2. Add the canister to your list of canisters using the "Link canister" button
  3. Click on the newly linked canister
  4. Use the "Add cycles" button. This will work even when an error like "there was an error loading the details of the canister" shows up.