Transactions

set-mech-weight-delegate

Authorize or revoke one hotkey's weight delegate on one subnet mechanism.

View as Markdown

Signed by the registered validator hotkey. The delegate may submit direct, legacy commit/reveal, or timelocked weight calls for this hotkey and mechanism only, paying normal transaction fees itself. Authorization does not transfer stake or ownership and is independent on every mechanism. Pass delegate=None (or use the CLI's weights delegate revoke) to revoke it. Existing delegated calls remain subject to the validator's registration, permit, stake, rate-limit, and weight rules.

SignerOriginPalletWraps
hotkeysigned account (pallet role may apply)SubtensorModuleSubtensorModule.set_mech_weight_delegate

Verify

After inclusion, confirm the effect with the mech-weight-delegate read:

btcli query mech-weight-delegate --netuid <integer> --mechid <integer> --hotkey <ss58|name> --json

Parameters

ParameterTypeRequiredDescription
netuidintegeryesSubnet containing the validator hotkey.
mechidintegernoMechanism index within the subnet. 0 is the default (and for most subnets the only) mechanism.
delegatestringnoAccount authorized to submit weights for this hotkey; null revokes. The runtime accepts any account, but delegated intents sign with a 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 set-mech-weight-delegate \
  --netuid <int> --dry-run
btcli tx set-mech-weight-delegate \
  --netuid <int> -w my_coldkey

Python

import bittensor as bt
from bittensor.wallet import Wallet

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

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

On-chain implementation

SubtensorModule.set_mech_weight_delegate — pallets/subtensor/src/macros/dispatches.rs#L3281:

#[pallet::call_index(170)]
#[pallet::weight(T::DbWeight::get().reads_writes(5, 2))]
pub fn set_mech_weight_delegate(
    origin: OriginFor<T>,
    netuid: NetUid,
    mecid: MechId,
    delegate: Option<T::AccountId>,
) -> DispatchResult {
    Self::do_set_mech_weight_delegate(origin, netuid, mecid, delegate)
}

Delegates to do_set_mech_weight_delegate.

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