Skip to content

Docs edits #592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions docs/miners/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import useBaseUrl from '@docusaurus/useBaseUrl';

## Choosing a subnet

All mining in Bittensor occurs within a subnet. Each subnet independently produces the digital commodities that are its purpose, each subnet creator defining a different _incentive mechanism_ for validators to use in judging miners' work. It is validators scores of miners' performance, according to this incentive mechanism, that determines the proportion of the subnet's emissions allocated to each miner. See [Emissions](../emissions.md).
All mining in Bittensor occurs within a subnet. Each subnet independently produces the digital commodities that are its purpose. Each subnet creator defines a different _incentive mechanism_ for validators to use in judging miners' work. Its validators score miners' performances according to the subnet's incentive mechanism. These scores determine the proportion of the subnet's emissions allocated to each miner. See [Emissions](../emissions.md).

Mining in Bittensor is not like mining Bitcoin or many other blockchains, it is active, creative, and competitive. Preparing to be a subnet miner involves researching the right subnet(s) for _you_ to mine, given your own expertise and access to hardware.
Mining in Bittensor differs significantly from mining Bitcoin or other blockchains. It is active, creative, and competitive. Preparing to be a subnet miner involves researching the right subnet(s) for _you_ to mine, given your own expertise and access to hardware.

Browse the subnets and explore links to their code repositories on [TAO.app' subnets listings](https://tao.app).

:::tip Typical compute requirements
Each subnet may have distinct hardware requirements, but this [minimum requirements template for subnet creators](https://github.com/opentensor/bittensor-subnet-template/blob/main/min_compute.yml) may give an idea of minimum memory, bandwidth and storage requirements for a typical subnet node.
Each subnet may have distinct hardware requirements, but this [subnet minimum requirements template](https://github.com/opentensor/bittensor-subnet-template/blob/main/min_compute.yml#L14) may give an idea of the minimum memory, bandwidth and storage requirements for miners in a typical subnet node.

Mining is not supported on Windows.
:::
Expand All @@ -26,37 +26,46 @@ Mining is not supported on Windows.
To participate as a miner, you must first register a hotkey with the subnet in order to receive a UID on that subnet.

:::tip No need to create a subnet to mine
You **do not** have to create a subnet to mine on the Bittensor network. Most miners work on established subnets.
You **do not** have to create a subnet to mine on the Bittensor network. Most miners work on already established subnets.
:::

Registration has a cost in TAO, which fluctuates dynamically based on time since last registration. When you secure a UID slot in a subnet on the main chain, this TAO is sunk cost.
Registration has a cost in TAO, which fluctuates dynamically based on the time since the last registration. When you secure a UID slot in a subnet on the main chain, this TAO is sunk cost and cannot be recovered.

A subnet can have a maximum of 64 subnet validator UIDs and 192 subnet miner UIDs (256 total) in subnets other than Subnet 1.

Upon registration, your hotkey, which is part of your wallet, becomes the holder of the UID slot.

:::tip Ownership belongs to a hotkey
When you delegate your TAO to a subnet validator, you attach your delegated TAO to that validator’s hotkey. See [Delegation](../staking-and-delegation/delegation.md).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops, looks like this line got doubled

Suggested change
When you delegate your TAO to a subnet validator, you attach your delegated TAO to that validator’s hotkey. See [Delegation](../staking-and-delegation/delegation.md).

When you delegate your TAO to a subnet validator, you attach your delegated TAO to that validator’s hotkey. See [Delegation](../staking-and-delegation/delegation.md).

A hotkey can hold multiple UIDs across **separate** subnets. However, within one subnet, each UID must have a unique hotkey.
:::

Run the following command on your terminal, replacing `<your_preferred_netuid>`, `<my_coldkey>`, `<my_hotkey>`.
To register your keys with a subnet, run the following command on your terminal, replacing `<your_preferred_netuid>`, `<my_coldkey>`, `<my_hotkey>`.
`<your_preferred_netuid>` is the `netuid` of your preferred subnet.

```bash
btcli subnet register --netuid <your_preferred_netuid> --wallet.name <my_coldkey> --wallet.hotkey <my_hotkey>
```

For example, for subnet 1 (netuid of 1):
For example, to register your keys with subnet 1netuid of 1:

```bash
btcli subnet register --netuid 1 --wallet.name test-coldkey --wallet.hotkey test-hotkey
```

## Miner deregistration

Miners as well as validators can be deregistered if their emissions are low.
A subnet miner can be deregistered if its performance is poor. Mining is competitive—and the UID slots are limited. Aside from Subnet 1, all subnets have 256 UID slots per subnet. Of these 256 UID slots, a subnet can have a maximum of 64 subnet validator UIDs and 192 subnet miner UIDs. Each tempo, the lowest ranked miners risk being replaced by a newly registered miner, who takes over that UID.

- Every subnet has an `immunity_period` hyperparameter expressed in a number of blocks.
:::tip See
See [`immunity_period`](../subnets/subnet-hyperparameters.md#immunityperiod).
:::
- A subnet miner or validator at a UID (in that subnet) has a defined number of blocks to improve its performance. This is known as `immunity_period`. When the `immunity_period` expires, that miner or validator can be deregistered if it has the lowest performance in the subnet and a new registration arrives.
- A neuron's `immunity_period` starts when the miner or validator is registered into the subnet.
Miners as well as validators can be deregistered if their emissions are low.

Typically, subnets have 256 UID slots, with a maximum of 64 slots capable of serving as validators by default. This leaves 192 UIDs for miners, though if there are fewer than 64 eligible validators on a subnet, miners can occupy available slots.

Expand Down Expand Up @@ -132,7 +141,7 @@ btcli wallet overview --netuid

After providing your wallet name when prompted, you will see output such as:

| Parameter | Value | Description |
| Parameter | Example value | Description |
| :---------- | :----------------- | :-------------------------------------------------------------------------- |
| COLDKEY | my_coldkey | The name of the coldkey associated with your slot. |
| HOTKEY | my_first_hotkey | The name of the hotkey associated with your slot. |
Expand Down
70 changes: 42 additions & 28 deletions docs/subnets/create-a-subnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@ See also:
- Real-time subnet info on [tao.app](https://www.tao.app/explorer)
- LearnBittensor's [Subnet listings](https://learnbittensor.org/subnets)

:::info A New Subnet is not Automatically Active
To allow subnet owners to fully set up their subnets and to prevent extraction of emissions to subnet participants before the subnet is contributing to the network, new subnets are inactive and cannot be started for 7 * 7200 blocks (roughly one week) after they are registered. During this time, you can register and activate validators and invite miners into the subnet. **Be advised that the subnet and its participants will receive NO EMISSIONS during the time that the subnet is inactive.**
:::

:::tip Validating in Your Own Subnet
Ensure that you meet the [minimum requirements for validation](../validators#requirements-for-validation), or you will not be able to set weights in your own subnet.

One option for subnet owners is to ask one of the root network (subnet 0) validators to parent your validator hotkey as a childkey of theirs. This will lend their stake to your validator, and can help you ensure that your validator maintains a sufficient stake to effectively participate in consensus as well as resist deregistration. See the [Child Hotkeys](./child-hotkeys) documentation for more detail.
One option for subnet owners is to ask one of the root network (subnet 0) validators to parent your validator hotkey as a childkey of theirs. This will lend their stake to your validator, and can help you ensure that your validator maintains a sufficient stake to effectively participate in consensus as well as resist deregistration. See the [Child Hotkeys](./child-hotkeys) documentation for more detail.
:::

## Recommended flow for deploying your subnet
## Recommended flow for deploying your subnet

Before you deploy your first subnet on the mainchain, we strongly recommend that you follow the below order:

1. **Local first**: Create a subnet on your local, and develop and test your incentive mechanism on the local subnet.
2. **Testchain next**: After you are satisfied with it, create a subnet on the Bittensor testchain, and test and debug your incentive mechanism on this testchain subnet.
3. **Mainchain last**: After completing the above steps, create a subnet on the Bittensor mainchain.
Expand All @@ -38,40 +35,44 @@ Subnet creations are limited to **one subnet creation per 7200 blocks** (approxi

To create a subnet, whether locally, on testchain, or on mainchain, make sure that:

- You [installed Bittensor](../getting-started/installation.md).
- You have already [created a wallet or know how to create one](../getting-started/wallets.md#creating-a-local-wallet).
- You [installed Bittensor](../getting-started/installation.md).
- You have already [created a wallet or know how to create one](../getting-started/wallets.md#creating-a-local-wallet).

:::tip Registering vs creating vs purchasing a slot
:::tip Registering vs creating vs purchasing a slot
In Bittensor, when we say "registering your keys in a subnet", it means purchasing a UID slot in the subnet, and you will then either validate or mine on this UID. This step is also referred to as **purchasing a slot**. On the other hand, "creating a subnet" will create a subnet and give you its `netuid`.
:::

## Creating a local subnet

You must also run a local Bittensor blockchain to create and run a local subnet. Running a local blockchain is sometimes synonymously referred to as **running on staging**. Running a local blockchain spins up two authority nodes locally, not connected to any other Bittensor blockchain nodes either on testchain or mainchain.

:::tip Do not run a public subtensor node for a local subnet
Running a local blockchain is **different** from running a public subtensor node. While a local blockchain node is not connected to any other Bittensor nodes, a public subtensor node will connect to the Bittensor network, testchain, or mainchain as per how you run the subtensor node and sync with the network, giving you your own access point to the Bittensor network. **To create a local subnet, do not run a public subtensor; instead, only run a local blockchain.**
:::warning Do not run a public subtensor node for a local subnet
Running a local blockchain is **different** from running a public subtensor node. While a local blockchain node is not connected to any other Bittensor nodes, a public subtensor node will connect to the Bittensor network, testchain, or mainchain depending on how you run the subtensor node and sync with the network, giving you your own access point to the Bittensor network. **To create a local subnet, do not run a public subtensor; instead, only run a local blockchain.**
:::

### Step 1. Install and run a local blockchain node

Follow the [Bittensor Subnet Template document](https://github.com/opentensor/bittensor-subnet-template/blob/main/docs/running_on_staging.md) and run the below specified steps:

- From and including [Step 1 Installing substrate dependencies](https://github.com/opentensor/bittensor-subnet-template/blob/main/docs/running_on_staging.md#1-install-substrate-dependencies).
- To and including [Step 5 Initialize](https://github.com/opentensor/bittensor-subnet-template/blob/main/docs/running_on_staging.md#5-initialize).

The above steps will install and run a local blockchain node. Furthermore, when built with the `--features pow-faucet` flag, as instructed in the above **Step 5. Initialize**, the local blockchain node will provide the faucet feature, which you can use to mint test tokens.

### Step 2. Create wallet

If you have not already done so, create Bittensor wallet(s) using the steps described in the [Create Wallet](../getting-started/wallets.md) guide.
If you have not already done so, create Bittensor wallet(s) using the steps described in the [Create Wallet](../getting-started/wallets.md) guide.

### Step 3. Mint tokens from the faucet

You will need tokens to register the subnet (which you will create below) on your local blockchain. Run the following command to mint faucet tokens (fake TAO).
You will need tokens to register the subnet (which you will create below) on your local blockchain. Run the following command to mint faucet tokens (fake TAO).

```bash
btcli wallet faucet --wallet.name <owner-wallet-name> --subtensor.chain_endpoint ws://127.0.0.1:9946
btcli wallet faucet --wallet.name <owner-wallet-name> --subtensor.chain_endpoint ws://127.0.0.1:9946
```

Output:

```bash
>> Balance: τ0.000000000 ➡ τ100.000000000
```
Expand All @@ -81,12 +82,14 @@ Output:
Run the below command to create a new subnet on your local chain. The cost will be exactly τ100.000000000 for the first subnet you create.

```bash
btcli subnet create --wallet.name owner --subtensor.chain_endpoint ws://127.0.0.1:9946
btcli subnet create --wallet.name owner --subtensor.chain_endpoint ws://127.0.0.1:9946
```

Output:

```bash
>> Your balance is: τ200.000000000
>> Do you want to register a subnet for τ100.000000000? [y/n]:
>> Do you want to register a subnet for τ100.000000000? [y/n]:
>> Enter password to unlock key: [YOUR_PASSWORD]
>> ✅ Registered subnetwork with netuid: 1
```
Expand All @@ -103,23 +106,25 @@ By default, you must have at least 100 test TAO in your owner wallet to create a

### Step 1. Create wallet

If you have not already done so, create Bittensor wallet(s) using the steps described in the [Create Wallet](../getting-started/wallets.md) guide.
If you have not already done so, create Bittensor wallet(s) using the steps described in the [Create Wallet](../getting-started/wallets.md) guide.

### Step 2. Get the current price
### Step 2. Get the current price

```bash
btcli subnet burn-cost --subtensor.network test
```

Output:

```bash
>> Subnet lock cost: τ100.000000000
```

### Step 3. Get faucet tokens

The faucet is disabled on the testchain. Hence, if you don't have sufficient faucet tokens, ask the [Bittensor Discord community](https://discord.com/channels/799672011265015819/830068283314929684) for faucet tokens.
The faucet is disabled on the testchain. Hence, if you don't have sufficient faucet tokens, ask the [Bittensor Discord community](https://discord.com/channels/799672011265015819/1107738550373454028/threads/1331693251589312553) for faucet tokens.

### Step 4. Create the subnet
### Step 4. Create the subnet

Create your new subnet on the testchain using the test TAO you received from the previous step. This will create a new subnet on the testchain and give you its owner permissions.

Expand All @@ -130,9 +135,11 @@ Subnet creation (subnet registration) on the testchain costs test TAO. You will
Run the create subnet command on the testchain.

```bash
btcli subnet create --subtensor.network test
btcli subnet create --subtensor.network test
```

Output:

```bash
# Enter the owner wallet name, which gives the coldkey permissions to define running hyperparameters later.
>> Enter wallet name (default): owner # Enter your owner wallet name
Expand All @@ -146,38 +153,42 @@ Output:

You do not need to run a local blockchain node to create a subnet on the mainchain. Instead, your subnet will connect to the Bittensor mainchain. Follow the below steps.

:::caution Alert: Minimum required TAO
:::caution Alert: Minimum required TAO
Creating a subnet on the mainnet is competitive, and the cost is determined by the rate at which new networks are registered onto the chain. By default, you must have at least 100 TAO in your owner wallet to create a subnet on the mainchain. However, the exact amount will fluctuate based on demand.
:::

### Step 1. Create wallet

If you have not already done so, create Bittensor wallet(s) using the steps described in the [Create Wallet](../getting-started/wallets.md) guide.

### Step 2. Get the current price
### Step 2. Get the current price

The code below shows how to get the current price of creating a subnet on the mainchain (when the `--subtensor.network` option is not used, then the `btcli` will default to the `mainchain`).

```bash
btcli subnet burn-cost
```

Output:

```bash
>> Subnet lock cost: τ100.000000000
```

### Step 3. Create the subnet
### Step 3. Create the subnet

:::tip Your TAO is returned when the subnet is deregistered
Subnet creation (subnet registration) on the mainchain costs real TAO. You will get this TAO back when the subnet is deregistered.
:::

Use the below command to create a new subnet on the mainchain.
Use the below command to create a new subnet on the mainchain.

```bash
btcli subnet create
```

Output:

```bash
>> Enter wallet name (default): owner # Enter your owner wallet name
>> Enter password to unlock key: # Enter your wallet password.
Expand All @@ -186,22 +197,25 @@ Output:
✅ Registered subnetwork with netuid: 1 # Your subnet netuid will show here, save this for later.
```

:::info A New Subnet is not Automatically Active
To allow subnet owners to fully set up their subnets and to prevent extraction of emissions to subnet participants before the subnet is contributing to the network, new subnets are inactive and cannot be started for 7 \* 7200 blocks (roughly one week) after they are registered. During this time, you can register and activate validators and invite miners into the subnet. **Be advised that the subnet and its participants will receive NO EMISSIONS during the time that the subnet is inactive.**
:::

### Step 4. Check to see if you can start the subnet

Use the below command to check whether the subnet can be started.
Use the below command to check whether the subnet can be started.

```bash
btcli subnet check-start --netuid x
```

Where "x" is the subnet ID.

The output will provide you with the block registered and the block at which the subnet can be started, with "blocks remaining" and an estimated time. When this time has passed, the `check-start` command will return `Emission schedule can be started.`
The output will provide you with the block registered and the block at which the subnet can be started, with "blocks remaining" and an estimated time. When this time has passed, the `check-start` command will return `Emission schedule can be started.`

### Step 5. Start the subnet

Use the below command to start the subnet once `check-start` returns `Emission schedule can be started.`
Use the below command to start the subnet once `check-start` returns `Emission schedule can be started.`

```bash
btcli subnet start --netuid x
Expand Down
Loading