lock_stake

Call v411 → current New #136

Locks alpha stake on a hotkey /subnet to build conviction . Locks decay over time unless set perpetual.

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: stakersdelegatorsvalidatorssubnet owners

The Big Picture

Locking is the conviction mechanism: stake committed for time accrues weight that feeds subnet owner-cut allocation and protects subnet ownership from short-term flow. The longer alpha stays locked, the more it counts. It's the opposite of liquid stake.

Why This Matters

Subnet ownership and owner-cut share depend on conviction, not just current stake. Locking is how you commit to a subnet position over time and get rewarded for that commitment.

Example Scenario

You hold 1000 alpha on subnet 7 and believe in it for the long term. You call lock_stake(hotkey=YourValidator, netuid=7, amount=1000). The alpha is now locked and begins building conviction. You cannot unstake it until it decays, but you accrue standing toward subnet 7 owner-cut allocation.

Common Questions

Can I add to an existing lock?
Yes. Calling lock_stake again on the same (coldkey, subnet) tops up the existing lock. The lock is rolled forward to the current block first, then the new amount is added.
What happens if I try to lock to a different hotkey?
It fails. One coldkey can only hold one lock per subnet, and it must stay on the original hotkey. Use move_lock to switch hotkeys.

Use Cases

  • Build long-term conviction on a subnet to qualify for owner-cut share
  • Top up an existing lock without resetting its decay clock
  • Signal long-term alignment with a validator on a specific subnet

From Chain Metadata

Locks stake on a subnet to a specific hotkey, building conviction over time. If no lock exists for (coldkey, subnet), a new one is created. If a lock exists, the destination hotkey must match the existing lock's hotkey. Top-up adds to the locked amount after rolling the lock state forward.

Part of: Lock & Conviction

Input Parameters

#NameTypeDescription
0
hotkey
AccountId Hotkey to lock stake against (must match an existing lock if one exists) (hex -> SS58)
1
netuid
u16 NetUidSubnet to lock on
2
amount
→ alpha_amount
u64 AlphaBalanceAlpha amount to lock (in alpha-RAO; tops up if a lock already exists) (RAO -> TAO (/ 10^9))

Permissions

Origin
Signed
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Coldkey signs the call
  • Hotkey is registered on the root network
  • Coldkey-hotkey association passes NonAssociatedColdKey check
  • If a lock already exists for (coldkey, subnet), the destination hotkey matches

Effects

Events Emitted

Postconditions

  • A new lock is created or an existing one is topped up
  • Existing lock is rolled forward to current block before top-up
  • StakeLocked event emitted

Side Effects

  • Locked alpha cannot be unstaked until the lock decays or is moved
  • Builds conviction weight toward owner-cut allocation on the subnet
  • Updates Lock, HotkeyLock, and (when owner) OwnerLock storage

Possible Errors

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 lock_stake call (typed, named args)
const hotkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const netuid = 1;
const alpha_amount = 1_000_000_000n;

const tx = api.tx.SubtensorModule.lock_stake({
  hotkey,
  netuid,
  amount: alpha_amount,
});

Runtime Info

View Source
Pallet Index
7
Call Index
136
First Version
v411
Current Version
v411