NetworksAdded
Storage Map v101 → v490 · 1 shape changeWhether a subnet with given netuid exists.
Explore chainThe Big Picture
Subnets come and go. Before interacting with a subnet, you need to know if it exists. This storage is the canonical source for subnet existence - true means active, false (or missing) means dissolved or never created.
Why This Matters
Trying to register on subnet 47? First check if it exists. This prevents wasted transactions and helps you build robust applications that handle subnet lifecycle.
Example Scenario
Query NetworksAdded(netuid=1) returns true - subnet 1 exists. Query NetworksAdded(netuid=999) returns false - no such subnet. Iterate all netuids to get a list of active subnets.
Common Questions
- What happens when a subnet is dissolved?
- The entry becomes false. The netuid may be reused for a new subnet later.
- How do I get a list of all active subnets?
- Iterate NetworksAdded from 0 to TotalNetworks and collect where value is true.
Use Cases
- Validate netuid before attempting registration
- Enumerate all active subnets on the network
- Build subnet discovery and listing tools
- Check if a subnet still exists before querying its data
From Chain Metadata
MAP ( netuid ) --> network_is_added
Purpose & Usage
Purpose
Check if a subnet ID is valid and active.
Common Query Patterns
- Check if a netuid is valid before registration
- List all active subnets by iterating
Migration Notes
key type changed from u16 to NetUid
Update decoders: SCALE encoding is positional, so any signature change (added, removed, or type-changed fields, or storage shape changes) shifts byte offsets and existing decoders will misparse this item. Re-derive types from the new metadata.
Query Keys
| # | Name | Type | Description |
|---|---|---|---|
| 1 | netuid | NetUid u16 | Subnet ID |
Stored Value
Whether the subnet has been added (the chain stores this as a bool)
Default Value
Absent keys read as this value — querying a key that has never been written returns this default, not an error or empty result.
Relationships
Code Examples
import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443
const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);
// Query NetworksAdded storage
const netuid = 1;
const result = await api.query.SubtensorModule.NetworksAdded.getValue(netuid);
console.log("NetworksAdded:", result);On-Chain Activity
Fewer than 10K writes
#261 most written storage item
Modified by both user extrinsics and runtime hooks
As of block 9,385,000
Version History
- key :
u16→NetUid
Runtime Info
View Source- Pallet
- SubtensorModule
- Storage Kind
- Map
- First Version
- v101
- Current Version
- v490