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 #69Emitted when a coldkey swap completes, transferring all assets to the new coldkey .
View events on chainThe 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.
Triggers
Emitted by
Preconditions
- Swap was previously scheduled
- Arbitration period has passed
- No disputes or all disputes resolved
Effects
Storage Modified
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
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
Runtime Info
View Source- Pallet Index
- 7
- Event Index
- 69
- First Version
- v156
- Current Version
- v393