move_stake_limit

Call v448 → current #149

Moves stake from one hotkey to another and, when the subnets differ, protects the move with a relative price limit.

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: stakersdelegatorsvalidatorswallets

The Big Picture

move_stake changes which hotkey holds the stake and can also change subnet, and a cross-subnet move converts alpha through the pools at whatever rate prevails. For a large position that rate can move against you between signing and execution. This variant states the worst ratio you will accept, so an unfavourable move fails instead of completing at a bad price.

Why This Matters

It is the price-protected form of move_stake. Without a limit, a cross-subnet move executes at whatever the pools give you at that block.

Example Scenario

You hold 1,000 alpha on validator A on subnet 1 and want it on validator B on subnet 3, accepting no worse than 0.98 destination alpha per origin alpha. Call move_stake_limit with that limit_price and allow_partial false. At a ratio of 0.99 the move completes; at 0.95 it fails and your position stays where it was.

Common Questions

How is limit_price scaled?
It is the minimum acceptable destination-alpha per origin-alpha ratio, scaled by 1e9. A ratio of 0.98 is 980,000,000.
Does the limit apply when both subnets are the same?
The price protection is there for the cross-subnet case, where alpha is exchanged. Moving between hotkeys inside one subnet does not convert through the pools.
How does this differ from swap_stake_limit?
swap_stake_limit moves one hotkey position between subnets. move_stake_limit changes the hotkey as well, taking both an origin and a destination hotkey.

Use Cases

  • Change validator and subnet in one call without accepting an unbounded exchange rate
  • Move a large position between subnets with a floor on the ratio received
  • Rebalance across both hotkey and subnet in a single extrinsic
  • Automate delegation changes with slippage protection

From Chain Metadata

Moves stake from one hotkey to another and, when the subnets differ, protects the swap with a relative price limit. `limit_price` is the minimum acceptable destination-alpha per origin-alpha ratio, scaled by 1e9. When `allow_partial` is false the call is fill-or-kill; otherwise it moves only the amount executable before the limit is crossed.

Input Parameters

#NameTypeDescription
0
origin_hotkey
AccountId origin_hotkey: Account address (32 bytes, SS58-encoded) (hex -> SS58)
1
destination_hotkey
AccountId destination_hotkey: Account address (32 bytes, SS58-encoded) (hex -> SS58)
2
origin_netuid
NetUid origin_netuid: Subnet ID (u16, 0-65535)
3
destination_netuid
NetUid destination_netuid: Subnet ID (u16, 0-65535)
4
alpha_amount
AlphaBalance alpha_amount: Alpha amount in alpha-RAO (÷10⁹ for alpha)
5
limit_price
TaoBalance limit_price: TAO amount in RAO (÷10⁹ for TAO)
6
allow_partial
bool allow_partial (bool)

Permissions

Origin
Unknown
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Coldkey holds at least alpha_amount of stake on the origin hotkey and origin subnet
  • Both subnets exist and both hotkeys are registered where required
  • The destination-alpha per origin-alpha ratio is at or above limit_price, unless allow_partial is true

Effects

Postconditions

  • Stake sits on the destination hotkey and destination subnet
  • The executed ratio was no worse than limit_price
  • With allow_partial false, either the whole amount moved or nothing did

Side Effects

  • With allow_partial true, only the amount executable before the limit is crossed moves, and the remainder stays put
  • When the subnets differ the move goes through the pools, so it exchanges alpha rather than simply reassigning it

Possible Errors

Code Examples

// ----------------------------------------------------------------------
// HEADS UP: 1 arg below has a complex type with no usable default.
// Look for `undefined as any` and replace it with real value
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
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 move_stake_limit call (typed, named args)
const origin_hotkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const destination_hotkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const origin_netuid = 1;
const destination_netuid = 1;
const alpha_amount = 1_000_000_000n;
const limit_price = undefined as any /* TaoBalance — replace with real value */;
const allow_partial = true;

const tx = api.tx.SubtensorModule.move_stake_limit({
  origin_hotkey,
  destination_hotkey,
  origin_netuid,
  destination_netuid,
  alpha_amount,
  limit_price,
  allow_partial,
});

On-Chain Activity

Usage Frequency
●●○○○○ Low 1K–10K extrinsics

Infrequent

#72 most used call

Success Rate Near-certain

Over 95% of submissions succeed

As of block 9,385,000

Runtime Info

View Source
Pallet Index
7
Call Index
149
First Version
v448
Current Version
v490