StakingColdkeysByIndex

Storage Map v334 → current

Index mapping for iterating staking coldkeys.

Explore chain
Queried by: analyticsdevelopers

The Big Picture

Supporting index for efficient iteration over all coldkeys that have stake. Used internally for enumeration operations and analytics.

Use Cases

  • Enumerate all stakers efficiently
  • Build comprehensive staking analytics
  • Export staker lists

Purpose & Usage

Purpose

Efficient enumeration of all coldkeys with stake.

Common Query Patterns

  • Iterate by index

Query Keys

#NameTypeDescription
1
index
raw: key1
u64 key1 (u64)

Stored Value

value (AccountId)

Decoding the value

AccountId (32-byte hex)

Bittensor uses SS58 prefix 42 for both hotkeys and coldkeys. The 32 bytes are sr25519 public keys.

value as `0x${string}` // 32-byte AccountId

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

const result = await api.query.SubtensorModule.StakingColdkeysByIndex.getValue(key1);
console.log("StakingColdkeysByIndex:", result);

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Map
First Version
v334
Current Version
v411