ColdkeySwapAnnouncements
Storage Map v385 → currentPending coldkey swap announcements, keyed by the coldkey being replaced.
Explore chainThe Big Picture
This one map drives the whole announce phase: the freeze, the waiting period, the reveal check and the eligibility windows for reannouncing and clearing all read from it.
Why This Matters
Any service acting for a coldkey should read this before dispatching. A non-empty entry means almost every call will be rejected, and the rejection is not transient.
Example Scenario
A customer reports that staking fails with no obvious cause. This map has an entry for their coldkey with an executable block 20000 blocks out, which is the whole explanation.
Common Questions
- Why is only the hash stored and not the destination?
- The destination stays private until the reveal. The stored value is the BlakeTwo256 hash of the new account id, checked against the account passed to swap_coldkey_announced.
Use Cases
- Gate automation on whether an account is frozen
- Show a user when their rotation becomes executable
- Count open rotations across the chain
From Chain Metadata
A map of the coldkey swap announcements from a coldkey to the block number the coldkey swap can be performed.
Purpose & Usage
Purpose
Holds (executableBlock, newColdkeyHash) for each coldkey with an open announcement. Its presence is what freezes the account, and the tuple carries the authoritative block at which the swap may execute.
Common Query Patterns
- Check whether a coldkey is mid-rotation before dispatching on its behalf
- Read the executable block instead of recomputing it from the delay
- Explain a call failing with ColdkeySwapAnnounced
Notes
- First appears at runtime v385.
- Optional. Absent means no pending announcement.
- The entry is consumed by swap_coldkey_announced, so a successful swap leaves nothing behind.
- The stored block is the announcement block plus the delay in force at that moment. A later change to ColdkeySwapAnnouncementDelay does not move an existing announcement.
Query Keys
| # | Name | Type | Description |
|---|---|---|---|
| 1 | coldkey coldkey raw: key1 | AccountId [u8; 32] | Source coldkey AccountId32 — the coldkey that announced the upcoming swap. (hex -> SS58) |
Stored Value
- .0 execution_block — Block number at which the coldkey swap CAN be performed (future block). The storage docstring says "the block number the coldkey swap can be performed." Empirically verified at v411: chain values exceed current block height. Migration site stores (when - delay) but `when` here is computed AHEAD of current execution, so the result is still future-relative.
- .1 destination_coldkey_hash — Hash of the destination (new) coldkey: Hashing::hash_of(&new_coldkey). T::Hash is H256 on subtensor. NOT a call hash — directly hashes the AccountId32.
Default Value
Optional storage: querying a key that has never been written returns no value (None) — do not assume a zero default.
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 ColdkeySwapAnnouncements storage
const key1 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const result = await api.query.SubtensorModule.ColdkeySwapAnnouncements.getValue(key1);
console.log("ColdkeySwapAnnouncements:", result);Runtime Info
View Source- Pallet
- SubtensorModule
- Storage Kind
- Map
- First Version
- v385
- Current Version
- v472