BasketRate

Storage Map v441 → current

Map (validator_hotkey) to the cumulative fund-shares-per-root-stake accumulator.

Explore chain
Queried by: stakersanalyticsdevelopers

The Big Picture

This is the standard accumulator pattern that makes per-staker entitlement computable in O(1) from two reads rather than by replaying every dividend.

Why This Matters

Without an accumulator the chain would have to remember every dividend against every staker. This one number plus your watermark is enough to compute exactly what you are owed.

Example Scenario

BasketRate for a validator is 0.42 and you hold 100 TAO of root stake, so your gross entitlement is 42 units. Subtract your BasketClaimed watermark of 30 and you are owed 12.

Common Questions

Why is it a fixed-point number?
It accumulates shares per unit of root stake across many deposits, so it needs fractional precision to avoid drift.

Use Cases

  • Compute what a coldkey is owed without an indexer
  • Verify a claim payout against the accumulator

From Chain Metadata

MAP ( validator_hotkey ) --> cumulative fund-shares-per-root-stake accumulator. Each dividend deposit increments this by `minted_shares / total_root_stake`. A staker's gross entitlement is `BasketRate * root_stake`; net owed subtracts their [`BasketClaimed`] watermark. Stake additions/removals rebase the watermark by `rate * delta` so changing root stake never retroactively grants or removes accrued claimable.

Purpose & Usage

Purpose

Each dividend deposit increments this by minted_shares / total_root_stake. Gross entitlement is BasketRate * root_stake; net owed subtracts the BasketClaimed watermark.

Common Query Patterns

  • Query by validator hotkey and multiply by a staker root stake to get gross entitlement
  • Subtract BasketClaimed for the (hotkey, coldkey) pair to get net owed

Notes

  • Stake additions and removals rebase the watermark by rate * delta, so changing root stake never retroactively grants or removes accrued claimable

Query Keys

#NameTypeDescription
1
validator_hotkey
AccountId [u8; 32]validator_hotkey (AccountId, hashed key component) (hex -> SS58)

Stored Value

cumulative (FixedI128)

Default Value

0x00000000000000000000000000000000 (raw SCALE bytes)

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

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 BasketRate storage
const validator_hotkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";

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

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Map
First Version
v441
Current Version
v472