schedule_swap_coldkey
Call v195 → current #73Schedules a coldkey swap for future execution.
View calls on chainCall Workflow
Click items to navigate. Pan and zoom to explore.
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. After 7 days with no disputes, the swap executes automatically. Your new key controls everything.
Common Questions
- How long is the arbitration period?
- Network-configured, typically 7 days. Long enough to notice and dispute, short enough to not be 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.
Input Parameters
| # | Name | Type | Description |
|---|---|---|---|
| 0 | new_coldkey | AccountId | new_coldkey (AccountId) (hex -> SS58) |
Permissions
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
Storage Modified
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 { 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 });
// Build schedule_swap_coldkey call
const new_coldkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const call = api.tx[stringCamelCase("SubtensorModule")][stringCamelCase("schedule_swap_coldkey")](
new_coldkey
);Runtime Info
View Source- Pallet Index
- 7
- Call Index
- 73
- First Version
- v195
- Current Version
- v393