# Is it a good idea to put a rate limiting mechanism for a no-fee icrc1 ledger?

**URL:** <https://forum.dfinity.org/t/is-it-a-good-idea-to-put-a-rate-limiting-mechanism-for-a-no-fee-icrc1-ledger/26251>\
**Category:** Developers\
**Created:** [January 5, 2024, 11:21pm UTC](https://forum.dfinity.org/t/is-it-a-good-idea-to-put-a-rate-limiting-mechanism-for-a-no-fee-icrc1-ledger/26251 "2024-01-05T23:21:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kayicp](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/kayicp/32/36679_2.png) [@kayicp](https://forum.dfinity.org/u/kayicp)\
**Post date:** [January 5, 2024, 11:21pm UTC](https://forum.dfinity.org/t/is-it-a-good-idea-to-put-a-rate-limiting-mechanism-for-a-no-fee-icrc1-ledger/26251/1 "2024-01-05T23:21:55Z")

</div>

and return the `#TemporarilyUnavailable` error when caller is calling the ledger too much in a short time?  
also what is that error for, actually?

---

<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:** [January 8, 2024, 1:35pm UTC](https://forum.dfinity.org/t/is-it-a-good-idea-to-put-a-rate-limiting-mechanism-for-a-no-fee-icrc1-ledger/26251/2 "2024-01-08T13:35:43Z")

</div>

I’m not a fan of ledgers without any fees because any rate limiting you put in is most likely trivially circumventable by sybil attacks.

The `TemporarilyUnavailable` error can be used for anything you feel it’s appropriate for. If you need to do some maintenance I think it would be appropriate, or when you disable functionality for some reason. One example we have in the cycles ledger is that we plan to return `TemporarilyUnavailable` if we start to run low on available memory in order to not hit the limit because that would make the ledger fail in unexpected ways

---

<div class="post-metadata">

**Author:** ![kayicp](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/kayicp/32/36679_2.png) [@kayicp](https://forum.dfinity.org/u/kayicp)\
**Post date:** [January 8, 2024, 1:44pm UTC](https://forum.dfinity.org/t/is-it-a-good-idea-to-put-a-rate-limiting-mechanism-for-a-no-fee-icrc1-ledger/26251/3 "2024-01-08T13:44:07Z")

</div>

> [@Vivienne](#):
>
> I’m not a fan of ledgers without any fees because any rate limiting you put in is most likely trivially circumventable by sybil attacks.

I see, I was trying to stay true to the Reverse Gas Model idea. I guess no-fee ledger is a fool’s errand to achieve that. Alright, I will implement a fee.

---

<div class="post-metadata">

**Author:** ![PanIndustrial](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/panindustrial/32/13740_2.png) [@PanIndustrial](https://forum.dfinity.org/u/PanIndustrial)\
**Post date:** [January 8, 2024, 2:33pm UTC](https://forum.dfinity.org/t/is-it-a-good-idea-to-put-a-rate-limiting-mechanism-for-a-no-fee-icrc1-ledger/26251/4 "2024-01-08T14:33:23Z")

</div>

We have an example here: [ICRC\_fungible/src/examples/Allowlist.mo at 9a19d6ddfa23afe8fcb99f40435526186e3c4ec4 · PanIndustrial-Org/ICRC\_fungible · GitHub](https://github.com/PanIndustrial-Org/ICRC_fungible/blob/9a19d6ddfa23afe8fcb99f40435526186e3c4ec4/src/examples/Allowlist.mo#L411)

In this example we have an allow list token…it assumes that you know who is using your ledger, so if someone spams, you could remove them. You could modify this example to use other system, like checking if a user has a certain number of staked tokens and thus gets a 0 feel.

There has also been a discussion of a “merchant pays” ICRC that would take the fee from the receiver. Something like this that also integrates @timo 's idea of having to have both parties accepting a transaction is being considered for future ICRC types that are more retail and business friendly.
