Cycles Token (XTC) Update: Mint From ICP
Today’s update makes it a lot easier to get your hands on Cycles Token (XTC) by enabling minting directly from ICP.
Time for a Cycles Token (XTC) update! Today we’re improving the accessibility of Cycles Token (XTC) by providing the functionality to mint XTC from ICP.
This means that you can now automatically go from ICP → Cycles → XTC.
Minting XTC Through ICP Deposits 🔮
So how are we making ICP → XTC happen you ask?
Great question! It’s pretty simple. There are only two steps to the whole process.
Step 1: Send ICP to the XTC Canister
The title pretty much says it all. Send the amount of ICP you’d like to mint to the XTC Canister.
You can do this through DFX by using this command:
dfx ledger --network=ic transfer --amount “$AMOUNT” “758bdb7e54b73605d1d743da9f3aad70637d4cddcba03db13137eaf35f12d375” --memo 0
Running this command (and replacing $AMOUNT with your desired ICP transfer amount) will send your ICP to the XTC canister and return you the block height of your transaction. You’ll need this for step 2.
Step 2: Minting Your XTC
To mint your XTC, we need to talk to the XTC canister to tell it to look for your ICP transfer and mint you the corresponding amount of XTC.
To do this, we can run this command, replacing $BLOCK_HEIGHT with the block height you were returned in step 1 :
dfx canister --network ic call aanaa-xaaaa-aaaah-aaeiq-cai mint_by_icp "(null,$BLOCK_HEIGHT:nat64)"
Under the hood, XTC checks to make sure that, (1) the transaction that corresponds with this block height is a transaction to the XTC canister, (2) the caller of this method matches the sender of the ICP transaction with the blockheight you passed in, and (3) that this transaction has not already been used to mint XTC before.
If all three checks pass, your ICP will be burned to cycles and then wrapped into Cycles Token (XTC) and credited to your address!
Pretty easy, huh!
ICP → XTC in Action ⚔️
If you’d like to mint some Cycles Token (XTC) of your own from your ICP, Sonic has already implemented an ICP to XTC swap in their application by using this new functionality.
To do so, go to Sonic’s app, connect your Plug wallet, click on the ‘Swap’ tab, and select ICP as your first token and XTC as your second token. It’s that easy 🚀
That’s A Wrap 👋
Well, that’s it for today. This is a subtle yet important update that’s helped to get Cycles Token (XTC) into a lot more wallets!
As always, if you’d like to chat with our team about this update or anything Internet Computer related, hop into our Discord or tweet us!