Create a Subnet
:::tip Note to miners and validators You do not have to create a subnet to mine or validate on the Cybertensor network. See the Checklist for Validating and Mining for information on mining and validating on Cybertensor. :::
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 Cybertensor 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 Cybertensor mainchain.
:::tip Subnet Registration Limits Subnet registrations are limited to one registration per 7200 blocks (approximately one day). :::
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 Cybertensor 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 * 7200blocks, which is 7 days. See the line of code that defines SubtensorInitialNetworkImmunity. This initial network immunity period starts when the subnet is created and itsnetuidis 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.
:::tip A newly created subnet starts from zero emission :::
Subnet deregistration
When a subnet is deregistered, all its UIDs are also deregistered along with it. As a result, the subnet's subnet miners and subnet validators are also deregistered. The new subnet at this netuid starts afresh and any subnet miners and subnet validators for this new subnet must register using the normal registration step, described in Register.
Prerequisites
To create a subnet, whether locally or on testchain or on mainchain, make sure that:
- You installed Cybertensor.
- You have already created a wallet or know how to create one.
:::tip Registering vs creating vs purchasing a slot 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 node
Running a local blockchain is sometimes synonymously referred as running on staging. This is different from running a local node that connects to the Cybertensor mainchain.
A local 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 PUSSY).
# Mint tokens for the subnet owner
Step 2. Create the subnet
Run the below command to create a new subnet on your local chain. The cost will be exactly GPUSSY100.000000000 for the first subnet you create.
The local chain will now have a default netuid of 1. A second registration will create netuid 2 and so on until you reach the subnet limit of 8. If you create the 9th subnet, then the subnet with the least staked PUSSY will be replaced with the newly create subnet, thereby maintaining total subnet count to 8.
Creating a subnet on testchain
Creating a subnet on the testchain is competitive. Though you will only use the faucet PUSSY tokens for testchain, the cost to create a subnet is determined by the rate at which new subnets are being registered onto the testchain.
By default, you must have at least 100 testnet PUSSY in your owner wallet to create a subnet. However the exact amount will fluctuate based on demand. Follow the below steps.
Step 1. Get the current price
Step 2. Get faucet tokens
Faucet is disabled on the testchain. Hence, if you don't have sufficient faucet tokens, ask the Cybertensor Discord community for faucet tokens.
Step 3. Create the subnet
Register (i.e., create) your new subnet on the testchain using the test PUSSY you minted from the previous step. This will create a new subnet on the testchain and give you the owner permissions to it. This step is sometimes referred as purchasing a slot.
:::tip Your PUSSY is returned when subnet is deregistered Subnet registration costs PUSSY. You will get this PUSSY back when the subnet is deregistered. :::
# Run the register subnetwork command on the testchain.
# Enter the owner wallet name which gives permissions to the coldkey to later define running hyper parameters.
Creating a subnet on mainchain
:::tip Alert: Minimum required PUSSY Creating a subnet on mainnet is competitive and the cost is determined by the rate at which new networks are being registered onto the chain. By default you must have at least 100 PUSSY in your owner wallet to create a subnetwork. However the exact amount will fluctuate based on demand. :::
Step 1. Get the current price
The code below shows how to get the current price of creating a subnetwork.
Step 2. Create the subnet
:::tip Your PUSSY is returned when subnet is deregistered Subnet registration costs PUSSY. You will get this PUSSY back when the subnet is deregistered. :::
Use the below command to register a new subnet on the mainchain.
# Run the below command to create a subnet on the mainchain (default is mainchain)
:::danger poor-performing subnets risk deregistration Finally, make sure that your subnet's performance is high, or else the subnet will risk being deregistered. See the above section on Immunity period for a subnet. :::