Moving cycles between containers

Is there any way to move cycles between containers, as i am running through the tutorials i deployed a couple of containers to the IC and they were seeded with 11T cycles.

Since experimenting with some of the tutorials i have since deployed a couple of more containers (created using --with-cycles 2000000000000 so they have less cycles) and i want to move the 11T from the previous containers into the new ones.

I have gone through dfx canister :: Internet Computer but i can not see a command for this …

Thks

If you are sending cycles between cycle wallets, you can use dfx wallet send. from the docs:

dfx wallet [network] send [flag] <destination> <amount>
dfx wallet send r7inp-6aaaa-aaaaa-aaabq-cai 2000000000

If the canister is NOT a cycle wallet canister, you will need to create some methods to send and/or receive cycles, depending on what you want to do. For non-wallet-canisters, you can import the ExperimentalCycles class to manage cycles.

Here are two pages that helped me:

You can also view my solution, where I transferred a non-wallet canister’s cycles back into a default cycle wallet

2 Likes

Forgot one very helpful document that shows how to use a callback to accept cycles:

1 Like

Thank you so much, this morning i stumbled across the ExperimentalCycles just going through it now … its all starting to solidify in my mind now so progress is being made :slight_smile:

No problem! I spent a few days working through this, and I am happy to help if possible.

A similar solution is to upgrade the canisters, adding a method that adds the cycle balance and calls management canister method IC.deposit_cycles with an argument specifying the principal of your specific wallet. That may be more secure than allowing an arbitrary callback on some canister (that might not be your wallet at all.)

1 Like

Very much agree that there should be a common interface supporting cycles transfer between canisters. I’ve started working on such a proposal:

Internet Computer Cycles Common Initiative (github.com)

The common cycles interface proposal by quintolet · Pull Request #1