Metagraph Precompile
The metagraph precompile allows you to query information about neurons, their relationships, and network state in the Bittensor network. This precompile provides read-only access to the metagraph data through smart contracts at precompile address 2050
.
Overview
The metagraph precompile enables smart contracts to query metagraph data. It provides access to metrics on a subnets' miners and validators neurons, including stakes, ranks, trust scores, consensus values, and more.
All functions in this precompile are view-only operations that don't modify state and consume minimal gas.
Source Code and Tests
- Source Code: metagraph.rs
- Test Examples: metagraph precompile tests
Function Reference
Network Information
getUidCount
Returns the total number of UIDs (neurons) in a specific subnetwork.
Parameters:
netuid
(uint16): The subnetwork ID to query
Returns:
uint16
: Total count of neurons in the subnetwork