Transactions
trim-subnet
Trim a subnet to at most `max_n` UIDs (subnet owner).
Lowers the subnet's UID capacity and immediately deregisters the
lowest-emission neurons above the new limit — those miners lose their
slots and would have to re-register (paying the burn cost) to return.
max_n must be between the chain's minimum allowed UIDs (64) and the
subnet's current max_allowed_uids. Owner-immune and temporally
immune UIDs are skipped, and the call fails if immune UIDs would exceed
80% of max_n. Surviving UIDs are renumbered consecutively from
zero, so UID values change. Rate-limited to once per 216,000 blocks
(30 days) and blocked during the end-of-epoch admin freeze window.
Owner-only and disruptive to affected participants, so announce it
before shrinking a live subnet. To simply cap future growth without
evicting anyone, set the max_allowed_uids hyperparameter to a value
at or above the current UID count instead.
| Signer | Pallet | Wraps |
|---|---|---|
coldkey | AdminUtils | AdminUtils.sudo_trim_to_max_allowed_uids |
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
netuid | integer | yes | Subnet to trim; the signer must be its owner. |
max_n | integer | yes | New maximum number of UIDs; lowest-emission neurons above this are removed. |
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 trim-subnet \
--netuid <int> \
--max-n <int> --dry-run
btcli tx trim-subnet \
--netuid <int> \
--max-n <int> -w my_coldkeyPython
import bittensor as sub
from bittensor.wallet import Wallet
wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = sub.TrimSubnet(netuid=1, max_n=0)
async with sub.Client("finney") as client:
plan = await client.plan(intent, wallet) # fee, effects, policy — no submission
result = await client.execute(intent, wallet)
if not result.success:
print(result.error.code, result.error.remediation)Or build it by op name, as an agent would:
await client.execute_tool("trim_subnet", {...}, wallet)