# Conversion of icp into cycles with rust

**URL:** https://forum.dfinity.org/t/conversion-of-icp-into-cycles-with-rust/35859
**Category:** Developers
**Tags:** cycles
**Created:** [October 5, 2024, 11:14am UTC](https://forum.dfinity.org/t/conversion-of-icp-into-cycles-with-rust/35859 "2024-10-05T11:14:08Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![asjn3e](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/asjn3e/32/22792_2.png) [@asjn3e](https://forum.dfinity.org/u/asjn3e)
#### Post date: [October 5, 2024, 11:14am UTC](https://forum.dfinity.org/t/conversion-of-icp-into-cycles-with-rust/35859/1 "2024-10-05T11:14:08Z")

</div>

Hello icp community, I was trying to find the source code related to conversion of ICP tokens into cycles, since im working on a canister that takes icp tokens and those icp tokens should later be converted into cycles. I dont want to convert icp to cycle by myself and i want the process to be automated. I could not find any functions related to that in ic\_cdk so if someone could tell how dfx converts ICP into cycles I would appreciate it so much.

---

<div class="post-metadata">

### Author: ![jennifertran](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jennifertran/32/11558_2.png) [@jennifertran](https://forum.dfinity.org/u/jennifertran)
#### Post date: [October 5, 2024, 4:52pm UTC](https://forum.dfinity.org/t/conversion-of-icp-into-cycles-with-rust/35859/2 "2024-10-05T16:52:30Z")

</div>

This is the source code for `dfx convert cycles` which is the dfx command to convert ICP to cycles in an ICP wallet: [sdk/src/dfx/src/commands/cycles/convert.rs at ab9b342e608166502a3ab44092be8f23d1bff27d · dfinity/sdk · GitHub](https://github.com/dfinity/sdk/blob/ab9b342e608166502a3ab44092be8f23d1bff27d/src/dfx/src/commands/cycles/convert.rs)

---

<div class="post-metadata">

### Author: ![Ray04](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ray04/32/24164_2.png) [@Ray04](https://forum.dfinity.org/u/Ray04)
#### Post date: [October 7, 2024, 8:31am UTC](https://forum.dfinity.org/t/conversion-of-icp-into-cycles-with-rust/35859/3 "2024-10-07T08:31:41Z")

</div>

You can find a library written in rust called mint\_cycles.  
The source code is also open  
Find it below:

> **[GitHub - amschel99/mint\_cycles: Programmatically convert ICP tokens to cycles to...](https://github.com/amschel99/mint_cycles)**
>
> Programmatically convert ICP tokens to cycles to power canisters

hope this helps! 🙂
