Skip to content

Latest commit

 

History

History
198 lines (135 loc) · 5.71 KB

File metadata and controls

198 lines (135 loc) · 5.71 KB
title Mining on Bittensor
createdAt Mon Jan 13 2025 21:20:40 GMT+0000 (Coordinated Universal Time)
updatedAt Tue Jan 21 2025 20:01:17 GMT+0000 (Coordinated Universal Time)

Vast internal guide to test subnets inside the Opentensor image

This tutorial shows how to use the Bittensor testnet to create a subnet and run your incentive mechanism on it.

1. Install Bittensor subnet template

cd into your project directory and clone the bittensor-subnet-template repo:

git clone https://github.com/opentensor/bittensor-subnet-template.git 

Next, cd into bittensor-subnet-template repo directory:

cd bittensor-subnet-template # Enter the 

Install the bittensor-subnet-template package:

python -m pip install -e . 

2. Create wallets

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

Follow all of these steps:

btcli wallet new_coldkey --wallet.name owner

Create a coldkey and hotkey for your 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 your validator wallet:

btcli wallet new_coldkey --wallet.name validator

and

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

3. Get the price of subnet creation

Creating subnets on the testnet is competitive. The cost is determined by the rate at which new subnets are being registered onto the chain.

btcli subnet lock_cost --subtensor.network test

The above command will show:

>> Subnet lock cost: τ100.000000000

4 Go to the Bittensor discord channel and ask them for test Taos

Here is the link to the discord channel for Bittensor.

4.5 Transfer test Taos to your miner wallet

Use the following command to list all your wallets:

    btcli w list

You will get an output like this:

    Wallets
    ├── 
    │   owner (5FyRdpzddeN7KGLhn6S6ia1up7dzbtXiZ5trc2hmm9AN9Pj4)
    ├── 
    │   miner (5GCahkVacWRHzVgRBfSmnt11gHnWWZhkapquzPEwR7je1a8w)
    │   └── default (5CUgZBi3GQpJDhe1EhdPJfzBb6pyWvnkuSWJ6SBhEpSby1XP)
    └── 
        validator (5FZSLAZsiFaZzhcL2oxMesSrQQHmWHSGpPfNjMUmiruBpYGB)
        └── default (5EqaFbjHDUQCHRbG5592QvCbpNkvAxsLCLKRNoLaVLN76g55)

Then transfer 0.001 Taos to your miner and validator wallet.

Transfer to miner wallet

    btcli wallet transfer --dest 5GCahkVacWRHzVgRBfSmnt11gHnWWZhkapquzPEwR7je1a8w --wallet.name owner --amount 0.001 --subtensor.network test

Make sure the --dest key is the same as your wallet key that you get from the btcli w list command.

Transfer to validator wallet

Repeat this step for the validator wallet as well.

    btcli wallet transfer --dest 5FZSLAZsiFaZzhcL2oxMesSrQQHmWHSGpPfNjMUmiruBpYGB --wallet.name owner --amount 0.001 --subtensor.network test

6. Register keys

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 register --netuid 15 --subtensor.network test --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 15 --subtensor.network test --wallet.name validator --wallet.hotkey default

Follow the 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

7. Check that your keys have been registered

This step returns information about your registered keys.

Check that your miner has been registered:

btcli wallet overview --wallet.name miner --subtensor.network test

The above command will display 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   

8. Run subnet miner and subnet validator

Run the subnet miner:

python neurons/miner.py --netuid 15 --subtensor.network test --wallet.name miner --wallet.hotkey default --logging.debug

You will see the below terminal output:

2024-01-22 17:34:42.694 |       INFO       | Miner running...              1705944882.6945262
2024-01-22 17:34:47.700 |       INFO       | Miner running...              1705944887.7002594
2024-01-22 17:34:52.706 |       INFO       | Miner running...              1705944892.7061048
2024-01-22 17:34:57.712 |       INFO       | Miner running...              1705944897.7120056