diff --git a/CHIPs/chip-0040.md b/CHIPs/chip-0040.md new file mode 100644 index 00000000..4ad11654 --- /dev/null +++ b/CHIPs/chip-0040.md @@ -0,0 +1,83 @@ +CHIP Number | 0040 +:-------------|:---- +Title | everything_with_singleton TAIL +Description | A new CAT TAIL to authorize mints and melts from a singleton +Author | [Andreas Greimel](https://github.com/greimela) +Editor | [Dan Perry](https://github.com/danieljperry) +Comments-URI | [CHIPs repo, PR #139](https://github.com/Chia-Network/chips/pull/139) +Status | Final +Category | Informational +Sub-Category | Chialisp Puzzle +Created | 2024-12-19 +Requires | [CAT2](https://chialisp.com/cats/), [Singletons](https://chialisp.com/singletons/) + +## Abstract + +Tokens that follow the CAT2 standard require the use of a Token and Asset Issuance Limitations ([TAIL](https://chialisp.com/cats/#tail)) program, which dictates the rules for when a CAT may be minted or melted. The CAT2 standard was originally released with two [multi-issuance TAILS](https://chialisp.com/cats/#multi). One of these TAILs was [everything_with_signature](https://github.com/Chia-Network/chia_puzzles/blob/b90dcd6c48e748c9c3e83c9133022c7599eebb50/puzzles/cat_puzzles/everything_with_signature.clsp), which allowed both minting and melting, as long as the issuing key signed the transaction. This CHIP introduces a new TAIL to allow minting and melting if the issuing _singleton_ signed the transaction. + +## Motivation + +[CHIP-38](https://github.com/Chia-Network/chips/pull/136) (Revocable CATs) proposes a standard for a new type of CAT that the issuing entity can revoke. Initially, it will be implemented with the `everything_with_singleton` TAIL from this CHIP. However, Revokable CATs do not require `everything_with_singleton` (other TAILs are allowed), and this TAIL can be used with other Chia assets, such as those which use the CAT2 standard. For these reasons, the `everything_with_singleton` TAIL warrants its own CHIP. + +## Backwards Compatibility + +This proposal is for a new Chialisp puzzle. It does not replace any existing standards, nor does it modify Chia's consensus. This CHIP therefore does not introduce any breaking changes to Chia. + +## Rationale + +The existing TAILs were inadequate for the Revocable CAT standard. This is because we want to be able to mint or melt Revocable CATs from a vault, rather than a standard BLS key. We therefore created a new type of TAIL to suit our needs. It is worth noting that melting any CAT requires ownership of the tokens to be melted. It is not possible to use this TAIL to melt tokens directly from a vault other than the issuing vault. + +## Specification + +The `everything_with_singleton` puzzle allows any type of singleton (including a vault) to authorize CAT mints and melts by sending a message. + +A nonce is curried in to allow a single vault to issue multiple different CATs. + +### Puzzle structure + +``` +; This is a "limitations_program" for use with cat.clsp. +; It allows a singleton to both mint and melt this CAT. +(mod ( + SINGLETON_MOD_HASH + SINGLETON_STRUCT_HASH + NONCE + Truths + parent_is_cat + lineage_proof + delta + inner_conditions + ( ; solution + singleton_inner_puzzle_hash + ) + ) + + (include condition_codes.clib) + (include curry.clib) + + (defun-inline calculate_full_puzzle_hash (SINGLETON_MOD_HASH SINGLETON_STRUCT_HASH inner_puzzle_hash) + (curry_hashes_inline SINGLETON_MOD_HASH + SINGLETON_STRUCT_HASH + inner_puzzle_hash + ) + ) + + (list + (list RECEIVE_MESSAGE 23 delta (calculate_full_puzzle_hash SINGLETON_MOD_HASH SINGLETON_STRUCT_HASH singleton_inner_puzzle_hash)) + ) +) +``` + +## Reference Implementation + +[everything_with_singleton.clsp](https://github.com/Chia-Network/chia_puzzles/blob/b90dcd6c48e748c9c3e83c9133022c7599eebb50/puzzles/cat_puzzles/everything_with_singleton.clsp) + +## Security + +Chia Network, Inc. has conducted an internal review of the code involved with this CHIP. + +## Additional Assets +None + +## Copyright +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).