Create a Subnet
Before you create your first subnet, we strongly recommend that you follow the below order:
- First create a subnet on your local, and develop and test your incentive mechanism on the local subnet.
- After you are satisfied with it, next create a subnet on the Bittensor testchain, and test and debug your incentive mechanism on this testchain subnet.
- Finally, only after you completed the above steps, create a subnet on the Bittensor mainchain.
Immunity period for a subnet
The notion of immunity_period applies to a subnet also. It works like this:
-
Subnets are competitive and only 32 subnet slots exist in the Bittensor network. As a result, subnet performance is continously monitored, poor-performing subnets are deregistered and the registration cost will be returned to the deregistered subnet owner.
-
A subnet's performance is measured using the emissions earned by the subnet: The lower the emission earned by the subnet, the poorer is the subnet's performance. See Emissions.
-
Furthermore, any subnet has an immunity period of
7 * 7200
blocks, which is 7 days. See the line of code that defines SubtensorInitialNetworkImmunity. This initial network immunity period starts when the subnet is created and itsnetuid
is issued to the subnet owner. During this immunity period the subnet is not under any risk of being deregistered. -
However, at the end of this immunity period, if the subnet's emissions are the lowest among all the 32 subnets, then this subnet will be deregistered when a new subnet registration request arrives. If there are several subnets with the lowest emission then the oldest subnet among the lowest will be deregistered first, and then the second oldest, and so on.
Prerequisites
To create a subnet, whether locally or on testchain or on mainchain, make sure that:
- You installed Bittensor.
- You have already created a wallet or know how to create one.
Registering a subnet will create the subnet. This step is also referred as purchasing a slot.
Creating a local subnet (staging)
Local blockchain vs local subtensor node
Running a local blockchain is sometimes synonymously referred as running on staging. This is different from running a local subtensor node that connects to the Bittensor mainchain.
A local subtensor node will connect to the mainchain and sync with the mainchain, giving you your own access point to the mainchain.
Running a local blockchain spins up two authority nodes locally, not connected to any other nodes or testchain or mainchain. The below instructions are applicable when you want to create a local subnet together with creating a local blockchain.
Step 1. Mint tokens from faucet
You will need tokens to register a subnet on your local. Run the following command to mint faucet tokens (fake TAO).
# Mint tokens for the subnet owner
btcli wallet faucet --wallet.name <owner-wallet-name> --subtensor.chain_endpoint ws://127.0.0.1:9946
>> Balance: τ0.000000000 ➡ τ100.000000000