Subnet Precompile
The subnet precompile allows you to interact with subnet operations on the Bittensor network through smart contracts, including functionality for registering networks, managing network parameters, and querying network state.
This page:
- described the precompile's available functions on the precompile
- demonstrates the precompile's usage with example scripts.
Precompile Address
The subnet precompile is available at address 0x803
(2051 in decimal).
Available Functions
The subnet precompile provides comprehensive functionality for subnet management and configuration. All functions are categorized below:
Network Registration
registerNetwork
Registers a new subnet without additional identity information.
Parameters:
hotkey
(bytes32): The hotkey (32 bytes) that will own the network
Returns:
- None (payable function)
Description: Registers a new subnet on the Bittensor network. The caller becomes the subnet owner and can manage subnet parameters.
registerNetworkWithIdentity
Registers a new subnet with detailed identity information.
Parameters:
hotkey
(bytes32): The hotkey that will own the networksubnetName
(string): Name of the subnet (max 256 chars)githubRepo
(string): GitHub repository URL (max 1024 chars)subnetContact
(string): Contact information (max 1024 chars)subnetUrl
(string): Subnet website URL (max 1024 chars)discord
(string): Discord server invite (max 256 chars)description
(string): Subnet description (max 1024 chars)additional
(string): Additional information (max 1024 chars)
Returns:
- None (payable function)
Description: Registers a new subnet with comprehensive identity metadata that helps users understand the subnet's purpose and how to interact with it.
Rate Limiting
getServingRateLimit
Gets the serving rate limit for a subnet.
Parameters:
netuid
(uint16): The subnetwork ID
Returns:
uint64
: The serving rate limit value
setServingRateLimit
Sets the serving rate limit for a subnet.
Parameters:
netuid
(uint16): The subnetwork IDservingRateLimit
(uint64): The new serving rate limit value
Returns:
- None (payable function)
Difficulty Management
getMinDifficulty
Gets the minimum difficulty for a subnet.
Parameters:
netuid
(uint16): The subnetwork ID
Returns:
uint64
: The minimum difficulty value
setMinDifficulty
Sets the minimum difficulty for a subnet.
Parameters:
netuid
(uint16): The subnetwork IDminDifficulty
(uint64): The new minimum difficulty value
Returns:
- None (payable function)
getMaxDifficulty
Gets the maximum difficulty for a subnet.
Parameters:
netuid
(uint16): The subnetwork ID
Returns:
uint64
: The maximum difficulty value