This storage item was removed in v473

This storage item is no longer available in the current runtime. Existed from v233 to v472. Shown here for historical reference.

TotalHotkeyShares

Storage Removed Map Poll per tempo v233 → v490 · 1 shape change

Legacy total shares per (hotkey , netuid ), stored as FixedU128 { bits }. Superseded by TotalHotkeySharesV2 at v401 and removed from metadata at v473.

Queried by: validatorsdelegatorsstakersanalytics

The Big Picture

Shares are the internal accounting unit for tracking proportional ownership. When you stake, you receive shares proportional to your contribution. TotalHotkeyShares is the sum of all shares - divide your shares by this to get your ownership percentage.

Why This Matters

What's your share of this validator? (Your shares / TotalHotkeyShares) = your percentage. This determines your cut of any emissions the validator earns.

Example Scenario

Query TotalHotkeyShares(hotkey=validator_X) returns 10000000000. You have 1000000000 shares. Your ownership = 1B / 10B = 10%. You receive 10% of emissions after validator take.

Common Questions

How are shares different from alpha?
Shares track proportional ownership. Alpha is the stake itself. Share prices can vary - early stakers might get more shares per alpha if the pool has grown.
Can I have a large share of a small validator?
Yes. A small validator has fewer TotalHotkeyShares, so the same stake gives you a larger percentage. Higher risk (validator may underperform) but potentially higher share of earnings.

Use Cases

  • Calculate your percentage ownership of a validator
  • Track share dilution as new delegators join
  • Build share-based emission calculators
  • Analyze stake distribution fairness
  • Research delegator dynamics

From Chain Metadata

DMAP ( hot, netuid ) --> total_alpha_shares | Returns the number of alpha shares for a hotkey on a subnet.

Purpose & Usage

Purpose

Tracked proportional ownership for rewards, the denominator for share-based calculations. From v401 through v472 this map and TotalHotkeySharesV2 held disjoint key sets, so a pool read for a block in that range must check both. From v473 every pool denominator is in TotalHotkeySharesV2.

Common Query Patterns

  • Historical blocks v401-v472: query by (hotkey, netuid) and read TotalHotkeySharesV2 as well, since a live pool is in exactly one of them or in neither
  • Historical blocks before v401: this map is the only pool-denominator map
  • v473 onward: read TotalHotkeySharesV2; this map is empty and absent from metadata

Notes

  • v473 retired this map (migrations/migrate_alpha_v2.rs at f87cada631f). The on_idle migration moved each denominator into TotalHotkeySharesV2 alongside its rows, then drained any leftover legacy denominators in a second phase.
  • From v401 through v472 the map was remove-only: no code path inserted into it, so its population only shrank and a row was always an untouched pre-v401 pool, never a tombstone. The move to V2 happened lazily on the next write until the v473 migration.
  • At v488 get_denominator still tries this retired prefix before TotalHotkeySharesV2 and set_denominator removes the legacy row (staking/stake_utils.rs L2209-L2210 and L2265-L2267 at b6a81d144, runtime v488). From v490 both run only when the pallet Config item LegacyAlphaCompatibility is true, and the runtime sets it to ConstBool<false> (macros/config.rs L81-L85, staking/stake_utils.rs L2291-L2297 and L2340-L2344, runtime/src/lib.rs L1160 at d967d1358, runtime v490), so the accessors read TotalHotkeySharesV2 only.
  • A zero value is REMOVED, not stored. set_share writes AlphaV2 only when the share is nonzero and set_denominator writes TotalHotkeySharesV2 only when the denominator is nonzero, each removing the legacy row first, so a drained position or a closed pool is absent from BOTH generations. Absent from both is a normal state, not a gap (staking/stake_utils.rs set_share and set_denominator at v468).
  • All four share maps are ValueQuery, so a point read of a key that does not exist returns the zero fallback rather than an absence. Absence and a stored zero are indistinguishable to a point read; use an existence check or key enumeration to tell them apart.

Migration Notes

v424 v432 Breaking

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

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
hotkey hotkey
raw: hot
AccountId hot (AccountId, hashed key component) (hex -> SS58)
2
netuid netuid
NetUid netuid (NetUid, hashed key component)

Stored Value

total_alpha_shares (FixedU128)

Default Value

0 0x00000000000000000000000000000000

Absent keys read as this value — querying a key that has never been written returns this default, not an error or empty result.

Decoding the value

FixedU128

Raw bits represent a Q64.64 fixed-point. Divide by 2^64 for the actual rational. Magnitude check: `bits > 0` tells you the entry is non-zero.

value as bigint // PAPI decodes FixedU128 as bigint of raw bits

Relationships

Related Storages

  • TotalHotkeySharesV2 Superseded by Coexists with check both decodes differently V2 introduced at runtime v401 with SafeFloat (mantissa+exponent) value type. V2 holds entries for active stakers (all non-zero); legacy holds the historical population (most zero). Key sets verified DISJOINT at v411 (0 / 0 intersection across 115,186 legacy + 17,239 V2 entries). Legacy uses FixedU128 with { bits: u128 }; V2 uses SafeFloat with { mantissa: bigint, exponent: i64 }. An indexer that reads .bits uniformly silently gets zero from V2 entries.

Modified By

Related Events

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

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

Version History

v233 block 4,920,350 Added
v425–v431 · runtime versions skipped on chain (never deployed)
v432 block 8,636,190 Shape changed
  • key : (AccountId, u16) → (AccountId, NetUid)
v473 Removed

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Map
First Version
v233
Removed In
v473
Population
sparse-by-value (~115,186 entries)