schedule_swap_coldkey

Call v195 → current #73

Schedules a coldkey swap for future execution.

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: validatorsstakerswalletsdevelopers

The Big Picture

Scheduled swaps add a safety layer through time-delayed execution. After scheduling, there's an arbitration period where the swap is visible on-chain. If someone disputes (e.g., you claim an attacker scheduled it), the swap can be blocked. This protects against compromised keys - attackers can't instantly drain you if you notice in time.

Why This Matters

Unlike immediate swap, schedule_swap_coldkey gives you (or monitors) time to react. If an attacker compromises your key and schedules a swap, you have the arbitration period to notice and dispute. This is the secure choice for planned migrations.

Example Scenario

You're migrating to a new hardware wallet next month. Call schedule_swap_coldkey(new_coldkey). The swap is scheduled with a 7-day arbitration window. You set up monitoring alerts. Once the announcement delay passes with no dispute, the swap executes automatically and your new key controls everything.

Common Questions

How long is the arbitration period?
Read ColdkeySwapAnnouncementDelay for the window in blocks, and ColdkeySwapReannouncementDelay for the shorter window after a re-announcement. Both are governance-set, long enough to notice and dispute without indefinitely blocking legitimate migrations.
How do I dispute a scheduled swap?
If you see a swap you didn't authorize, submit a dispute transaction. This freezes the swap for investigation. You'll need to prove ownership through other means.
What happens to the deposit if I cancel?
Typically returned minus a small fee. The deposit discourages spam scheduling. Legitimate users get most of it back.
Can I schedule a swap while one is pending?
No - only one pending swap per coldkey. You must cancel the existing one first. This prevents race conditions and confusion.

Use Cases

  • Planned migration to a new wallet (hardware upgrade, etc.)
  • Secure key rotation with dispute protection
  • Estate planning - scheduled transfer with oversight period
  • Organization key management with review process

From Chain Metadata

Schedules a coldkey swap operation to be executed at a future block. This function allows a user to schedule the swapping of their coldkey to a new one at a specified future block. The swap is not executed immediately but is scheduled to occur at the specified block number.

Part of: Coldkey Swap

Input Parameters

#NameTypeDescription
0
new_coldkey
AccountId new_coldkey: Account address (32 bytes, SS58-encoded) (hex -> SS58)

Permissions

Origin
Signed
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Caller is current coldkey owner
  • No pending swap already scheduled
  • Required deposit paid

Effects

Events Emitted

Postconditions

  • Swap scheduled for future execution
  • Arbitration period begins
  • Swap visible on-chain for monitoring

Side Effects

  • Others can dispute during arbitration period
  • Swap executes automatically after period ends

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

// Build schedule_swap_coldkey call (typed, named args)
const new_coldkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";

const tx = api.tx.SubtensorModule.schedule_swap_coldkey({
  new_coldkey,
});

Runtime Info

View Source
Pallet Index
7
Call Index
73
First Version
v195
Current Version
v472