Uids

Storage Map v101 → v490 · 1 shape change

UID assigned to a hotkey on a subnet .

Explore chain
Queried by: minersvalidatorsdevelopersanalytics

The Big Picture

UIDs are the internal identifiers for neurons on each subnet. When validators set weights, they use UIDs, not hotkey addresses. This storage lets you translate between the two - given a hotkey, what's its UID on this subnet?

Why This Matters

You registered on subnet 1 - what's your UID? Validators need UIDs to set weights. Miners need UIDs to understand their position. This is the hotkey→UID lookup.

Example Scenario

Query Uids(netuid=1, hotkey=your_hotkey) returns 47. Your neuron is UID 47 on subnet 1. If it returns None/default, you're not registered on that subnet.

Common Questions

What if I'm not registered?
Uids is an Optional-modifier map, so an unregistered hotkey returns None rather than a zero UID. Clients that surface a default may show 0, which is a real UID, so check IsNetworkMember for definitive registration status.
Can UIDs change?
UIDs are reassigned when neurons are pruned and slots reused. Your UID is stable while registered but may be given to someone else after deregistration.

Use Cases

  • Find your neuron's UID after registration
  • Check if a hotkey is registered on a subnet
  • Map hotkey addresses to UIDs for weight setting
  • Verify registration status before operations

From Chain Metadata

DMAP ( netuid, hotkey ) --> uid

Purpose & Usage

Purpose

Map hotkey to its neuron UID within a subnet.

Common Query Patterns

  • Query UID for a hotkey on a specific subnet
  • Check if a hotkey is registered on a subnet
Part of: Neuron RegistrationNeuron Pruning

Migration Notes

v424 v432 Breaking

key type changed from (u16, AccountId) to (NetUid, AccountId)

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

#NameTypeDescription
1
netuid
NetUid Subnet ID
2
hotkey
AccountId Hot wallet address (hex -> SS58)

Stored Value

Neuron UID on the subnet (0–65535)

Default Value

None (absent keys return no value)

Optional storage: querying a key that has never been written returns no value (None) — do not assume a zero default.

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 Uids storage
const netuid = 1;
const hotkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";

const result = await api.query.SubtensorModule.Uids.getValue(netuid, hotkey);
console.log("Uids:", result);

On-Chain Activity

Write Frequency
●●●●●○ High 1M–10M est. writes

1M to 10M writes

#128 most written storage item

Write Source Calls + Hooks

Modified by both user extrinsics and runtime hooks

As of block 9,385,000

Version History

v101 block 1 Added
v425–v431 · runtime versions skipped on chain (never deployed)
v432 block 8,636,190 Shape changed Current
  • key : (u16, AccountId) → (NetUid, AccountId)

Runtime Info

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