Queried by: analyticsdeveloperssubnet owners
The Big Picture
This counter reflects Bittensor's growth as an ecosystem. Each subnet represents a unique AI task or market. More subnets = more diversity in the network's capabilities. This is a key health metric for the protocol.
Why This Matters
How many subnets exist? This single number tells you the scale of the Bittensor ecosystem. Also useful as an upper bound when iterating through netuids.
Example Scenario
Query TotalNetworks() returns 52. There are 52 subnets registered on the network. Use this with NetworksAdded to iterate: for netuid in 0..52, check NetworksAdded(netuid).
Common Questions
- Does this include dissolved subnets?
- This is the high-water mark - netuids go from 0 to TotalNetworks-1, but some may be dissolved. Check NetworksAdded for active status.
- Is there a maximum?
- Yes, there's a runtime limit on total subnets. Check SubnetLimit for the cap.
Use Cases
- Display total subnet count on dashboards
- Track network growth over time
- Determine upper bound for netuid iteration
- Monitor ecosystem expansion metrics
Purpose & Usage
Purpose
Track network growth and subnet capacity.
Common Query Patterns
- Single value query
Stored Value
value (u16)
Relationships
Code Examples
import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";
const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });
// Query TotalNetworks storage (no keys - plain value)
const result = await api.query
[stringCamelCase("SubtensorModule")]
[stringCamelCase("TotalNetworks")]();
console.log("TotalNetworks:", result.toHuman());Runtime Info
View Source- Pallet
- SubtensorModule
- Storage Kind
- Plain
- First Version
- v101
- Current Version
- v393