|
| 1 | +--- |
| 2 | +title: "Create a Subnet (Locally)" |
| 3 | +--- |
| 4 | + |
| 5 | +# Create a Subnet (Locally) |
| 6 | + |
| 7 | +This page covers creating a subnet on a locally deployed Subtensor blockchain, which is useful for local Bittensor development. |
| 8 | + |
| 9 | +For creating a subnet on Bittensor test and main network, see [Create a Subnet](../subnets/create-a-subnet). |
| 10 | + |
| 11 | +Prerequisites: |
| 12 | +- [Deploy a Subtensor chain locally](./deploy) |
| 13 | +- [Provision wallets for the sn-creator, miner, and validator users for this tutorial.](./provision-wallets) |
| 14 | + |
| 15 | +## Create subnet (unsuccessful) |
| 16 | + |
| 17 | +To access the handy pre-provisioned development "Alice" account on your local chain, use: |
| 18 | + |
| 19 | +```shell |
| 20 | +btcli subnet create \ |
| 21 | +--subnet-name awesome-first-subnet \ |
| 22 | +--wallet.name sn-creator \ |
| 23 | +--subtensor.chain_endpoint ws://127.0.0.1:9945 |
| 24 | +``` |
| 25 | +### Trouble shoot |
| 26 | +#### Insufficient funds |
| 27 | + |
| 28 | +If you are following this tutorial for the first time, the `subnet create` command will faill with an insufficient balance error. |
| 29 | + |
| 30 | +The coldkey signing the `subnet create` transaction must have a sufficient $\tau$ balance to cover the burn cost of subnet creation, so called because the funds cannot be recovered. |
| 31 | + |
| 32 | +```console |
| 33 | +Subnet burn cost: τ 1,000.0000 |
| 34 | +Your balance of: τ 0.0000 is not enough to burn τ 1,000.0000 to register a subnet. |
| 35 | +``` |
| 36 | + |
| 37 | +Transfer funds from the Alice account to cover it and try again. Consult `btcli w list` and carefully check the ss58 address of the destination coldkey (in this case, the one with the name `sn-creator`). |
| 38 | + |
| 39 | +```shell |
| 40 | +btcli wallet transfer \ |
| 41 | +--amount 1001 \ |
| 42 | +--wallet.name alice \ |
| 43 | +--destination "5C9xw4..." \ |
| 44 | +--subtensor.chain_endpoint ws://127.0.0.1:9945 |
| 45 | +``` |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | +#### Network Rate Limit Error |
| 51 | + |
| 52 | +If you see a network rate limit error, you may need to adjust the `SubtensorInitialNetworkRateLimit` chain state parameter. |
| 53 | + |
| 54 | +See [Clone and tweak the Subtensor source](./deploy#clone-and-tweak-the-subtensor-source) |
| 55 | + |
| 56 | +### Burn cost |
| 57 | + |
| 58 | +The burn cost for subnet creation is dynamic; it lowers gradually and doubles every time a subnet is created. |
| 59 | + |
| 60 | +:::tip try it live |
| 61 | + |
| 62 | +Check the burn cost to create a subnet on Bittensor main network and test network: |
| 63 | + |
| 64 | +< link rel= "stylesheet" href= "https://unpkg.com/@antonz/[email protected]/dist/snippet.css" /> |
| 65 | +<codapi-settings url="https://bittensor-codex.com/v1"> |
| 66 | +</codapi-settings> |
| 67 | + |
| 68 | +```shell |
| 69 | +btcli subnet burn-cost --network finney |
| 70 | +``` |
| 71 | +<codapi-snippet sandbox="python" editor="basic" init-delay="500"> |
| 72 | +</codapi-snippet> |
| 73 | + |
| 74 | +```shell |
| 75 | +btcli subnet burn-cost --network test |
| 76 | +``` |
| 77 | +<codapi-snippet sandbox="python" editor="basic" init-delay="500"> |
| 78 | +</codapi-snippet> |
| 79 | +::: |
| 80 | + |
| 81 | +## Fund your subnet |
| 82 | + |
| 83 | +To remedy your liquidity shortfall, transfer $\tau$ from the Alice account and try again. |
| 84 | + |
| 85 | +1. First, get the ss58 address for the destination wallet for the transfer: |
| 86 | + ```shell |
| 87 | + btcli w list |
| 88 | + ``` |
| 89 | + ```shell |
| 90 | + ... |
| 91 | + ── Coldkey sn-creator ss58_address 5C9xw4gDyu11ocdpWrmhT1sbi4xEHCpzEMsyMA4jGfAZQofQ |
| 92 | + └── Hotkey default ss58_address 5GVsCAY6RuSuoAA1E77xsHJ9PjdZJjJrRkNFDxVtRKPnw7TR |
| 93 | + ``` |
| 94 | +1. Execute the transfer from alice to the sn-creator wallet |
| 95 | + |
| 96 | + ```console |
| 97 | + btcli wallet transfer \ |
| 98 | + --amount 1001 \ |
| 99 | + --wallet.name alice \ |
| 100 | + --destination "5GVsCAY6RuSuoAA1E77xsHJ9PjdZJjJrRkNFDxVtRKPnw7TR" \ |
| 101 | + --subtensor.chain_endpoint ws://127.0.0.1:9945 |
| 102 | + ``` |
| 103 | + |
| 104 | + ```shell |
| 105 | + Do you want to transfer: |
| 106 | + amount: τ 1,001.0000 |
| 107 | + from: alice : 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY |
| 108 | + to: 5GVsCAY6RuSuoAA1E77xsHJ9PjdZJjJrRkNFDxVtRKPnw7TR |
| 109 | + for fee: τ 0.0001 [y/n]: y |
| 110 | + 🌏 📡 Transferring... |
| 111 | + ``` |
| 112 | +## Success |
| 113 | +Create some subnets. |
| 114 | + |
| 115 | +For example: |
| 116 | + |
| 117 | +```shell |
| 118 | +btcli subnet create \ |
| 119 | +--subnet-name awesome-first-subnet \ |
| 120 | +--wallet.name sn-creator \ |
| 121 | +--subtensor.chain_endpoint ws://127.0.0.1:9945 |
| 122 | +``` |
| 123 | +```console |
| 124 | +Subnet burn cost: τ 1,000.0000 |
| 125 | +Your balance is: τ 1,001.0000 |
| 126 | +Do you want to burn τ 1,000.0000 to register a subnet? [y/n]:y |
| 127 | +Enter your password: |
| 128 | +Decrypting... |
| 129 | +🌏 📡 Registering subnet.. |
| 130 | +``` |
| 131 | + |
| 132 | + |
| 133 | +```shell |
| 134 | + btcli subnet create \ |
| 135 | +--subnet-name awesome-second-subnet \ |
| 136 | +--wallet.name sn-creator \ |
| 137 | +--subtensor.chain_endpoint ws://127.0.0.1:9945 |
| 138 | +``` |
| 139 | + |
| 140 | +```console |
| 141 | +Subnet burn cost: τ 1,999.9405 |
| 142 | +▰▱▱▱▱▱▱ 📡Retrieving lock cost from custom... |
| 143 | +Your balance is: τ 2,003.0000 |
| 144 | +Do you want to burn τ 1,999.9405 to register a subnet? [y/n]: Please enter Y or N |
| 145 | +Do you want to burn τ 1,999.9405 to register a subnet? [y/n]: y |
| 146 | +Enter your password: |
| 147 | +Decrypting... |
| 148 | +✅ Registered subnetwork with netuid: 3 |
| 149 | +``` |
| 150 | + |
| 151 | +1. List your subnets |
| 152 | + |
| 153 | +```shell |
| 154 | +btcli subnet list \ |
| 155 | +--subtensor.chain_endpoint ws://127.0.0.1:9945 |
| 156 | +``` |
| 157 | +```console |
| 158 | + Subnets |
| 159 | + Network: custom |
| 160 | + ┃ ┃ Price ┃ Market Cap ┃ ┃ P (τ_in, ┃ Stake ┃ ┃ |
| 161 | + Netuid ┃ Name ┃ (τ_in/α_in) ┃ (α * Price) ┃ Emission (τ) ┃ α_in) ┃ (α_out) ┃ Supply (α) ┃ Tempo (k/n) |
| 162 | +━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━ |
| 163 | + 0 │ τ root │ 1.0000 τ/Τ │ τ 0.00 │ τ 0.0000 │ -, - │ Τ 0.00 │ 0.00 Τ /21M │ -/- |
| 164 | + 2 │ β │ 1.0000 τ/β │ τ 1.00k │ τ 0.0000 │ τ 1.00k, │ 0.00 β │ 1.00k β │ 29/360 |
| 165 | + │ awesome-fi… │ │ │ │ 1.00k β │ │ /21M │ |
| 166 | + 3 │ γ │ 1.0000 τ/γ │ τ 1.00k │ τ 0.0000 │ τ 1.00k, │ 0.00 γ │ 1.00k γ │ 29/360 |
| 167 | + │ awesome-se… │ │ │ │ 1.00k γ │ │ /21M │ |
| 168 | + 1 │ α apex │ 1.0000 τ/α │ τ 11.00 │ τ 0.0000 │ τ 10.00, │ 1.00 α │ 11.00 α │ 29/100 |
| 169 | + │ │ │ │ │ 10.00 α │ │ /21M │ |
| 170 | +────────┼─────────────┼─────────────┼─────────────┼──────────────┼─────────────┼──────────────┼─────────────┼───────────── |
| 171 | + 4 │ │ τ 3.0 │ │ τ 0.0 │ τ │ │ │ |
| 172 | + │ │ │ │ │ 2.01k/29.00 │ │ │ |
| 173 | + │ │ │ │ │ (6931.03%) │ │ │ |
| 174 | +``` |
0 commit comments