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?
- The query returns a default value (typically 0 or None depending on client). Always 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
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
Query Keys
Stored Value
Neuron UID on the subnet (0-65535)
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 Uids storage
const key1 = 0;
const key2 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const result = await api.query
[stringCamelCase("SubtensorModule")]
[stringCamelCase("Uids")](
key1,
key2
);
console.log("Uids:", result.toHuman());On-Chain Activity
Write Frequency
●●●●○○ Medium 100K–1M est. writes
100K–1M estimated writes
#26 most written storage item
Write Source User Extrinsics
Modified via user-submitted extrinsics
As of block 7,429,232
Runtime Info
View Source- Pallet
- SubtensorModule
- Storage Kind
- Map
- First Version
- v101
- Current Version
- v393