CAT Creation Tutorial
The CAT standard allows you to create fungible tokens on the Chia blockchain. This step-by-step guide will go through creating your own CATs. For info on how CATs are built at the Chialisp level, see our CAT primitive page.
Alternatively, if you're looking for non-fungible tokens on Chia, check out our NFT guide.
Introduction
Welcome to the world of CATs! We're excited to have you here, and we can't wait to see the creative ideas you come up with.
This tutorial will help you jump right in and get started with issuing your own CATs. To minimize your risk of running into unexpected results, we recommend that you do following:
- Generate a new public/private key pair for each CAT you issue.
- Test thoroughly on testnet before issuing your CAT to mainnet.
For any questions regarding this tutorial, head over to the #chialisp channel on our Discord chatroom, where there are lots of friendly folks who can help you.
CAT Issuance Granularity
CAT denominations, as well as the rules behind issuance and melting, can take some getting used to. Here are a few things to keep in mind before you issue your CAT:
-
Most Chia wallets choose to display their value in XCH. However, this is a purely cosmetic choice because Chia's blockchain only knows about mojos. One XCH is equal to one trillion (1,000,000,000,000) mojos.
-
In a similar vein, Chia Network Inc. has made the design decision to map 1 CAT to 1000 mojos. This ratio will be the same for all CATs.
警告Theoretically, it would be possible to set the CAT:mojo ratio to something other than 1:1000 for a specific CAT, but we strongly recommend against doing this. The Chia reference wallet will not support CATs with a ratio other than 1:1000. Additionally, if you created your own wallet with support for different ratios, users of this wallet would almost certainly be confused and accidentally spend too much or too little money, by multiple orders of magnitude. Please don't attempt this.
-
The melt value of a single token is 1000 mojos. This remains true regardless of the token's face value or its circulating supply.
-
A token's face value and its melt value are not necessarily correlated, let alone matched.
With one XCH, you can issue 1 billion CATs. The face value of these tokens could be zero, or multiple XCH, or anywhere in between. This value is decided by the market -- it's worth whatever someone is willing to pay for it. The value of the tokens has nothing to do with the underlying XCH, other than their 1000-mojo melt value.
These concepts are discussed in greater detail in our CAT primitive page.
Setting up your Chia Environment
Cat issuance comes in two phases. First, you will test your issuance on a testnet. Once ready, you will issue on mainnet.
For this tutorial, we'll use testnet11.
Ensure that you have Python 3.7 or later by running:
- Linux/MacOS --
python3 --version
- Windows --
python --version
-
Install the latest version of Chia's reference wallet. For more info, see our installation guide.
-
Configure Chia to run on testnet11. For more info, see our testnet documentation.
-
Start Chia's reference wallet GUI. The command you use will depend on your OS, as well as whether you used a binary installer or installed from source. If you need help, see the installation guide.
When using the GUI, you have the option of running in Farming Mode
or Wallet Mode
. Both of these options will work for creating CATs. Farming Mode
will be faster if you already have a synced full node, but this is not necessary for CAT issuance.
You can also run Chia's reference wallet from a command line if you prefer.
-
Add a new wallet if you have not already done so.
-
You will need to have a sufficient number of mojos for your CAT issuance and transaction fee(s). You can request some TXCH from the Testnet11 faucet.
-
Before issuing a CAT, you will need to have a synced wallet, as demonstrated by the green checkmark inside the red circle in this image:
![Synced wallet](/img/cat/01_cat.png)
Once you have a synced wallet and some TXCH, you are ready to run the CAT admin tool.
CAT Admin Tool
Now we will set up the CAT admin tool, which will help you to issue your CATs:
- Linux/macOS
- Windows
Your Linux installation may not come with Python's development tools installed by default. To be sure that these tools are installed, run:
sudo apt-get install -y build-essential python3-dev
Next, clone the tool's GitHub repository:
git clone https://github.com/Chia-Network/CAT-admin-tool.git -b main --recurse-submodules
Change to the admin tool's directory:
cd CAT-admin-tool
Create and activate a virtual environment:
python3 -m venv venv
. ./venv/bin/activate
Install the prerequisites:
python3 -m pip install --upgrade pip setuptools wheel
Install the tool:
pip install .
Install chia dev tools:
pip install chia-dev-tools --no-deps
Install pytest:
pip install pytest
Next, clone the tool's GitHub repository:
git clone https://github.com/Chia-Network/CAT-admin-tool.git -b main --recurse-submodules
Change to the admin tool's directory:
cd CAT-admin-tool
Create and activate a virtual environment:
python -m venv venv
.\venv\Scripts\Activate.ps1
Install the prerequisites:
pip install --upgrade pip setuptools wheel
Install the tool:
pip install .
Install Chia dev tools:
pip install chia-dev-tools --no-deps
Install pytest:
pip install pytest
You might receive an error such as ERROR: Failed building wheel for CAT-admin-tool. This is likely safe to ignore. As long as you can run cats --help without errors, the tool has been installed properly.
Your environment should be all set, but let's make sure:
-
Run
cats --help
. You should get a usage statement. -
Run
cdv --help
. You should get another usage statement.
Your environment is now set up and you are ready to start issuing CATs!