Skip to content

Latest commit

 

History

History
239 lines (163 loc) · 7.59 KB

File metadata and controls

239 lines (163 loc) · 7.59 KB

Running Subnet on Mainnet

This tutorial shows how to use the bittensor btcli to create a subnetwork and connect your incentive mechanism to it.

IMPORTANT: Before attempting to register on mainnet, we strongly recommend that you:

Your incentive mechanisms running on the mainnet are open to anyone. They emit real TAO. Creating these mechanisms incur a lock_cost in TAO.

DANGER

  • Do not expose your private keys.
  • Only use your testnet wallet.
  • Do not reuse the password of your mainnet wallet.
  • Make sure your incentive mechanism is resistant to abuse.

Prerequisites

Before proceeding further, make sure that you have installed Bittensor. See the below instructions:

After installing bittensor, proceed as below:

Steps

1. Install BitQuant-Subnet

NOTE: Skip this step if you already did this during local testing and development.

Validator Setup

# Install Python3.13 and Python3.13 tools on your OS
sudo apt update
sudo apt install python3.13 python3.13-venv python3.13-dev pkg-config

# Clone BitQuant-Subnet Repository and checkout Validator Branch
git clone https://github.com/OpenGradient/BitQuant-Subnet
cd BitQuant-Subnet
git checkout Validator

# Optional: Create Python Virtual Environment (Best Practice)
python3.13 -m venv venv
source venv/bin/activate

# Install Requirements
pip install -r requirements.txt
pip install -e .

# Set up customized environment variables in .env, or fall back to defaults
cp .env.example .env

Miner Setup

# Install Python3.13 and Python3.13 tools on your OS
sudo apt update
sudo apt install python3.13 python3.13-venv python3.13-dev pkg-config

# Clone BitQuant-Subnet Repository and BitQuant submodule
git clone --branch Miner --recursive https://github.com/OpenGradient/BitQuant-Subnet
cd BitQuant-Subnet

# Optional: Create Python Virtual Environment (Best Practice)
python3.13 -m venv venv
source venv/bin/activate

# Install Requirements
pip install -r requirements.txt
pip install -e .

# Setup all the environment variables in .env
cp .env.example .env

Note: Running a miner node requires substantially higher compute requirements due to the local running of the BitQuant agent. Setup instructions can be found https://github.com/OpenGradient/BitQuant

2. Create wallets

Create wallets for subnet owner, subnet validator and for subnet miner.

This step creates local coldkey and hotkey pairs for your three identities: subnet owner, subnet validator and subnet miner.

The owner will create and control the subnet. The owner must have at least 100 TAO before the owner can run next steps.

The validator and miner will be registered to the subnet created by the owner. This ensures that the validator and miner can run the respective validator and miner scripts.

NOTE: You can also use existing wallets to register. Creating new keys is shown here for reference.

Create a coldkey for the owner wallet:

btcli wallet new_coldkey --wallet.name owner

Create a coldkey and hotkey for the subnet miner wallet:

btcli wallet new_coldkey --wallet.name miner

and

btcli wallet new_hotkey --wallet.name miner --wallet.hotkey default

Create a coldkey and hotkey for the subnet validator wallet:

btcli wallet new_coldkey --wallet.name validator

and

btcli wallet new_hotkey --wallet.name validator --wallet.hotkey default

3. (Optional) Register keys

NOTE: While this is not enforced, we recommend subnet owners to run a subnet validator and a subnet miner on the subnet to demonstrate proper use to the community.

This step registers your subnet validator and subnet miner keys to the subnet giving them the first two slots on the subnet.

Register your miner key to the subnet:

btcli subnet recycle_register --netuid 1 --subtensor.network finney --wallet.name miner --wallet.hotkey default

Follow the below prompts:

>> Enter netuid [1] (1): # Enter netuid 1 to specify the subnet you just created.
>> Continue Registration?
  hotkey:     ...
  coldkey:    ...
  network:    finney [y/n]: # Select yes (y)
>> ✅ Registered

Next, register your validator key to the subnet:

btcli subnet recycle_register --netuid 1 --subtensor.network finney --wallet.name validator --wallet.hotkey default

Follow the below prompts:

>> Enter netuid [1] (1): # Enter netuid 1 to specify the subnet you just created.
>> Continue Registration?
  hotkey:     ...
  coldkey:    ...
  network:    finney [y/n]: # Select yes (y)
>> ✅ Registered

4. Check that your keys have been registered

Check that your subnet validator key has been registered:

btcli wallet overview --wallet.name validator 

The output will be similar to the below:

Subnet: 1                                                                                                                                                                
COLDKEY  HOTKEY   UID  ACTIVE  STAKE(τ)     RANK    TRUST  CONSENSUS  INCENTIVE  DIVIDENDS  EMISSION(ρ)   VTRUST  VPERMIT  UPDATED  AXON  HOTKEY_SS58                    
miner    default  0      True   0.00000  0.00000  0.00000    0.00000    0.00000    0.00000            0  0.00000                14  none  5GTFrsEQfvTsh3WjiEVFeKzFTc2xcf…
1        1        2            τ0.00000  0.00000  0.00000    0.00000    0.00000    0.00000           ρ0  0.00000                                                         
                                                                          Wallet balance: τ0.0         

Check that your subnet miner has been registered:

btcli wallet overview --wallet.name miner 

The output will be similar to the below:

Subnet: 1                                                                                                                                                                
COLDKEY  HOTKEY   UID  ACTIVE  STAKE(τ)     RANK    TRUST  CONSENSUS  INCENTIVE  DIVIDENDS  EMISSION(ρ)   VTRUST  VPERMIT  UPDATED  AXON  HOTKEY_SS58                    
miner    default  1      True   0.00000  0.00000  0.00000    0.00000    0.00000    0.00000            0  0.00000                14  none  5GTFrsEQfvTsh3WjiEVFeKzFTc2xcf…
1        1        2            τ0.00000  0.00000  0.00000    0.00000    0.00000    0.00000           ρ0  0.00000                                                         
                                                                          Wallet balance: τ0.0   

5. Run subnet miner and subnet validator

Run the subnet miner:

python neurons/miner.py --netuid 1  --wallet.name miner --wallet.hotkey default --logging.debug

You will see the below terminal output:

>> 2023-08-08 16:58:11.223 |       INFO       | Running miner for subnet: 1 on network: wss://entrypoint-finney.opentensor.ai:443 with config: ...

Run the subnet validator:

python neurons/validator.py --netuid 1  --wallet.name validator --wallet.hotkey default --logging.debug

You will see the below terminal output:

>> 2023-08-08 16:58:11.223 |       INFO       | Running validator for subnet: 1 on network: wss://entrypoint-finney.opentensor.ai:443 with config: ...

6. Get emissions flowing

Register to the root subnet using the btcli:

btcli root register 

Then set your weights for the subnet:

btcli root weights 

7. Stopping your nodes

To stop your nodes, press CTRL + C in the terminal where the nodes are running.