# Working with cycles in a work network

**URL:** <https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751>\
**Category:** Developers\
**Created:** [October 7, 2021, 2:07pm UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751 "2021-10-07T14:07:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Safik](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/safik/32/953_2.png) [@Safik](https://forum.dfinity.org/u/Safik)\
**Post date:** [October 7, 2021, 2:07pm UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/1 "2021-10-07T14:07:07Z")

</div>

An error occurs in the working network:

> dfx canister --network=ic --no-wallet call yfsj5-qaaaa-aaaah-aav2a-cai request\_replace\_value ‘(“fca545e2-0862-c188-8015-6275a0be6f8d”, “1”, “1”, “1”, “1”)’  
> The Replica returned an error: code 4, message: “Canister ohx7x-fiaaa-aaaah-aawbq-cai is out of cycles: requested 2000590000 cycles but the available balance is 598785060953 cycles and the freezing threshold 82855580000000 cycles”

I make financing for each call (I have several call stacks and on each of them)

Code snippet

> ExperimentalCycles.add(sumOperation);  
> let accept = await u.deposit(); //deposit

the amount is also considerable

> private let sumOperation = 400\_000\_000\_000; //cycles

What is the reason for this behavior?

---

<div class="post-metadata">

**Author:** ![diegop](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/diegop/32/569_2.png) [@diegop](https://forum.dfinity.org/u/diegop)\
**Post date:** [October 8, 2021, 6:26am UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/2 "2021-10-08T06:26:13Z")

</div>

Thanks for asking, I am not sure.

Let me ping the SDK team.

---

<div class="post-metadata">

**Author:** ![Safik](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/safik/32/953_2.png) [@Safik](https://forum.dfinity.org/u/Safik)\
**Post date:** [October 8, 2021, 6:42am UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/3 "2021-10-08T06:42:29Z")

</div>

Hi!  
OK, can you write me what to provide you with?

---

<div class="post-metadata">

**Author:** ![diegop](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/diegop/32/569_2.png) [@diegop](https://forum.dfinity.org/u/diegop)\
**Post date:** [October 8, 2021, 6:44am UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/4 "2021-10-08T06:44:25Z")

</div>

tbh, i am not sure yet. but as soon as I hear back, i definitely will!

---

<div class="post-metadata">

**Author:** ![Safik](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/safik/32/953_2.png) [@Safik](https://forum.dfinity.org/u/Safik)\
**Post date:** [October 8, 2021, 6:50am UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/5 "2021-10-08T06:50:01Z")

</div>

Thanks. I have already redone it several times and uploaded it to the network, I’m not sure that the correct version with cycle financing is now. But if you need all the source code, feel free to demand. I’ll give it to you.

---

<div class="post-metadata">

**Author:** ![diegop](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/diegop/32/569_2.png) [@diegop](https://forum.dfinity.org/u/diegop)\
**Post date:** [October 8, 2021, 6:51am UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/6 "2021-10-08T06:51:56Z")

</div>

> [@Safik](#):
>
> Thanks. I have already redone it several times and uploaded it to the network,

Fwiw, I am really sorry to hear about that. This sounds very frustrating, not the kind of experience we want from SDK.

---

<div class="post-metadata">

**Author:** ![Safik](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/safik/32/953_2.png) [@Safik](https://forum.dfinity.org/u/Safik)\
**Post date:** [October 8, 2021, 7:08am UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/7 "2021-10-08T07:08:33Z")

</div>

I understand. Perhaps I was too hasty with the answer. Version 0.7.2 now I have done work on upgrading to 0.8.1 and this did not solve the problem. I will redo the funding code in cycles, most likely these are my mistakes. I will write in this thread if the problem remains.

---

<div class="post-metadata">

**Author:** ![chenyan](https://avatars.discourse-cdn.com/v4/letter/c/35a633/32.png) [@chenyan](https://forum.dfinity.org/u/chenyan)\
**Post date:** [October 8, 2021, 5:30pm UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/8 "2021-10-08T17:30:30Z")

</div>

The available balance is less than the freezing threshold. I think that means the canister is in a stopped state and won’t be taking any calls.

The freezing threshold for ohx7x-fiaaa-aaaah-aawbq-cai is unusually high, it’s 82T, which means that canister needs to have at least 82T cycles to take any calls. Is this intentionally?

Can you also paste the result for `dfx canister --network ic ohx7x-fiaaa-aaaah-aawbq-cai status`, and see the numbers matches the error message you get.

---

<div class="post-metadata">

**Author:** ![Safik](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/safik/32/953_2.png) [@Safik](https://forum.dfinity.org/u/Safik)\
**Post date:** [October 8, 2021, 7:07pm UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/10 "2021-10-08T19:07:33Z")

</div>

Thank you for your time Chenyan.

> [@chenyan](#):
>
> The freezing threshold for ohx7x-fiaaa-aaaah-aawbq-cai is unusually high, it’s 82T, which means that canister needs to have at least 82T cycles to take any calls. Is this intentionally?

- No it wasn’t intentional

the only parameter that could affect it is freezing\_threshold = 15\_770\_000 (6 months) But that’s not the reason. Other canisters with the same parameter

> [@chenyan](#):
>
> Can you also paste the result for `dfx canister --network ic ohx7x-fiaaa-aaaah-aawbq-cai status` , and see the numbers matches the error message you get.

If I understand you correctly. Any function call from this canister outputs the same error. This is the generated canister it has controllers. Here is the request - response

```auto

dfx canister --network=ic call aanaa-xaaaa-aaaah-aaeiq-cai wallet_call "(record { canister= principal \"ohx7x-fiaaa-aaaah-aawbq-cai\"; method_name= \"status\"; args= blob \"DIDL\01nh\01\00\00\"; cycles= (0:nat64); })"

(

variant {

3_456_837 = "An error happened during the call: 2: Canister ohx7x-fiaaa-aaaah-aawbq-cai is out of cycles: requested 2000590000 cycles but the available balance is 383807142953 cycles and the freezing threshold 82855580000000 cycles"

},

)

```

Did I compose the call correctly? I doubt it…

---

<div class="post-metadata">

**Author:** ![chenyan](https://avatars.discourse-cdn.com/v4/letter/c/35a633/32.png) [@chenyan](https://forum.dfinity.org/u/chenyan)\
**Post date:** [October 8, 2021, 8:48pm UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/11 "2021-10-08T20:48:40Z")

</div>

The 82T freezing threshold is certainly a problem. You can use `dfx canister update-settings` to update it.

If your wallet is one of the controllers of ohx7x-fiaaa-aaaah-aawbq-cai, you should be able to call `dfx canister status` directly, because the call is routed via your wallet. Otherwise, you need to ask the controller to make the call to “aaaaa-aa”.canister\_status.

---

<div class="post-metadata">

**Author:** ![Safik](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/safik/32/953_2.png) [@Safik](https://forum.dfinity.org/u/Safik)\
**Post date:** [October 9, 2021, 7:00am UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/12 "2021-10-09T07:00:34Z")

</div>

Hi, Chenyan  
Your advice helped me solve the problem.

I have reduced the freezing threshold and computing resources consumed in the settings. I also raised the limit of the amount of storage in each canister. These actions have yielded results. Thanks.

---

<div class="post-metadata">

**Author:** ![willyhuang18](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/willyhuang18/32/5608_2.png) [@willyhuang18](https://forum.dfinity.org/u/willyhuang18)\
**Post date:** [May 2, 2022, 12:18am UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/13 "2022-05-02T00:18:06Z")

</div>

Hi, Safik  
Do you mind explaining more about the reduce the amount? I tried to redeem the 20TC with a Twitter account, but I keep getting this error, not sure what to do? Thank you!

 ![20220501114623](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/4/406877881cb46ba99ad7ec5e9568b37d5501a893.png)

---

<div class="post-metadata">

**Author:** ![ericswanson](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ericswanson/32/622_2.png) [@ericswanson](https://forum.dfinity.org/u/ericswanson)\
**Post date:** [May 6, 2022, 12:00am UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/14 "2022-05-06T00:00:05Z")

</div>

Is your principal (`dfx identity get-principal`) one of the controllers of the canister?

```auto
dfx canister --network ic info fg7gi-vyaaa-aaaal-qadca-cai 
Controllers: q7srv-57hq5-cmjza-l37an-ljxqv-5pefr-lhnxt-we3zr-4wf6r-prvhp-zae rcccp-jaaaa-aaaal-qaauq-cai sqqi5-5kexz-bqd3x-ufmlf-dfobm-4bp44-63tzg-jvrqe-3pz4a-q5edu-hqe
Module hash: 0x993aa144fc499bd7916097ee5a34d569c840b129bb0e0c105a7c0d69572890e1

```

---

<div class="post-metadata">

**Author:** ![willyhuang18](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/willyhuang18/32/5608_2.png) [@willyhuang18](https://forum.dfinity.org/u/willyhuang18)\
**Post date:** [May 6, 2022, 10:33pm UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/15 "2022-05-06T22:33:59Z")

</div>

Hi, Mr. Erics Wanson  
when I put in the command you gave, I get the exactly same thing. And I am not sure that my principal is one of the controllers of the canister? I am sorry, I just followed the udemy course, they have it as Github to claim, but now is Twitter, so I am not sure how to claim, even though I follow the instruction on the web. what command do I need to check the controller? or do I need to write something in the vscode in order to make my principal as the controller? Thank you for your time.

---

<div class="post-metadata">

**Author:** ![ericswanson](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ericswanson/32/622_2.png) [@ericswanson](https://forum.dfinity.org/u/ericswanson)\
**Post date:** [May 6, 2022, 11:34pm UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/16 "2022-05-06T23:34:29Z")

</div>

> [@ericswanson](#):
>
> dfx identity get-principal

That command will display your principal. Then, we’ll look to see if it is one of these, which are the controllers of your canister:

```auto
Controllers: q7srv-57hq5-cmjza-l37an-ljxqv-5pefr-lhnxt-we3zr-4wf6r-prvhp-zae rcccp-jaaaa-aaaal-qaauq-cai sqqi5-5kexz-bqd3x-ufmlf-dfobm-4bp44-63tzg-jvrqe-3pz4a-q5edu-hqe

```

---

<div class="post-metadata">

**Author:** ![ericswanson](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ericswanson/32/622_2.png) [@ericswanson](https://forum.dfinity.org/u/ericswanson)\
**Post date:** [May 6, 2022, 11:37pm UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/17 "2022-05-06T23:37:01Z")

</div>

Also, what are you trying to achieve? What instructions on twitter are you trying to follow?

---

<div class="post-metadata">

**Author:** ![ericswanson](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ericswanson/32/622_2.png) [@ericswanson](https://forum.dfinity.org/u/ericswanson)\
**Post date:** [May 6, 2022, 11:39pm UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/18 "2022-05-06T23:39:41Z")

</div>

It sounds like you are trying to follow some directions in order to redeem some cycles from someone else’s canister. That canister is out of cycles, or at least, doesn’t have 20T cycles to give.

---

<div class="post-metadata">

**Author:** ![paulyoung](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulyoung/32/5251_2.png) [@paulyoung](https://forum.dfinity.org/u/paulyoung)\
**Post date:** [May 7, 2022, 12:31am UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/19 "2022-05-07T00:31:43Z")

</div>

I think @willyhuang18 is referring to the cycles faucet.

> **[Cycles Faucet | Internet Computer Developer Portal](https://smartcontracts.org/docs/current/developer-docs/quickstart/cycles-faucet/)**
>
> Ready to deploy your first smart contract on the Internet Computer

---

<div class="post-metadata">

**Author:** ![willyhuang18](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/willyhuang18/32/5608_2.png) [@willyhuang18](https://forum.dfinity.org/u/willyhuang18)\
**Post date:** [May 7, 2022, 5:09pm UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/20 "2022-05-07T17:09:49Z")

</div>

Hi, Mr. Erics Wanson  
I did the get-principal command, but the ID display is not one of the Controllers you listed. I think after I connected with my Twitter, I am able to redeem it. And I think I got an error on the second step, where it said " dfx canister–network ic…" because the step asked me to copy the command in there, and I did so.  
Yes, like Mr. Paul Young said, I was following the instruction on the [Cycles Faucet | Internet Computer Developer Portal](https://smartcontracts.org/docs/current/developer-docs/quickstart/cycles-faucet/), it used to be Github, it is easier to redeem, but it change to Twitter, which is more complicated I think.  
Thank you

---

<div class="post-metadata">

**Author:** ![ericswanson](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ericswanson/32/622_2.png) [@ericswanson](https://forum.dfinity.org/u/ericswanson)\
**Post date:** [May 9, 2022, 3:31pm UTC](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751/21 "2022-05-09T15:31:40Z")

</div>

Okay. In that case we wouldn’t expect your principal to be one of the controllers. It sounds like you were able to redeem the cycles you were hoping to. If you have more questions, please include a link to the instructions that you are trying to follow.

[Next page](https://forum.dfinity.org/t/working-with-cycles-in-a-work-network/7751.md?page=2)
