BasketClaimed

Storage Map v441 → current

Double map (validator_hotkey, staker_coldkey) to the claimed watermark used to net off entitlement.

Explore chain
Queried by: stakersanalyticsdevelopers

The Big Picture

The watermark is what makes entitlement survive stake changes. Rebasing it on every add and remove means moving root stake neither grants nor destroys accrued yield.

Why This Matters

This is the bookkeeping that stops you being paid twice, and equally stops you losing yield just because you added stake.

Example Scenario

You are owed 12 units and claim. The watermark advances so the same 12 cannot be claimed again. Later you add root stake, and the watermark is rebased by rate * delta so the addition does not retroactively hand you yield you never accrued.

Common Questions

Why is my watermark negative?
A direct stake_into_basket deposit credits shares by decrementing it. A persistent negative value is an intentional unconditional grant, not a bug.
Is this the same as the BasketClaimed event?
No. They share a name but this is the running watermark; the event reports a realized per-validator payout.

Use Cases

  • Compute exact net owed for a coldkey on a validator
  • Audit that a claim advanced the watermark correctly

From Chain Metadata

DMAP ( validator_hotkey, staker_coldkey ) --> fund shares already claimed (watermark). Signed on purpose, for two reasons. First, stake-change rebasing (`claimed ± rate * delta`) must be exact in both directions: with an unsigned floor, unstaking root before claiming would clip the rebase at zero, silently forfeiting the staker's accrued entitlement and permanently stranding the matching shares (and their escrow value) in the fund. Second, this map doubles as the grant ledger for direct deposits: `stake_into_basket` credits its minted shares by *decrementing* the watermark (`owed = rate * root_stake - claimed`), so a persistent negative value is an intentional unconditional share grant, not a rebasing artifact.

Purpose & Usage

Purpose

Subtracted from gross entitlement so owed = BasketRate * root_stake - claimed. Advanced on claim and rebased on stake changes. From v488 owed = BasketRate * root_stake - (claimed + deferred_claimed_correction).

Common Query Patterns

  • Query by (validator hotkey, staker coldkey) when computing net owed

Notes

  • Signed: stake_into_basket credits its minted shares by decrementing the watermark
  • A persistent negative value is an intentional unconditional share grant, not a rebasing artifact
  • Distinct from the BasketClaimed event, which reports a realized per-validator payout
  • From v488 deferred_claimed_correction is the sum, over the entries of DeferredBasketDebts for (hotkey, coldkey) that have a DeferredBasketConversions row for their origin and generation, of ceil(debt amount x shares_per_alpha). get_basket_owed_shares adds it to this watermark without writing it (staking/claim_root.rs L611-L622, staking/deferred_dividends.rs L173-L206 at d967d1358, runtime v490)
  • From v488 settle_deferred_debts writes that correction into this watermark and removes the debt entry. It runs at the start of a claim for the hotkey, of every root stake rebase and of a coldkey swap (deferred_dividends.rs L208-L276, claim_root.rs L695, L1422 and L1480-L1481)

Query Keys

#NameTypeDescription
1
validator_hotkey
AccountId validator_hotkey (AccountId, hashed key component) (hex -> SS58)
2
staker_coldkey
AccountId staker_coldkey (AccountId, hashed key component) (hex -> SS58)

Stored Value

fund (i128)

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.

Relationships

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

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

On-Chain Activity

Write Frequency
●●●●●○ High 1M–10M est. writes

1M to 10M writes

#129 most written storage item

Write Source Calls + Hooks

Modified by both user extrinsics and runtime hooks

As of block 9,385,000

Runtime Info

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