# Restricting ICRC2 Token Transfers to Whitelisted Principals Across All Platforms

**URL:** <https://forum.dfinity.org/t/restricting-icrc2-token-transfers-to-whitelisted-principals-across-all-platforms/40860>\
**Category:** Rust\
**Created:** [February 5, 2025, 11:40am UTC](https://forum.dfinity.org/t/restricting-icrc2-token-transfers-to-whitelisted-principals-across-all-platforms/40860 "2025-02-05T11:40:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jumanaa](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jumanaa](https://forum.dfinity.org/u/jumanaa)\
**Post date:** [February 5, 2025, 11:40am UTC](https://forum.dfinity.org/t/restricting-icrc2-token-transfers-to-whitelisted-principals-across-all-platforms/40860/1 "2025-02-05T11:40:57Z")

</div>

Hello everyone,

I am using an ICRC2 ledger and want to ensure that only specific principals from my whitelist are allowed to receive my ICRC2 tokens. However, I don’t want these restrictions to apply only within my dApp—I want them to be enforced across all platforms, including ICP Swap and NNS.

Is it possible to implement such a restriction? If so, how can it be achieved?

---

<div class="post-metadata">

**Author:** ![marc0olo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/marc0olo/32/17290_2.png) [@marc0olo](https://forum.dfinity.org/u/marc0olo)\
**Post date:** [February 5, 2025, 12:00pm UTC](https://forum.dfinity.org/t/restricting-icrc2-token-transfers-to-whitelisted-principals-across-all-platforms/40860/2 "2025-02-05T12:00:34Z")

</div>

isn’t this a duplicate of [How to Restrict Specific Actions in an ICRC2 Ledger to Certain Principals?](https://forum.dfinity.org/t/how-to-restrict-specific-actions-in-an-icrc2-ledger-to-certain-principals/39989) ?

why a new thread? can we continue the discussion over there? then I could close this thread.

---

<div class="post-metadata">

**Author:** ![jumanaa](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jumanaa](https://forum.dfinity.org/u/jumanaa)\
**Post date:** [February 5, 2025, 12:18pm UTC](https://forum.dfinity.org/t/restricting-icrc2-token-transfers-to-whitelisted-principals-across-all-platforms/40860/3 "2025-02-05T12:18:29Z")

</div>

No this is different one, the other one was only for the dapp restrictions and that no one can send tokens , but this one is different.

---

<div class="post-metadata">

**Author:** ![skilesare](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/skilesare/32/5609_2.png) [@skilesare](https://forum.dfinity.org/u/skilesare)\
**Post date:** [February 5, 2025, 2:22pm UTC](https://forum.dfinity.org/t/restricting-icrc2-token-transfers-to-whitelisted-principals-across-all-platforms/40860/4 "2025-02-05T14:22:27Z")

</div>

/meme it’s the same picture.

Can you be more specific? The code I gave you in the other thread gives you an allow list your app canister can manage and only the people on that list can move tokens around via transfer or approve.

If you want your dapp to be gated by a balance on that ledger you would just use balance of. If the code is not clear or you would like to adapt the strategy, please ask a question and I’ll be happy to help.

---

<div class="post-metadata">

**Author:** ![jumanaa](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jumanaa](https://forum.dfinity.org/u/jumanaa)\
**Post date:** [February 6, 2025, 12:41pm UTC](https://forum.dfinity.org/t/restricting-icrc2-token-transfers-to-whitelisted-principals-across-all-platforms/40860/5 "2025-02-06T12:41:48Z")

</div>

Thank you for the clarification! What I’m asking is whether this code will also enforce my restriction outside of my dApp (like in nns if I send my token there)—preventing people from receiving tokens unless they are on the whitelist—or if the restriction only applies within my dApp.

---

<div class="post-metadata">

**Author:** ![skilesare](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/skilesare/32/5609_2.png) [@skilesare](https://forum.dfinity.org/u/skilesare)\
**Post date:** [February 6, 2025, 1:12pm UTC](https://forum.dfinity.org/t/restricting-icrc2-token-transfers-to-whitelisted-principals-across-all-platforms/40860/6 "2025-02-06T13:12:52Z")

</div>

The code is for a token canister. The canister will only transfer and approve to accounts on the whitelist. Your dapp can trade those tokens but only if they are on the whitelist. Other apps can only trade those if they are on the whitelist,

---

<div class="post-metadata">

**Author:** ![jumanaa](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jumanaa](https://forum.dfinity.org/u/jumanaa)\
**Post date:** [February 6, 2025, 1:31pm UTC](https://forum.dfinity.org/t/restricting-icrc2-token-transfers-to-whitelisted-principals-across-all-platforms/40860/7 "2025-02-06T13:31:12Z")

</div>

I got it but is there a Rust version of this code available?

---

<div class="post-metadata">

**Author:** ![skilesare](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/skilesare/32/5609_2.png) [@skilesare](https://forum.dfinity.org/u/skilesare)\
**Post date:** [February 6, 2025, 2:11pm UTC](https://forum.dfinity.org/t/restricting-icrc2-token-transfers-to-whitelisted-principals-across-all-platforms/40860/8 "2025-02-06T14:11:18Z")

</div>

Nope. You can poke around in DFINITY’s ledger, but you’ll need to do all the implementation.
