remove_stake_limit

Call v233 → current #89

Removes stake with a price limit for slippage protection.

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: stakersdelegatorswalletsexchanges

The Big Picture

Unstaking converts Alpha back to TAO. The exchange rate can move against you, especially for large unstakes. remove_stake_limit sets a minimum acceptable rate - if you'd get less TAO than your limit implies, the transaction fails. This protects your position's value during volatile periods or when exiting large positions.

Why This Matters

You staked at Alpha=1.0, now you're unstaking. If Alpha dropped to 0.8, you lose 20% of your TAO value. With a limit order, you can refuse to unstake below your target rate - wait for better conditions or accept the current market.

Example Scenario

You have 1000 Alpha staked and want at least 950 TAO (accepting 5% loss). Call remove_stake_limit(hotkey, netuid=3, amount=1000 Alpha, limit_price=0.95, allow_partial=true). If Alpha is 0.96, you get 960 TAO. If Alpha is 0.90, transaction fails - your Alpha stays staked.

Common Questions

What direction is the limit for unstaking?
Minimum. For staking, limit is maximum Alpha price you'll pay. For unstaking, limit is minimum TAO you'll accept per Alpha. Both protect you from bad rates.
Should I always use limit orders?
For small amounts, regular unstaking is fine - slippage is minimal. For large amounts (>1% of subnet liquidity), limits protect against price impact.
What if I need the TAO urgently?
Use regular remove_stake for immediate execution at market rate. Limits are for when you can afford to wait for your target price.

Use Cases

  • Unstake large amounts without excessive slippage
  • Protect against unfavorable Alpha-to-TAO conversion
  • Execute limit orders for unstaking operations
  • Controlled position exits in volatile conditions

From Chain Metadata

Removes stake from a hotkey on a subnet with a price limit. This extrinsic allows to specify the limit price for alpha token at which or better (higher) the staking should execute. In case if slippage occurs and the price shall move beyond the limit price, the staking order may execute only partially or not execute at all.

Input Parameters

#NameTypeDescription
0
hotkey
AccountId Hot wallet address (active operations) (hex -> SS58)
1
netuid
u16 Subnet/network identifier (0-65535)
2
amount_unstaked
u64 amount_unstaked (u64) (RAO -> TAO (/ 10^9))
3
limit_price
u64 limit_price (u64) (RAO -> TAO (/ 10^9))
4
allow_partial
bool allow_partial (bool)

Permissions

Origin
Signed
Required Role
Authorization Checks
  • Coldkey must be associated with the target hotkey

Requirements

  • Coldkey has stake on hotkey
  • Current price meets limit requirement

Effects

Events Emitted

Postconditions

  • Stake removed at price >= limit_price
  • May partially fill if allow_partial is true

Side Effects

  • Fill-or-kill if allow_partial is false

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 remove_stake_limit call
const hotkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const netuid = 1;
const amount_unstaked = 1_000_000_000n;
const limit_price = 0;
const allow_partial = true;

const call = api.tx[stringCamelCase("SubtensorModule")][stringCamelCase("remove_stake_limit")](
  hotkey,
  netuid,
  amount_unstaked,
  limit_price,
  allow_partial
);

On-Chain Activity

Usage Frequency
●●●●●○ Core 1M–10M extrinsics

Primary protocol calls

#17 most used call

Success Rate Reliable

80–95% of submissions succeed

As of block 7,429,232

Runtime Info

View Source
Pallet Index
7
Call Index
89
First Version
v233
Current Version
v393