Subnet CLI
Built-in CLI Commands
The subnet template provides the following built-in CLI commands:
Bootnode & Bootnode API
Manages bootnode operations and API interactions.
The Bootnode API provides controlled access for frontends (e.g., scanners, stats dashboards) to query the subnet bootnode list and heartbeats (i.e,. The DHT Records "nodes"
key).
Example
mesh-dht-api \
--host_maddrs /ip4/0.0.0.0/tcp/31330 /ip4/0.0.0.0/udp/31330/quic \
--announce_maddrs /ip4/127.0.0.1/tcp/31330 /ip4/127.0.0.1/udp/31330/quic \
--identity_path {PRIVATE_KEY_PATH}
Private Key Generation
Generates private keys for deterministic peer IDs.
Note: This functionality is intended for in-subnet use only and should not be used for blockchain key generation.
Example
keygen \
--path test-ed25519.key \
--bootstrap_path test-b-ed25519.key \
--client_path test-c-ed25519.key \
--key_type ed25519
Blockchain Key Generation
Generates blockchain keys and outputs the following information:
mnemonic
– Recovery phrase for the keyprivate_key
– Private key valueaccount_id
– Account identifier (can be used as your hotkey or coldkey)
Security Warning: If you use this command to generate keys, ensure you delete this data from your log history immediately after securely storing the credentials.
Example
generate-key --words 12
Subnet Management
Available to subnet owners:
Register – Register a new subnet
Activate – Activate a registered subnet
Example
register-subnet \
--name subnet-1 \
--repo github.com/subnet-1 \
--description "artificial intelligence" \
--misc "cool subnet" \
--churn_limit 4 \
--min_stake 100.00 \
--max_stake 1000.00 \
--delegate_stake_percentage 0.1 \
--subnet_node_queue_epochs 10 \
--activation_grace_epochs 10 \
--queue_classification_epochs 10 \
--included_classification_epochs 10 \
--max_node_penalties 10 \
--initial_coldkeys "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac" "0x3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0" "0x798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc" "0x773539d4Ac0e786233D90A233654ccEE26a613D9" \
--max_registered_nodes 10 \
--key_types "Rsa" \
--bootnodes /ip4/127.0.0.1/tcp/31330/p2p/QmShJYgxNoKn7xqdRQj5PBcNfPSsbWkgFBPA4mK5PH73JB
Example
remove-subnet --subnet_id 1
Subnet Validator Node
Manage validator node registration:
Register – Register a validator node to the subnet
Remove – Remove a validator node from the subnet
Example
register-node \
--subnet_id 1 \
--hotkey 0x773539d4Ac0e786233D90A233654ccEE26a613D9 \
--peer_id QmTJ8uyLJBwVprejUQfYFAywdXWfdnUQbC1Xif6QiTNta9 \
--bootnode_peer_id QmSjcNmhbRvek3YDQAAQ3rV8GKR8WByfW8LC4aMxk6gj7v \
--bootnode /ip4/127.00.1/tcp/31330/p2p/QmSjcNmhbRvek3YDQAAQ3rV8GKR8WByfW8LC4aMxk6gj7v \
--client_peer_id QmbRz8Bt1pMcVnUzVQpL2icveZz2MF7VtELC44v8kVNwiG \
--delegate_reward_rate 0.125 \
--stake_to_be_added 100.00
Example
remove-node \
--subnet_id 1 \
--subnet_node_id 1
Adding Subnet-Specific CLI Commands
To extend the CLI with custom commands for your subnet:
Create a command module:
Navigate to the
mesh/mesh_cli/
directoryCreate a new directory or file for your custom commands
Register the command:
Navigate to
setup.py
from the root directoryLocate the
setup()
function, then find theentry_points
parameterAdd your subnet-specific commands to the
entry_points
configuration alongside the built-in CLI commands
Last updated