ColdkeySwapped

Event v156 → v161, v162 → v165, v195 → v219, v233 → v247, v252 → v265, v273 → v277, v290 → v298, v301 → v315, v320 → v326, v334 → v367, v372 → v377, v385 → v402, v411 → current Changed in v411 #70

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

Migration Notes

v219 v233 Breaking

added field swap_cost (u64)

Update decoders: SCALE encoding is positional, so any signature change (added, removed, or type-changed fields, or storage shape changes) shifts byte offsets and existing decoders will misparse this item. Re-derive types from the new metadata.

v377 v385 Breaking

removed field swap_cost (was u64)

Update decoders: SCALE encoding is positional, so any signature change (added, removed, or type-changed fields, or storage shape changes) shifts byte offsets and existing decoders will misparse this item. Re-derive types from the new metadata.

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: Account address (32 bytes, SS58-encoded) (hex -> SS58)
1
new_coldkey
AccountId new_coldkey: Account address (32 bytes, SS58-encoded) (hex -> SS58)

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);

// Subscribe to ColdkeySwapped events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.SubtensorModule.ColdkeySwapped.get(block.hash);
  for (const evt of events) {
    console.log("ColdkeySwapped:", evt.payload);
  }
});

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
v301 block 6,205,194 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
v411 block 8,283,784 2 args Current

Runtime Info

View Source
Pallet Index
7
Event Index
70
First Version
v156
Current Version
v411