CAT2 Token Reissuance
CAT1 will reach its end of life at block 2,311,760, which will occur on July 26, 2022 at around 17:00 UTC.
For more information on this end-of-life process, see the Intro and FAQ guide.
This document will show CAT1 issuers how to:
- Install the CAT admin tool, which will be used to reissue tokens
- "Secure the bag" – create a tree of new coins that are identical to the original CAT1 coins, in both size and destination wallet
- "Unwind the bag" – airdrop the coins to the appropriate locations
Before starting this guide, you will need a snapshot CSV, instructions for which can be found in the Snapshot Generation guide.
Install the CAT Admin Tool
A new version of the CAT Admin Tool will be released shortly after Chia version 1.5.0
, at approximately the end-of-life block height (2311760
). You should not attempt token reissuance before you have updated to this version.
Now that you have a CSV file containing the necessary information, you can run the CAT Admin Tool to secure and airdrop a set of CAT2 tokens equivalent in size and address to their CAT1 counterparts.
- Open a new terminal window and run the following to clone the CAT Admin Tool repository, using the
main
branch:
git clone https://github.com/Chia-Network/CAT-admin-tool.git -b main
- Change to the cloned repository:
cd CAT-admin-tool
- Create a new virtual environment and then activate it:
- Windows
- Linux
- macOS
python -m venv venv
.\venv\Scripts\Activate.ps1
python3 -m venv venv
. ./venv/bin/activate
python3 -m venv venv
. ./venv/bin/activate
- Install the latest versions of
pip
,setuptools
andwheel
:
- Windows
- Linux
- macOS
python -m pip install --upgrade pip setuptools wheel
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install --upgrade pip setuptools wheel
- Install the CAT Admin Tool:
pip install .
pip install .
pip install chia-dev-tools --no-deps
pip install pytest
ERROR: Failed building wheel for CAT-admin-tool
ERROR: pip's dependency resolver...
Python 3.9+ may be required on macOS
- The CAT Admin Tool should now be installed and configured properly. To test it, run:
cats --help
cdv --help
You should get a usage statement for each command. At this point, you're ready to create your new CAT2 coins.
Secure the Bag (Single Issuance)
If your CAT used a multi-issuance TAIL, then skip to the next section.
This section will show you how to create a tree of CAT2 coins that are identical to the original CAT1 coins, in both size and destination puzzle hash (address). We'll start by demonstrating how to do this with single-issuance CATs, which typically (though not always) use the genesis_by_coin_id
TAIL.
If you are unsure whether your CAT used a single- or multi-issuance TAIL, step 1 will show you how to view the TAIL that was used to create it.
- Figure out the total number of XCH mojos that were issued for your CAT1.
- Navigate to taildatabase.com.
- Search for your CAT. We'll use Spacebucks for this example.
- You'll see Supply (and a number) under the title on the right side of your screen. The number indicates the number of tokens issued. However, you need to multiply this number by 1,000 in order to calculate the number of XCH mojos used for the issuance. For example, Spacebucks had an issuance of 1 billion (1,000,000,000) tokens, which is equivalent to 1 trillion (1,000,000,000,000) XCH mojos.
- Click the Chialisp button. This will show you the TAIL that was used for issuance. If it was a single-issuance CAT, it likely used
genesis_by_coin_id
. If you are unsure, compare the TAIL shown with the TAIL in GitHub. Take note of this TAIL as you will need to input its hex version in a subsequent step (if you used one of our reference TAILs, then you already have a copy of this file).
- Sync a Chia wallet that has at least as many XCH mojos as the original issuance.
- You must run Chia
1.5.0
or greater. - You can run either the light wallet or a full node.
- You are recommended to have enough mojos to cover transaction fees for the reissuance. The recommended amount is five hundred thousand (500,000) mojos per coin to be reissued.
- You are required to have a single coin that is large enough to cover the entire reissuance. Even if your XCH balance is sufficient, it may be separated into multiple small coins. The easiest way to ensure that you have a sufficiently large coin is to send a transaction to yourself of at least the total value required.
- Use the CAT Admin Tool to select a coin that will be used for issuing the CAT2 tokens.
From a terminal window you'll need to run the cats
command. The arguments needed for this command include:
--tail
– The TAIL program that was originally used (usually this isgenesis_by_coin_id
), in hex file format.--send-to
– Where to send the tokens when they are initially issued. This is a placeholder only – you can enter any XCH address here. The value is required, but it will be ignored.--amount
– The total number of mojos for this issuance. You need to have this many mojos in your wallet. This number must match the actual number of mojos that were originally issued.--as-bytes
– This tells the tool to output the spend bundle in bytes instead of JSON.--select-coin
– This tells the tool to select a specific coin from your wallet.
The command to run is:
cats --tail <HEX-FILE> --send-to <ADDRESS> --amount <AMOUNT> --as-bytes --select-coin
Here's an example of the command to reissue Spacebucks:
- Windows
- Linux
- macOS
cats --tail .\reference_tails\genesis_by_coin_id.clsp.hex --send-to xch1rh6punh4fy70y80ef4g89c9hqvm54dtl0fvyc4ejdccp3y6p04fqn5x8x8 --amount 1000000000000 --as-bytes --select-coin
cats --tail ./reference_tails/genesis_by_coin_id.clsp.hex --send-to xch1rh6punh4fy70y80ef4g89c9hqvm54dtl0fvyc4ejdccp3y6p04fqn5x8x8 --amount 1000000000000 --as-bytes --select-coin
cats --tail ./reference_tails/delegated_tail.clsp.hex --curry 0x8a7afe10d00899b94cf0d407b85e1b9fca21868bcf158563fe9432b60e36db7136055186221fbd27ecc7fc0d5b99ef1b --send-to xch1rd7hejemt57amqtxq8azqg90hgxyhd9shwyjuppq5ez2jn4rlznscn4efy --amount 6000000000 --as-bytes --solution "(a (q 2 (i 47 (q 8) (q 2 (i (= 45 2) () (q 8)) 1)) 1) (c (q . 0x11038a7e107cb7e17a503ba201d94166018deecd777314e4697c5269d9f37fb6) 1))" --signature b75390ee21b001b7a721f719ff045e3dc2a1072ab0824a8e75c881398db0fbed8fde5c62bbdfe629dce5da3d77834559016acd6d403f9b90d3102da2e9452461457514088af0cabe0b8a8493fc9c09d1785f1322abc8958ecf7907eba0e0abcc
The last line of the output will be something like:
Name: 8f4dbff8df3f6aa9303eb47625cf8f09d885f1ad6a2d440582cb6bd45f53d2e8
This is the Coin ID of the coin that you will use for reissuance. Keep this value handy.
- Obtain the target puzzle hash by running the "secure_the_bag" command. The important arguments here are:
--tail
– The TAIL program that was originally used (usually this isgenesis_by_coin_id
), in hex file format.--amount
– The total number of mojos for this issuance. You need to have this many mojos in your wallet. This number must match the actual number of mojos that were originally issued.--secure-the-bag-targets-path
– The full path to the CSV file that contains the snapshot of this CAT.--curry
– The value ofName:
from the above output. Note that you need to prepend0x
to this argument, so for the above example, this value would start with0x8f4
.
The command to run is:
secure_the_bag --tail <HEX-FILE> --amount <AMOUNT> --secure-the-bag-targets-path <PATH-TO-CSV-FILE> --prefix xch --curry <COIN-ID>
Here's an example of the command to secure the bag for Spacebucks:
- Windows
- Linux
- macOS
secure_the_bag --tail .\reference_tails\genesis_by_coin_id.clsp.hex --amount 1000000000000 --secure-the-bag-targets-path C:\Users\Username\Downloads\spacebucks.csv --prefix xch --curry 0x8f4dbff8df3f6aa9303eb47625cf8f09d885f1ad6a2d440582cb6bd45f53d2e8
secure_the_bag --tail ./reference_tails/genesis_by_coin_id.clsp.hex --amount 1000000000000 --secure-the-bag-targets-path /home/Username/Downloads/spacebucks.csv --prefix xch --curry 0x8f4dbff8df3f6aa9303eb47625cf8f09d885f1ad6a2d440582cb6bd45f53d2e8
secure_the_bag --tail ./reference_tails/genesis_by_coin_id.clsp.hex --amount 1000000000000 --secure-the-bag-targets-path /Users/Username/Download/spacebucks.csv --prefix xch --curry 0x8f4dbff8df3f6aa9303eb47625cf8f09d885f1ad6a2d440582cb6bd45f53d2e8
The command will create a tree of coins. This could take a long time, depending on how many coins need to be created. While it's in progress, it will output the percent complete. After it is finished, it will output the puzzle hash and address of the new coin to be created.
For this example, the final two lines of the output are:
Secure the bag root puzzle hash: 17060adf6856d2904c4fe90c9690b710cf758aee5968718e2fbfd12f7b9d817f
Secure the bag root address: xch19k6cl5syzvxgkgulr7m49v2r57yh0aanm23hrffgd89j4nj3ywhqxadyqr
You'll need both of these values later.
- Push the transaction to the network. This will actually create the coin tree (Secure the Bag). The arguments are the same as above, with one exception:
--send-to
– The XCH address from the "Secure the bag root address:" of the above output
The command to run is:
cats --tail <TAIL hex file> --send-to <root address> --amount <amount in mojos> --as-bytes --curry <0x Coin ID>
For this example, the command looks like this:
- Windows
- Linux
- macOS
cats --tail .\reference_tails\genesis_by_coin_id.clsp.hex --send-to xch19k6cl5syzvxgkgulr7m49v2r57yh0aanm23hrffgd89j4nj3ywhqxadyqr --amount 1000000000000 --as-bytes --curry 0x8f4dbff8df3f6aa9303eb47625cf8f09d885f1ad6a2d440582cb6bd45f53d2e8
cats --tail ./reference_tails/genesis_by_coin_id.clsp.hex --send-to xch19k6cl5syzvxgkgulr7m49v2r57yh0aanm23hrffgd89j4nj3ywhqxadyqr --amount 1000000000000 --as-bytes --curry 0x8f4dbff8df3f6aa9303eb47625cf8f09d885f1ad6a2d440582cb6bd45f53d2e8
cats --tail ./reference_tails/genesis_by_coin_id.clsp.hex --send-to xch19k6cl5syzvxgkgulr7m49v2r57yh0aanm23hrffgd89j4nj3ywhqxadyqr --amount 1000000000000 --as-bytes --curry 0x8f4dbff8df3f6aa9303eb47625cf8f09d885f1ad6a2d440582cb6bd45f53d2e8
You will need to confirm that you want to push the transaction, then you will receive the Asset ID
and Eve Coin ID
. For this example, the following was the result:
The transaction has been created, would you like to push it to the network? (Y/N)y
Successfully pushed the transaction to the network
Asset ID: 9c39398afb1d7ffa03a589f60e5e39f2ae4572ff7048e689fe3128c339581b2d
Eve Coin ID: 9fe3e95308949cb9c49333f829922dc7118cd3e2fdf365cde669b47852ce3a7b
You will need to use both of these values later. At this point, the amount you selected should have been deducted from your wallet in order to secure the bag. However, as this is not a standard transaction, it will not show up in the Transactions section of your wallet GUI.
After the transaction has been pushed to the blockchain, you will have successfully created a tree of coins that have an identical size and ultimate destination as the original set of CAT1 coins.