Transactions

terminate-lease

Terminate an ended lease and take subnet ownership (beneficiary only).

View as Markdown

Ends the lease and transfers full subnet ownership to the beneficiary: contributor dividends stop and the subnet becomes an ordinary owned subnet. Only the lease's beneficiary can call it, and only after the lease's end block has passed — earlier attempts fail, and perpetual leases (no end block) can never be terminated this way. Check the lease's end block with the lease read before calling.

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

Parameters

ParameterTypeRequiredDescription
lease_idintegeryesLease to terminate (see the leases read).
hotkey_ss58stringnoBeneficiary hotkey recorded as the subnet's owner hotkey; defaults to the wallet's hotkey.

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 terminate-lease \
  --lease-id <int> --dry-run
btcli tx terminate-lease \
  --lease-id <int> -w my_coldkey

Python

import bittensor as bt
from bittensor.wallet import Wallet

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.TerminateLease(lease_id=0)

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("terminate_lease", {...}, wallet)

On-chain implementation

SubtensorModule.terminate_leasepallets/subtensor/src/macros/dispatches.rs#L1696:

#[pallet::call_index(111)]
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::terminate_lease(T::MaxContributors::get()))]
pub fn terminate_lease(
    origin: OriginFor<T>,
    lease_id: LeaseId,
    hotkey: T::AccountId,
) -> DispatchResultWithPostInfo {
    Self::do_terminate_lease(origin, lease_id, hotkey)
}

Delegates to do_terminate_lease.

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