# Calculate an estimate of cycles consumption: a universal example

**URL:** <https://forum.dfinity.org/t/calculate-an-estimate-of-cycles-consumption-a-universal-example/12526>\
**Category:** Developers\
**Created:** [April 29, 2022, 3:16pm UTC](https://forum.dfinity.org/t/calculate-an-estimate-of-cycles-consumption-a-universal-example/12526 "2022-04-29T15:16:19Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![domwoe](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/domwoe/32/5165_2.png) [@domwoe](https://forum.dfinity.org/u/domwoe)\
**Post date:** [May 25, 2022, 6:07am UTC](https://forum.dfinity.org/t/calculate-an-estimate-of-cycles-consumption-a-universal-example/12526/21 "2022-05-25T06:07:21Z")

</div>

> [@jzxchiang](#):
>
> One thing that’s interesting is that the called canister pays for an ingress message, whereas the callee canister pays for an inter-canister call. (I assume that’s because user principals don’t own cycles, so there’s nobody else you could charge for an ingress message. That’s also why `ic0.accept_message` isn’t necessary for inter-canister calls, I think.)

Yep, one of the design decisions is the “reverse gas” model which allows keeping the barriers for dapp users low. (Btw. I think you wanted to say _caller_ instead of _callee_ in the inter-canister call example).

I think something like `ic0.accept_message` would be also useful for inter-canister calls because the callee still pays for the execution of its own code. Hence, you still need a mechanism to guard against DoS/cycle draining from another canister.

---

<div class="post-metadata">

**Author:** ![domwoe](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/domwoe/32/5165_2.png) [@domwoe](https://forum.dfinity.org/u/domwoe)\
**Post date:** [May 25, 2022, 6:50am UTC](https://forum.dfinity.org/t/calculate-an-estimate-of-cycles-consumption-a-universal-example/12526/22 "2022-05-25T06:50:57Z")

</div>

Great work! LGTM!

> [@gabe](#):
>
> > [@jzxchiang](#):
> >
> > This should be required reading for all IC developers. 📖
> 
> Glad you say so! Happy to help fill in a missing piece in the IC docs.

I think it would be great to extract this in a blog post or make PR to the docs or the Wiki. @ais, what do you think?

It would be a pity if this gets buried in the vastness of the forum.

---

<div class="post-metadata">

**Author:** ![gabe](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/gabe/32/4612_2.png) [@gabe](https://forum.dfinity.org/u/gabe)\
**Post date:** [May 25, 2022, 7:15am UTC](https://forum.dfinity.org/t/calculate-an-estimate-of-cycles-consumption-a-universal-example/12526/23 "2022-05-25T07:15:36Z")

</div>

> [@domwoe](#):
>
> Great work! LGTM!

Awesome, great work to you as well!

> [@domwoe](#):
>
> It would be a pity if this gets buried in the vastness of the forum.

Agreed. I am willing to write and publish a blog post about this, but including it in the docs would be useful as well IMO.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [May 25, 2022, 7:37am UTC](https://forum.dfinity.org/t/calculate-an-estimate-of-cycles-consumption-a-universal-example/12526/24 "2022-05-25T07:37:12Z")

</div>

I’m responding with @ais’s blessing.

> [@gabe](#):
>
> I am willing to write and publish a blog post about this, but including it in the docs would be useful as well IMO.

We’d LOVE to have that in the docs, but we don’t want to rob you of an opportunity for a great blog post. @gabe, how would you like to do it? My _personal_ favourite option would be to have it as a blog post on your own site, and then re-publish it on the docs page with very obvious credits and links back to the original.

---

<div class="post-metadata">

**Author:** ![gabe](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/gabe/32/4612_2.png) [@gabe](https://forum.dfinity.org/u/gabe)\
**Post date:** [May 25, 2022, 7:49am UTC](https://forum.dfinity.org/t/calculate-an-estimate-of-cycles-consumption-a-universal-example/12526/25 "2022-05-25T07:49:55Z")

</div>

I’d also love to see it in the docs and I think your suggestion sounds perfect! I’ll try to have a blog post ready within a week or so and make an update here once it’s ready.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [May 25, 2022, 7:52am UTC](https://forum.dfinity.org/t/calculate-an-estimate-of-cycles-consumption-a-universal-example/12526/26 "2022-05-25T07:52:16Z")

</div>

Thank you very much, I’m looking forward to it!

---

<div class="post-metadata">

**Author:** ![gabe](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/gabe/32/4612_2.png) [@gabe](https://forum.dfinity.org/u/gabe)\
**Post date:** [May 25, 2022, 9:46am UTC](https://forum.dfinity.org/t/calculate-an-estimate-of-cycles-consumption-a-universal-example/12526/27 "2022-05-25T09:46:17Z")

</div>

Thought I’d share some interesting findings of my _very rough_ calculations regarding the messaging protocol that I’m building. This estimate does not include costs for update _instructions_ executed and assumes that a 100 kB message stored takes up exactly 100 kB of stable memory, i.e ignores data structures, etc.

Assuming worst-case where every message is the current maximum of 100 kB each, the estimated cost is:

- **$300** to send… _(one ingress message per message sent)_, and
- **$540** for one year storage of…

…not one, not one thousand, but **one million** messages completely on-chain.

Pretty cool!

---

<div class="post-metadata">

**Author:** ![dieter.sommer](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@dieter.sommer](https://forum.dfinity.org/u/dieter.sommer)\
**Post date:** [May 25, 2022, 12:21pm UTC](https://forum.dfinity.org/t/calculate-an-estimate-of-cycles-consumption-a-universal-example/12526/28 "2022-05-25T12:21:07Z")

</div>

@gabe, awesome! This is a great collection of cycles-related information, I am also very much looking forward to the blog post and seeing this in the docs! 🙂

---

<div class="post-metadata">

**Author:** ![gabe](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/gabe/32/4612_2.png) [@gabe](https://forum.dfinity.org/u/gabe)\
**Post date:** [May 25, 2022, 2:38pm UTC](https://forum.dfinity.org/t/calculate-an-estimate-of-cycles-consumption-a-universal-example/12526/29 "2022-05-25T14:38:34Z")

</div>

Glad you found it helpful! I’m excited to share it as well and hope it can be of help to other devs. 🙂

[Previous page](https://forum.dfinity.org/t/calculate-an-estimate-of-cycles-consumption-a-universal-example/12526.md?page=1)
