ColdkeySwapped

Event Re-added v156 → v161, v162 → v165, v195 → v219, v233 → v247, v252 → v265, v273 → v277, v290 → v315, v320 → v326, v334 → v367, v372 → v377, v385 → current #69

Emitted when a coldkey swap completes, transferring all assets to the new coldkey .

View events on chain
Useful for: stakersvalidatorswalletsexchanges

The Big Picture

Key security is critical in crypto. Coldkey swap lets you migrate your entire Bittensor identity - all stake, all hotkeys, all subnet ownership - to a new coldkey. This is essential for key rotation, hardware wallet upgrades, or recovery from potential compromise. The arbitration period protects against unauthorized swaps.

Why This Matters

This is the final confirmation that your coldkey migration is complete. Everything you own on Bittensor - stake, hotkeys, validator status, subnet ownership - now belongs to your new coldkey. Your old coldkey has no more control.

Example Scenario

You're upgrading from a software wallet to a hardware wallet. You schedule the swap from old_coldkey to new_coldkey. After the 3-day arbitration period (during which you could cancel if compromised), ColdkeySwapped fires. Your 50,000 TAO stake, 3 hotkeys, and subnet ownership are now controlled by your hardware wallet.

Common Questions

Can I reverse a coldkey swap?
No, once ColdkeySwapped fires, it's permanent. That's why there's an arbitration period before execution - to give you time to cancel if something's wrong.
What if someone maliciously schedules a swap?
You have the entire arbitration period to notice and dispute. Monitor your coldkey for ColdkeySwapScheduled events and dispute immediately if unauthorized.

Use Cases

  • Confirm your key migration completed successfully
  • Track key rotations for security monitoring
  • Update records when users migrate wallets
  • Detect potential account compromises

How to Use This Event

  • Subscribe to your own coldkey for migration confirmation
  • Monitor high-value accounts for unexpected swaps
  • Track swap patterns for security analysis

From Chain Metadata

A coldkey has been swapped.

Part of: Coldkey Swap

Triggers

Emitted by

Preconditions

  • Swap was previously scheduled
  • Arbitration period has passed
  • No disputes or all disputes resolved

Effects

Postconditions

  • All stake ownership transferred to new coldkey
  • All hotkey associations updated
  • Old coldkey no longer controls any stake

Side Effects

  • Updates OwnedHotkeys for both coldkeys
  • Updates StakingHotkeys for both coldkeys
  • Transfers any free balance

Event Data

#NameTypeDescription
0
old_coldkey
AccountId old_coldkey (AccountId) (hex -> SS58)
1
new_coldkey
AccountId new_coldkey (AccountId) (hex -> SS58)

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Subscribe to ColdkeySwapped events
api.query.system.events((events) => {
  events
    .filter(({ event }) =>
      event.section === stringCamelCase("SubtensorModule") &&
      event.method === "ColdkeySwapped"
    )
    .forEach(({ event }) => {
      console.log("ColdkeySwapped:", event.data.toHuman());
    });
});

Version History

v156 block 3,321,841 2 args
v162 block 3,372,565 2 args
v195 block 3,791,350 2 args
v233 block 4,920,350 3 args
v252 block 5,163,656 3 args
v273 block 5,659,032 3 args
v290 block 5,947,548 3 args
v320 block 6,523,566 3 args
v334 block 6,811,690 3 args
v372 block 7,430,358 3 args
v385 block 7,782,670 2 args Current

Runtime Info

View Source
Pallet Index
7
Event Index
69
First Version
v156
Current Version
v393