swap_stake
Call v233 → current #87Swaps stake between subnets for the same coldkey -hotkey pair.
View calls on chainCall Workflow
Click items to navigate. Pan and zoom to explore.
The Big Picture
Your stake is spread across subnets, each with its own Alpha token. swap_stake lets you rebalance between subnets while keeping the same validator (hotkey). Unlike move_stake which changes validators, this changes subnets. Think of it as choosing which markets your validator operates in.
Why This Matters
Subnet performance varies. Last month's top subnet might be this month's laggard. swap_stake lets you chase better returns without abandoning your trusted validator.
Example Scenario
You have 100 TAO staked to ValidatorX on subnet 1, but subnet 3 has better emissions. ValidatorX is registered on both. Call swap_stake(hotkey=ValidatorX, origin_netuid=1, dest_netuid=3, amount=50). Half your stake moves to subnet 3, still with ValidatorX.
Common Questions
- How is this different from move_stake?
- move_stake changes the hotkey (validator), swap_stake changes the subnet. Use swap_stake when you trust your validator but want different subnet exposure.
- Is there slippage when swapping between subnets?
- Yes - you're exchanging one subnet's Alpha for another's. The exchange rate depends on each subnet's Alpha pool. Use swap_stake_limit for slippage protection.
Use Cases
- Move stake to a better-performing subnet
- Rebalance exposure across subnets
- Follow validator to new subnet without changing delegation
- Respond to emission changes by shifting subnet allocation
From Chain Metadata
Swaps a specified amount of stake from one subnet to another, while keeping the same coldkey and hotkey.
Input Parameters
Permissions
Permission data inferred from metadata. May be incomplete.
Requirements
- Coldkey-hotkey has stake on origin subnet
- Hotkey is registered on destination subnet
- Both subnets exist
Effects
Events Emitted
Storage Modified
Postconditions
- Stake moved from origin to destination subnet
- Same coldkey-hotkey ownership preserved
Side Effects
- Alpha exchanged between subnet pools
Possible Errors
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 swap_stake call
const hotkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const origin_netuid = 1;
const destination_netuid = 1;
const alpha_amount = 1_000_000_000n;
const call = api.tx[stringCamelCase("SubtensorModule")][stringCamelCase("swap_stake")](
hotkey,
origin_netuid,
destination_netuid,
alpha_amount
);On-Chain Activity
Occasional use
#43 most used call
50–80% of submissions succeed
As of block 7,429,232
Runtime Info
View Source- Pallet Index
- 7
- Call Index
- 87
- First Version
- v233
- Current Version
- v393