Skip to content

Commit e309af6

Browse files
authored
Merge pull request #636 from Chia-Network/melt-cats
include cat melting information
2 parents 0aacf88 + 1fe0386 commit e309af6

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

docs/guides/cat/cat-creation-tutorial.md

+24-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ To get started, you will create a single-issuance CAT. This is the default way t
224224

225225
:::note
226226

227-
A TAIL is a Chialisp program that defines the rules for issuing and melting tokens. Learn more about the [Token and Asset Issuance Limitations program](https://chialisp.com/cats/#tail).
227+
A TAIL is a Chialisp program that defines the rules for issuing and melting tokens. Learn more about the [Token and Asset Issuance Limitations program](https://chialisp.com/cats/#tail).
228+
Single issuance CATs can **NOT** be melted.
228229

229230
:::
230231

@@ -277,6 +278,8 @@ We'll set up this CAT to delegate the same TAIL we set up previously. What this
277278
First, figure out how many tokens you want to issue. Because creating a single token takes 1,000 mojos, you will multiply your supply by 1,000 to figure out how much TXCH (or XCH on mainnet) is needed. For example, if you want to issue 1 million tokens, you'll need 1 billion mojos (1/1000 of a TXCH/XCH).
278279

279280
:::note
281+
Multi-issuance CATs can be melted with a custom spend bundle as described [here](#melting-a-cat).
282+
280283
Just as with the Single Issuance CAT, we recommend that you include a fee with your transaction. This fee will ensure that your transaction is processed in front of any dust in the mempool. Whether you're running on testnet or mainnet, the recommended fee amount is 100 million mojos (`-m 100000000`). Even though you will run the `cats` command multiple times, the fee will only be applied once, when the transaction is pushed to the network.
281284
:::
282285
@@ -357,6 +360,26 @@ You will now see your token in your wallet with the full issued quantity. As a r
357360

358361
You now have access to your CAT in the GUI. You can send and receive your new tokens just like you would with regular XCH.
359362

363+
## Melting a CAT
364+
365+
When you spend one or more CAT coins, you provide an Extra Delta in the solution, which is essentially by how much the supply is changing. If it's positive, you're increasing the supply. And if it's negative, you're melting the CAT away.
366+
367+
When the Extra Delta is non-zero, you have to run the TAIL program, which describes the rules for when you are allowed to change the supply.
368+
369+
Single issuance CATs cannot be melted because the TAIL only allows being run if the coin has a specific parent. In other words, the supply can only be set once, and never modified thereafter.
370+
For multi issuance CATs, you need to sign with the issuance key in order to authorize the supply change, and therefore it does support melting.
371+
372+
You reveal and run the TAIL by outputting the following condition from the inner puzzle's spend:
373+
`(list CREATE_COIN () -113 <tail program> <tail solution>)`
374+
375+
The documentation for this Extra Delta concept can be found [here](https://chialisp.com/cats/#extra-delta).
376+
377+
This is an [example](https://github.com/Rigidity/chia-wallet-sdk/blob/main/crates/chia-sdk-driver/src/puzzles/cat/cat_spend.rs#L250-L268) of melting a CAT from Rigidity's wallet SDK.
378+
379+
In this example, you start with a supply of 10000, use an extra delta of -3000, reveal the TAIL and output a new CAT with the remaining supply of 7000.
380+
381+
Here is another [example](https://github.com/irulast/chia_crypto_utils/blob/0bbf32a422e2b624cd3f84b7b643b0f83f18be51/integration_test/cat/cat_multi_issuance_test.dart#L44) of melting a CAT from Irulast's chia crypto utils.
382+
360383
## Preparing for Mainnet
361384
362385
After you are comfortable with issuing your CAT on testnet, you may wish to move to mainnet. **Please keep in mind that there are extra risks inherent to publishing code on a public blockchain.** If your seed phrase is ever exposed, your funds could be stolen. If you created a custom TAIL, there is a possiblity of funds being bricked. **Proceed with caution.**

0 commit comments

Comments
 (0)