Keys

Storage Map v101 → current

Hotkey at a specific UID on a subnet .

Explore chain
Queried by: minersvalidatorssubnet ownersdevelopersanalytics

The Big Picture

UIDs are the internal identifiers for neurons on a subnet. Keys maps UID→hotkey, while Uids maps hotkey→UID. Together they let you look up neurons in either direction.

Why This Matters

When you see 'UID 47 on subnet 1', this tells you which hotkey that is. Essential for understanding who's who on a subnet.

Example Scenario

Query Keys(netuid=1, uid=47) returns the hotkey address for UID 47 on subnet 1. Now you know which validator or miner that UID represents.

Common Questions

What if the UID doesn't exist?
Returns a default value (zero address). Check SubnetworkN to see valid UID range.

Use Cases

  • Find which hotkey holds a specific UID
  • List all registered neurons on a subnet
  • Map UIDs to addresses for indexing

Purpose & Usage

Purpose

Reverse lookup from UID to hotkey address.

Common Query Patterns

  • Get hotkey for a UID on a subnet
  • Iterate all registered hotkeys on a subnet
Part of: Neuron RegistrationNeuron Pruning

Query Keys

#NameTypeDescription
1
key1
→ netuid
u16 Subnet ID
2
key2
→ uid
u16 Neuron UID

Stored Value

Hotkey address at this UID

hex -> SS58

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

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

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

On-Chain Activity

Write Frequency
●●●●○○ Medium 100K–1M est. writes

100K–1M estimated writes

#27 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