Transactions
announce-coldkey-swap
Announce (commit to) a coldkey swap; executable after the chain's delay.
Step one of the two-step coldkey migration: publishes only the BlakeTwo256
hash of new_coldkey_ss58 — committing to the new key without revealing
it — and starts the chain's announcement delay. After the delay, run the
swap_coldkey_announced intent to move EVERYTHING this coldkey owns
(balance, stake, subnets) to the new key; check timing with the
coldkey_swap_announcement read. The first announcement charges the
key-swap cost (0.1 TAO, recycled); re-announcing after the chain's
reannouncement delay is free. While an announcement is pending, the chain
blocks every other signed extrinsic from this coldkey — only the
swap-related calls and shielded (encrypted) submission go through — so the
account is operationally locked for the full delay. Before announcing, be
certain you control the new coldkey and have its mnemonic backed up. A
pending announcement can be cancelled with
clear_coldkey_swap_announcement, and the legitimate holder can freeze
an unauthorized one with dispute_coldkey_swap.
| Signer | Origin | Pallet | Wraps |
|---|---|---|---|
coldkey | signed account (pallet role may apply) | SubtensorModule | SubtensorModule.announce_coldkey_swap |
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
new_coldkey_ss58 | string | yes | Coldkey that will take over everything this coldkey owns once the swap executes; only its hash is published now. |
Address parameters (--hotkey, --coldkey, --dest, ...) accept a raw ss58
address, an address-book or proxy-book name, or a local wallet/hotkey name.
CLI
Preview with --dry-run (shows fee, effects, and policy result without
submitting), then submit:
btcli tx announce-coldkey-swap \
--new-coldkey <ss58|name> --dry-run
btcli tx announce-coldkey-swap \
--new-coldkey <ss58|name> -w my_coldkeyPython
import bittensor as bt
from bittensor.wallet import Wallet
wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.AnnounceColdkeySwap(new_coldkey_ss58="5F...")
sub = bt.Subtensor()
plan = sub.plan(intent, wallet) # fee, effects, policy — no submission
result = sub.execute(intent, wallet)
if not result.success:
print(result.error.code, result.error.remediation)(bt.Subtensor is also the async client — async with bt.Subtensor() as client:
— see The client.) Or build the intent by op name, as
an agent would:
result = sub.execute_tool("announce_coldkey_swap", {...}, wallet)On-chain implementation
SubtensorModule.announce_coldkey_swap — pallets/subtensor/src/macros/dispatches.rs#L1987:
#[pallet::call_index(125)]
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::announce_coldkey_swap())]
pub fn announce_coldkey_swap(
origin: OriginFor<T>,
new_coldkey_hash: T::Hash,
) -> DispatchResult {
let who = ensure_signed(origin)?;
let now = <frame_system::Pallet<T>>::block_number();
if let Some((when, _)) = ColdkeySwapAnnouncements::<T>::get(who.clone()) {
let reannouncement_delay = ColdkeySwapReannouncementDelay::<T>::get();
let min_when = when.saturating_add(reannouncement_delay);
ensure!(now >= min_when, Error::<T>::ColdkeySwapReannouncedTooEarly);
} else {
// Only charge the swap cost on the first announcement
let swap_cost = Self::get_key_swap_cost();
Self::charge_swap_cost(&who, swap_cost)?;
}
let delay = ColdkeySwapAnnouncementDelay::<T>::get();
let when = now.saturating_add(delay);
ColdkeySwapAnnouncements::<T>::insert(who.clone(), (when, new_coldkey_hash.clone()));
Self::deposit_event(Event::ColdkeySwapAnnounced {
who,
new_coldkey_hash,
});
Ok(())
}Delegates to get_key_swap_cost, charge_swap_cost.
Every file is browsable under /code exactly as built into the runtime, or as plain text under /code/raw/<path> (index: /code/index.json).