NetworksAdded

Storage Map v101 → current

Whether a subnet with given netuid exists.

Explore chain
Queried by: developersminersvalidatorssubnet ownersanalytics

The 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

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
Part of: Block EmissionTAO FlowSubnet Management

Query Keys

#NameTypeDescription
1
key1
→ netuid
u16 Subnet ID

Stored Value

Whether subnet exists

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 NetworksAdded storage
const key1 = 0;

const result = await api.query
  [stringCamelCase("SubtensorModule")]
  [stringCamelCase("NetworksAdded")](
  key1
);

console.log("NetworksAdded:", result.toHuman());

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Map
First Version
v101
Current Version
v393