Subnet Template 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
subnet-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}Run Node
Run a node with the server's minimal working example:
Start DHT / Start Node
This will start a new subnet (fresh swarm as initial node/bootnode and server in one)
subnet-server-mock \
--host_maddrs /ip4/0.0.0.0/tcp/31330 /ip4/0.0.0.0/udp/31330/quic \
--announce_maddrs /ip4/{your_ip}/tcp/31330 /ip4/{your_ip}/udp/31330/quic \
--identity_path bootnode.id \
--new_swarm \
--subnet_id 1 --subnet_node_id 1Join DHT / Start Node
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
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
Subnet Management
Available to subnet owners:
Register – Register a new subnet
Activate – Activate a registered subnet
Example
Example
Subnet Validator Node
Manage validator node registration:
Register – Register a validator node to the subnet
Remove – Remove a validator node from the subnet
Example
Example
Adding Subnet-Specific CLI Commands
To extend the CLI with custom commands for your subnet:
Create a command module:
Navigate to the
subnet/subnet_cli/directoryCreate a new directory or file for your custom commands
Register the command:
Navigate to
setup.pyfrom the root directoryLocate the
setup()function, then find theentry_pointsparameterAdd your subnet-specific commands to the
entry_pointsconfiguration alongside the built-in CLI commands
Last updated