This tutorial shows how to use the cybertensor ctcli
and the cybertensor subnet template to participate in the Availability Subnet.
Your incentive mechanisms running on the mainnet are open to anyone. They emit real GPUSSY. Creating these mechanisms incur a lock_cost
in GPUSSY.
DANGER
- Do not expose your private keys.
- Do not use your main wallet.
- Network
- recommended static ip address
- open ports for miner (default: 10000) and validator (default: 9000)
- 10+Mbps connection, Stable and low-latency connection
- Hardware
- CPU: 2 cores
- RAM: 4 GB
- HDD: < 1 TB
- Software
- OS: Ubuntu 20.04 LTS / 22.04 LTS
- Python: >=3.9.6, <3.12
NOTE: Skip this step if you already did this during local testing and development.
In your project directory:
git clone https://github.com/cybercongress/cybertensor-subnet-template.git
Next, cd
into cybertensor-subnet-template
repo directory:
cd cybertensor-subnet-template
Create and activate the python virtual environment:
python3 -m venv venv
. venv/bin/activate
Install the cybertensor subnet template package:
python -m pip install -e . # Install your subnet template package
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 validator and miner will be registered to the Availability Subnet. 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 and hotkey for the subnet miner wallet:
ctcli wallet create --wallet.name=miner --wallet.hotkey=default --cwtensor.network=space-pussy [--no_password]
Create a coldkey and hotkey for the subnet validator wallet:
ctcli wallet create --wallet.name=validator --wallet.hotkey=default --cwtensor.network=space-pussy [--no_password]
Get list of your wallet addresses:
ctcli wallet list
Transfer at least 0.3 GPUSSY to your miner and validator coldkey wallets to register in the subnet and to stake. Transfer any GPUSSY amount to your miner and validator hotkey wallets to include addresses to blockchain.
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:
ctcli subnet register --netuid=1 --wallet.name=miner --wallet.hotkey=default --cwtensor.network=space-pussy
Follow the below prompts:
Your balance is: GPUSSY0.200000000
The cost to register by recycle is GPUSSY0.100000000
Do you want to continue? [y/n] (n): y
Recycle GPUSSY0.100000000 to register on subnet:1? [y/n]: y
Gas used: 304635
📡 Checking Balance...
Balance:
GPUSSY0.200000000 ➡ GPUSSY0.100000000
✅ Registered
Next, register your validator key to the subnet:
ctcli subnet register --netuid=1 --wallet.name=validator --wallet.hotkey=default --cwtensor.network=space-pussy
Follow the below prompts:
Your balance is: GPUSSY0.200000000
The cost to register by recycle is GPUSSY0.100000000
Do you want to continue? [y/n] (n): y
Recycle GPUSSY0.100000000 to register on subnet:1? [y/n]: y
Gas used: 305564
📡 Checking Balance...
Balance:
GPUSSY0.200000000 ➡ GPUSSY0.100000000
✅ Registered
Check that your subnet validator key has been registered:
ctcli wallet overview --wallet.name=validator --cwtensor.network=space-pussy
The output will be similar to the below:
Subnet: 1
COLDKEY HOTKEY UID ACTIVE STAKE(GPUSSY) RANK TRUST CONSENSUS INCENTIVE DIVIDENDS EMISSION(GPUSSY) VTRUST VPERMIT UPDATED AXON HOTKEY
validator default 8 True 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0 0.00000 * 251566 ...:10000 pussy1…
1 0.00000 0.00000 0.00000 0.00000 0.00000 GPUSSY0 0.00000
Wallet balance: GPUSSY0.1
Check that your subnet miner has been registered:
ctcli wallet overview --wallet.name=miner --cwtensor.network=space-pussy
The output will be similar to the below:
Subnet: 1
COLDKEY HOTKEY UID ACTIVE STAKE(GPUSSY) RANK TRUST CONSENSUS INCENTIVE DIVIDENDS EMISSION(GPUSSY) VTRUST VPERMIT UPDATED AXON HOTKEY
miner default 9 True 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0 0.00000 * 251566 ...:10000 pussy1…
1 0.00000 0.00000 0.00000 0.00000 0.00000 GPUSSY0 0.00000
Wallet balance: GPUSSY0.1
Nominate your validator to the root subnet using the ctcli
:
ctcli root nominate --wallet.name=validator --wallet.hotkey=default --cwtensor.network=space-pussy
The output will be similar to the below:
✅ Finalized
2024-04-17 10:15:43.802 | SUCCESS | Become Delegate Finalized: True
Successfully became a delegate on space-pussy
Selfstake to your validator:
ctcli stake add --wallet.name=validator --wallet.hotkey=default --cwtensor.network=space-pussy
Follow the below prompts:
Enter GPUSSY amount to stake: 0.1
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 3.94it/s]
Do you want to stake to the following keys from validator:
- default:pussy1...: 0.1 GPUSSY
[y/n]: y
Do you want to stake:
amount: GPUSSY0.099000000
to: default [y/n]: y
✅ Finalized
Balance:
GPUSSY0.8... ➡ GPUSSY0.7...
Stake:
GPUSSY0.0... ➡ GPUSSY0.09...
Run the subnet miner:
python neurons/miner.py --netuid=1 --wallet.name=miner --wallet.hotkey=default --logging.debug --cwtensor.network=space-pussy --axon.port=9000
You will see the below terminal output:
>> 2024-04-17 10:17:26.604 | INFO | Running neuron on subnet: 1 with uid 9 using network: space-pussy
Run the subnet validator:
python neurons/validator.py --netuid=1 --wallet.name=validator --wallet.hotkey=default --logging.debug --cwtensor.network=space-pussy --axon.port=10000
You will see the below terminal output:
>> 2024-04-17 10:19:08.523 | INFO | Running neuron on subnet: 1 with uid 8 using network: space-pussy
To stop your nodes, press CTRL + C in the terminal where the nodes are running.