Transactions
set-mechanism-count
Set the number of mechanisms on a subnet.
Mechanisms are independent incentive sub-markets within one subnet, each running its own weights and consensus; this owner-only call sets how many the subnet runs. The count must be greater than zero, and the chain caps how many mechanisms a subnet may have. Increasing the count opens new mechanisms; decreasing it removes the highest-numbered ones and the miner state in them. Any change to the count clears the emission split back to an even division. Rate-limited and blocked during the end-of-epoch admin freeze window.
| Signer | Origin | Pallet | Wraps |
|---|---|---|---|
coldkey | subnet owner | AdminUtils | AdminUtils.sudo_set_mechanism_count |
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
netuid | integer | yes | Subnet to configure; the signer must be its owner. |
mechanism_count | integer | yes | Number of mechanisms the subnet should run. |
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-mechanism-count \
--netuid <int> \
--mechanism-count <int> --dry-run
btcli tx set-mechanism-count \
--netuid <int> \
--mechanism-count <int> -w my_coldkeyPython
import bittensor as bt
from bittensor.wallet import Wallet
wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.SetMechanismCount(netuid=1, mechanism_count=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("set_mechanism_count", {...}, wallet)On-chain implementation
AdminUtils.sudo_set_mechanism_count — pallets/admin-utils/src/lib.rs#L1873:
#[pallet::call_index(76)]
#[pallet::weight(<T as Config>::WeightInfo::sudo_set_mechanism_count())]
pub fn sudo_set_mechanism_count(
origin: OriginFor<T>,
netuid: NetUid,
mechanism_count: MechId,
) -> DispatchResult {
let maybe_owner = pallet_subtensor::Pallet::<T>::ensure_sn_owner_or_root_with_limits(
origin,
netuid,
&[TransactionType::MechanismCountUpdate],
)?;
pallet_subtensor::Pallet::<T>::ensure_admin_window_open(netuid)?;
pallet_subtensor::Pallet::<T>::do_set_mechanism_count(netuid, mechanism_count)?;
pallet_subtensor::Pallet::<T>::record_owner_rl(
maybe_owner,
netuid,
&[TransactionType::MechanismCountUpdate],
);
Ok(())
}Every file is browsable under /code exactly as built into the runtime, or as plain text under /code/raw/<path> (index: /code/index.json).