Transactions

set-perpetual-lock

Enable or disable perpetual lock mode for a coldkey on a subnet.

View as Markdown

Switches how the signing coldkey's stake lock on the subnet behaves over time: perpetual mode keeps the lock (and its conviction) in force indefinitely, while decaying mode lets it wind down over time so the stake eventually becomes liquid again. A per-coldkey, per-subnet setting that moves no funds by itself — it changes the behavior of locks created with lock_stake. Enabling perpetual mode means the locked stake stays illiquid until you switch back to decaying and the lock runs off.

SignerOriginPalletWraps
coldkeysigned account (pallet role may apply)SubtensorModuleSubtensorModule.set_perpetual_lock

Parameters

ParameterTypeRequiredDescription
netuidintegeryesSubnet whose lock mode is changed.
enabledbooleanyesTrue for perpetual mode (lock never decays), false for decaying mode.

Address parameters (--hotkey, --coldkey, --dest, ...) accept a raw ss58 address, an address-book or proxy-book name, or a local wallet/hotkey name.

CLI

Preview with --dry-run (shows fee, effects, and policy result without submitting), then submit:

btcli tx set-perpetual-lock \
  --netuid <int> \
  --enabled/--no-enabled --dry-run
btcli tx set-perpetual-lock \
  --netuid <int> \
  --enabled/--no-enabled -w my_coldkey

Python

import bittensor as bt
from bittensor.wallet import Wallet

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.SetPerpetualLock(netuid=1, enabled=True)

sub = bt.Subtensor()
plan = sub.plan(intent, wallet)   # fee, effects, policy — no submission
result = sub.execute(intent, wallet)
if not result.success:
    print(result.error.code, result.error.remediation)

(bt.Subtensor is also the async client — async with bt.Subtensor() as client: — see The client.) Or build the intent by op name, as an agent would:

result = sub.execute_tool("set_perpetual_lock", {...}, wallet)

On-chain implementation

SubtensorModule.set_perpetual_lockpallets/subtensor/src/macros/dispatches.rs#L2298:

#[pallet::call_index(138)]
#[pallet::weight(<T as Config>::WeightInfo::set_perpetual_lock())]
pub fn set_perpetual_lock(
    origin: OriginFor<T>,
    netuid: NetUid,
    enabled: bool,
) -> DispatchResult {
    let coldkey = ensure_signed(origin)?;
    Self::do_set_perpetual_lock(&coldkey, netuid, enabled)
}

Delegates to do_set_perpetual_lock.

Every file is browsable under /code exactly as built into the runtime, or as plain text under /code/raw/<path> (index: /code/index.json).