| 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) |
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:
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 . Create wallets for subnet owner, subnet validator and for subnet miner.
Follow all of these steps:
btcli wallet new_coldkey --wallet.name ownerCreate a coldkey and hotkey for your miner wallet:
btcli wallet new_coldkey --wallet.name minerand
btcli wallet new_hotkey --wallet.name miner --wallet.hotkey defaultCreate a coldkey and hotkey for your validator wallet:
btcli wallet new_coldkey --wallet.name validatorand
btcli wallet new_hotkey --wallet.name validator --wallet.hotkey defaultCreating 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 testThe above command will show:
>> Subnet lock cost: τ100.000000000Here 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
Make sure the --dest key is the same as your wallet key that you get from the btcli w list command.
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:
btcli subnet register --netuid 15 --subtensor.network test --wallet.name miner --wallet.hotkey defaultFollow 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)
>> ✅ RegisteredNext, register your validator key to the subnet:
btcli subnet recycle_register --netuid 15 --subtensor.network test --wallet.name validator --wallet.hotkey defaultFollow 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)
>> ✅ RegisteredThis step returns information about your registered keys.
Check that your miner has been registered:
btcli wallet overview --wallet.name miner --subtensor.network testThe 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 Run the subnet miner:
python neurons/miner.py --netuid 15 --subtensor.network test --wallet.name miner --wallet.hotkey default --logging.debugYou 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