This tutorial shows how to use the Bittensor testnet to create a subnet and run your incentive mechanism on it.
cd
into your project directory and clone the bittensor-subnet-template repo:
1
git clone https://github.com/opentensor/bittensor-subnet-template.git
Next, cd
into bittensor-subnet-template repo directory:
1
cd bittensor-subnet-template # Enter the
Install the bittensor-subnet-template package:
1
python -m pip install -e .
Create wallets for subnet owner, subnet validator and for subnet miner.
Follow all of these steps:
1
btcli wallet new_coldkey --wallet.name owner
Create a coldkey and hotkey for your miner wallet:
1
btcli wallet new_coldkey --wallet.name miner
and
1
btcli wallet new_hotkey --wallet.name miner --wallet.hotkey default
Create a coldkey and hotkey for your validator wallet:
1
btcli wallet new_coldkey --wallet.name validator
and
1
btcli wallet new_hotkey --wallet.name validator --wallet.hotkey default
Creating subnets on the testnet is competitive. The cost is determined by the rate at which new subnets are being registered onto the chain.
1
btcli subnet lock_cost --subtensor.network test
The above command will show:
1
>> Subnet lock cost: τ100.000000000
Here is the link to the discord channel for Bittensor.
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.
btcli wallet transfer --dest 5GCahkVacWRHzVgRBfSmnt11gHnWWZhkapquzPEwR7je1a8w --wallet.name owner --amount 0.001 --subtensor.network test
Repeat this step for the validator wallet as well.
btcli wallet transfer --dest 5FZSLAZsiFaZzhcL2oxMesSrQQHmWHSGpPfNjMUmiruBpYGB --wallet.name owner --amount 0.001 --subtensor.network test
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:
1
btcli subnet register --netuid 15 --subtensor.network test --wallet.name miner --wallet.hotkey default
Follow the below prompts:
1
2
3
4
5
6
>> 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:
1
btcli subnet recycle_register --netuid 15 --subtensor.network test --wallet.name validator --wallet.hotkey default
Follow the prompts:
1
2
3
4
5
6
>> 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
This step returns information about your registered keys.
Check that your miner has been registered:
1
btcli wallet overview --wallet.name miner --subtensor.network test
The above command will display the below:
1
2
3
4
5
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
Run the subnet miner:
1
python neurons/miner.py --netuid 15 --subtensor.network test --wallet.name miner --wallet.hotkey default --logging.debug
You will see the below terminal output:
1
2
3
4
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