HotkeySwapBasketCredits

Storage Map v479 → current

Set of (coldkey , hotkey ) root fund associations a single-subnet root hotkey swap left behind, claimable without a StakingHotkeys entry.

Explore chain
Queried by: delegatorsstakersanalyticsdevelopers

The Big Picture

Pairs with HotkeySwapStakeRetained on netuid 0. Source: pallets/subtensor/src/lib.rs HotkeySwapBasketCredits, pallets/subtensor/src/swap/swap_hotkey.rs and pallets/subtensor/src/staking/claim_root.rs at release-479.

Use Cases

  • Find root funds a coldkey can claim that are not in its staking list
  • Reconcile root claims after a validator hotkey swap

From Chain Metadata

Claim-only fund associations created when a root swap leaves a staker's stake behind. These never grow StakingHotkeys or the work of a stake exit. Claims and coldkey swaps bound their selection before admitting work.

Purpose & Usage

Purpose

Keeps a retained staker root basket credit discoverable by claim_root even though the swap did not grow its staking list.

Common Query Patterns

  • Iterate by coldkey to list root funds it can still claim from outside its StakingHotkeys

Notes

  • First appears at runtime v479. Keyed coldkey then hotkey (both Blake2_128Concat), unit value, OptionQuery.
  • Inserted when a root hotkey swap retains a staker and the rebased BasketClaimed for (old_hotkey, coldkey) is negative.
  • Removed when a claim brings BasketClaimed back to zero or above, and when the coldkey stakes to that hotkey voluntarily, which adds it to StakingHotkeys.
  • Moved to the new coldkey by a coldkey swap, and to the new hotkey by a later hotkey swap of the fund unless the coldkey StakingHotkeys already holds it.
  • claim_root reads at most MAX_ROOT_CLAIM_WORK (256) minus the StakingHotkeys length, plus one, entries per coldkey.
  • From v488 a hotkey swap of the fund also inserts the entry for a coldkey whose DeferredBasketCashClaimed watermark under the old hotkey is negative, or whose DeferredBasketDebts row holds a negative amount, when the coldkey StakingHotkeys does not hold the new hotkey (move_deferred_dividends, staking/deferred_dividends.rs L638-L685 at d967d1358, runtime v490).

Query Keys

#NameTypeDescription
1
key1
AccountId key1 (AccountId) (hex -> SS58)
2
key2
AccountId key2 (AccountId) (hex -> SS58)

Stored Value

value (())

Default Value

None (absent keys return no value)

Optional storage: querying a key that has never been written returns no value (None) — do not assume a zero default.

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 HotkeySwapBasketCredits storage
const key1 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const key2 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";

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

On-Chain Activity

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

1M to 10M writes

#105 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
v479
Current Version
v490