NFT Bulk Minting Tool
This document will show you how to use Chia's NFT bulk minting tool.
First, some background. Chia uses the coin set model of accounting. This is similar to Bitcoin's UTXO model. Most other blockchains, however, use an account model to track the system's overall state.
The coin set model has many advantages over the account model, but there are some tradeoffs. In the case of NFTs, they are implemented as singletons instead of a simple array. Because of this, creating multiple related NFTs in the same block can be a cumbersome process.
Enter Chia's bulk minting tool. This tool allows you to mint an arbitrarily large number of NFTs, complete with separate offers for each of them. Want to automate the minting of your 10,000 PFP collection? You've come to the right place!
The number of NFTs per spend bundle is hard-coded at 25 in this tool. It may be possible to mint more than 25 NFTs at a time, but doing so will increase the risk of the spend bundle not getting included onto the blockchain without a large fee. We feel that minting 25 NFTs at a time will strike the right balance between speed and consistency. Modify this value at your own risk.
Note about Python RuntimeError
on Windows
If you are running on Windows, you might occasionally see a Python Runtime Error. This is a known issue in Python and can be safely ignored. For example:
chia stop -d all
Exception ignored in: function _ProactorBasePipeTransport.__del__ at 0x000001A719716160
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
self._check_closed()
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
daemon: {'ack': True, 'command': 'exit', 'data': {'success': True}, 'destination': 'client', 'origin': 'daemon', 'request_id': '0de5449121b6873ce18661b2adc4213d7dc795c2943ff7f4be9502058e8eaba0'}
Download the testnet database
We strongly recommend that you test the bulk minting tool either on the testnet or by using the simulator before attempting to use it on mainnet. In addition, you will need to run a fully synced node in order to use this tool (this is true for testnet, mainnet and the simulator).
For this guide, we will use the testnet. If you do not already have a synced testnet node, you can safely download a copy of the database. Do not attempt this on mainnet. Click here to begin the download. Save the file to your Downloads folder.
At the time of this writing, the file you will download is around 50 GB, compressed. Uncompressed, it will be around 100 GB. However, this file increases in size every day. You may want to double check that you have plenty of free space before proceeding with the download.
You may continue with the next steps while the download is in progress.
Install the bulk minting tool
This section will show you how to download and install the bulk minting tool. If Chia is already installed on your system, make sure it is stopped before continuing:
chia stop -d all
If you don't already have the git
CLI tool installed, follow these instructions to install it
- Clone the chia-nft-minting-tool GitHub repository, which contains the bulk minting tool.
In order to clone this repository, first open a PowerShell (Windows) or terminal (Linux and MacOS) window. Next, run the git clone
command:
git clone https://github.com/Chia-Network/chia-nft-minting-tool.git -b main
- Change to the newly-cloned repository's directory:
cd chia-nft-minting-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 bulk minting tool. This will install a copy of Chia in your virtual environment, as well as all other dependencies for the tool:
pip install --editable .[dev]
Configure Chia to use the bulk minting tool
The bulk minting tool comes with a packaged version of Chia. In order to use the tool, you must have some TXCH (or XCH), a DID wallet, an NFT wallet, and a synced full node. If you already have all of this set up, then feel free to skip to the next section, which will show you how to use the tool.
- Run the following command to set up Chia to use the testnet:
chia configure --testnet true
If you previously had been running Chia on mainnet, then your peers table will be populated with mainnet peers. When you switch to running on the testnet, the peers listed in this table will time out. Eventually the table will be repopulated with testnet peers, but this can take a long time. In order to expedite this process, We recommend that you delete your peers tables:
~/.chia/mainnet/db/peers.dat
~/.chia/mainnet/wallet/db/wallet_peers.dat
- We recommend that you use
INFO
level logging instead of the defaultWARNING
level. To do this, run:
chia configure --set-log-level INFO
- We recommend that you use a public/private key pair for testnet that is separate from your mainnet keys. If you don't have a separate set of testnet keys, generate them by running the following command:
chia keys generate
This will give an output such as the following:
Generating private key
Added private key with public key fingerprint 3049838316
(...)
It is good security practice to use this set of keys for testnet development only. In case of key compromise, your TXCH will be sandboxed from your XCH.
- If you generated new testnet keys in the last step, we recommend that you write down your seed phrase for later recovery. Run the following:
chia keys show --show-mnemonic-seed