Issuing a custom cat

I am trying to issue my own cat.
I have found the cat admin tool and seen that I can choose a custom tail there which governs minting/melting of my coin.

However, to govern how and where a user can spend the coins, I need to implement a custom inner_puzzle and solution.
I then need to compile the official cat_v2.clvm (chia-blockchain/cat_v2.clvm at fad414132e6950e79e805629427af76bf9ddcbc5 · Chia-Network/chia-blockchain · GitHub) with my own inner solution.

Is that correct so far?

That sounds right, yes. The standard puzzle allows you to add custom inner puzzles and solutions. Do keep in mind that wallets might not recognize your custom puzzle/solution out of the box, but you will be able to use them via CLI/RPC calls to query the blockchain directly.

Thank you for the heads up, that would be a major bummer.
I cant expect end customers to fiddle with the cli.

What have I found so far:

  • cat_v2.clvm from the github repo, which I think is the chia contract.
  • p2_delegated_puzzle_or_hidden_puzzle.clsp which I believe is the default inner puzzle
  • tails from cat-admin-tool

cat_v2.clvm has the following arguments:

      MOD_HASH                 ;; curried into puzzle (hardcoded when the contract is compiled/ written to Blockchain)
      TAIL_PROGRAM_HASH        ;; hardcoded (curried) at compile time, contains limitations on issuance and melt
      INNER_PUZZLE             ;; hardcoded (curried) at compile time, contains program to verify spend
      inner_puzzle_solution    ;; if invalid, INNER_PUZZLE will fail
      lineage_proof            ;; This is the parent's coin info, used to check if the parent was a CAT. Optional if using tail_program.
      prev_coin_id             ;; used in this coin's announcement, prev_coin ASSERT_COIN_ANNOUNCEMENT will fail if wrong
      this_coin_info           ;; verified with ASSERT_MY_COIN_ID
      next_coin_proof          ;; used to generate ASSERT_COIN_ANNOUNCEMENT
      prev_subtotal            ;; included in announcement, prev_coin ASSERT_COIN_ANNOUNCEMENT will fail if wrong
      ;; If the extra delta is anything other than 0, the TAIL program is forced to run. It must evaluate whether to permit the extra delta, or fail with an (x) call.
      extra_delta              ;; if you want to mint or melt additional tokens

If My research is correct, I would have to provide MOD_HASH, TAIL_PROGRAM_HASH and INNER_PUZZLE for currying and minting the first coin.

I`m a little confused on why there is only a hash of the tail. I think I might have to reverse engineer parts of the cat-admin-tool.

References, documentations etc are much appreciated, the information I find are very sparse.

The hash of the TAIL is required so that whenever the TAIL needs to be run, it cannot be changed for a different TAIL. The original TAIL puzzle only needs to be revealed in the (probably rare) case when the TAIL is run, so it is not included in the main CAT puzzle.

To see how the TAIL program is calculated from the solution, see find_and_strip_tail_info:

I am past the tail for now.

im am right now trying to curry the SYNTHETIC_PUBLIC_KEY into my custom inner puuzle.
To confirm:
The syntetic key consits of:

synthetic_public_key = original_public_key + synthetic_offset_pubkey
  • the synthetic offset pubkey is usually the hash of the empty puzzle (=):
cdv hash "(=)"
  • The original pubkey represents the wallets master pub key, obtainable with:
chia keys show
Showing all public keys derived from your master seed and private key:

Fingerprint: 2960367160
Master public key (m): b7c959c3014ac2a15aaafcdaae3ecc53600584be4e102daebda9a8599024b91e80468f227462ed6226553149fb2e47d6
  • The synthetic pubkey can then be obtained with cdv inspect:
cdv inspect keys --synthetic --public-key b7c959c3014ac2a15aaafcdaae3ecc53600584be4e102daebda9a8599024b91e80468f227462ed6226553149fb2e47d6 --hidden-puzhash 587f5b91ec4a68407ae7ff98a40ff81be1fa12b1fd215f71b2bd8198fada069e
Public Key: 87e6edc9b7e63168cbb49a45d220eccf175094dac015301de3e09bbbbc1a9bd457c9649597178972815f7d61ba28e506
Fingerprint: 3905488689
HD Path: m

→ so this is what I would curry into my inner puzzle:

1 Like

I am further again.
So the official cat-admin-tool can be used to create a custom cat. Instead of putting your wallet as receive address, You can put the puzzhash of your inner puzzle.
Then the cat is created there and the inner_puzzle is the “owner” of it.
After the cat has been created, a custom spend has to be made in order to transfer the cat into your wallet and to replace the inner puzzle.

So far confirmed by chia techs.
I have created a cat this way but it is stuck where I have to create the custom spend.
For the custom spend, I likely need to reveal either the inner puzzle or the full puzzle of the cat tool.
The following code can be inserted into in order to obtain the full puzzle:

# write puzzles to disk
print("saving puzzles to disk!")
with open("inner_puzzle.clvm", "w") as p2_file:
with open("full_cat_puzzle.clvm", "w") as cat_file:

Note: cat-admin-tool must be installed again with pip install .

further investigation is stil longoing, next I have to check if these puzzles can be used as a reveal for the resulting coin