StakeWeight

Storage Map v195 → current

Stake -based weights per UID per subnet .

Explore chain
Queried by: validatorsdevelopersanalytics

The Big Picture

Stake weights are used in Yuma consensus. This storage caches the calculated weights based on stake for each UID on a subnet.

Use Cases

  • View stake weight distribution
  • Debug consensus calculations
  • Build stake analytics

From Chain Metadata

======================================= ==== Subnetwork Consensus Storage ==== =======================================

Purpose & Usage

Purpose

Cache stake weights for consensus calculations.

Common Query Patterns

  • Query by netuid

Query Keys

#NameTypeDescription
1
key1
u16 key1 (u16)

Stored Value

value (Vec<u16>)

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

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

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

Runtime Info

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