Transactions

set-subnet-emission-weights

Set a subnet's emission split: its five slots and gamma shares (btcli `subnets emission`).

View as Markdown

Dispatches AdminUtils.sudo_set_subnet_emission_weights_v2 with the whole split, keeping the gamma shares it does not name. The signer must be the subnet's owner coldkey (root may also call it). With renormalize the untouched slots are rescaled so the vector and the subnet's gamma shares still sum to one; without it the merged vector is submitted as given. Root stakers are paid their baseline share of emission (what they earn with the default validator share and the global TaoWeight) off the top of the validator slot every block, whatever the subnet sets — the pre-sign plan shows that share and what alpha validators are left with, and lists every rule the chain would reject (including a validator share at or below the baseline), so a bad vector is caught before signing. Owners may change the vector once per SubnetEmissionWeightsRateLimit blocks per subnet: 360 blocks by default from runtime 494 (one default tempo), where root can change the limit; 50,400 blocks on earlier runtimes.

SignerOriginPalletWraps
coldkeysubnet ownerAdminUtilsAdminUtils.sudo_set_subnet_emission_weights_v2

Verify

After inclusion, confirm the effect with the subnet-emission-weights read:

btcli query subnet-emission-weights --netuid <integer> --json

Parameters

ParameterTypeRequiredDescription
netuidintegeryesSubnet to configure; the signer must be its owner.
slotsarray of ['integer', 'string']yesSlots to set, by name or uid: 0 burn, 1 recycle, 2 owner, 3 validator, 4 miner. Omitted slots keep their current share. Empty, with empty values, to change only gamma shares.
valuesarray of ['integer', 'number', 'string']yesNew share for each slot, pairwise with slots: a 0..1 fraction (0.41), a percentage ("41%"), or raw u64 parts of 2^64-1. Rules: burn + recycle <= 33%; owner <= 33% (>= 18% on lease-created subnets); validator <= 50% and above root's baseline share of emission, which is paid off the top of the validator slot (see btcli subnets emission show); miner >= 33%; all five and the subnet's gamma shares sum to exactly 1.
renormalizebooleannoKeep the named slots as given and rescale the other slots proportionally so the vector and the subnet's gamma shares sum to 1 (the last free slot absorbs rounding). Without it, the update is applied verbatim and must already sum to 1 with them (the miner slot absorbs up to 1,000 parts of rounding).
gammaobjectnoGamma shares to set, as a JSON object mapping target netuid to share ({"3": "5%"}), in the same forms as values. Omitted targets keep their current share; a share of 0 removes one. Rules: at most 16, each <= 10%, to another subnet root whitelisted for gamma emission with gamma enabled; none on a leased subnet. With renormalize the five slots make room.

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-subnet-emission-weights \
  --netuid <int> \
  --slots <a,b,c> \
  --values <a,b,c> --dry-run
btcli tx set-subnet-emission-weights \
  --netuid <int> \
  --slots <a,b,c> \
  --values <a,b,c> -w my_coldkey

Python

import bittensor as bt
from bittensor.wallet import Wallet

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.SetSubnetEmissionWeights(netuid=1, slots=[...], values=[...])

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

On-chain implementation

AdminUtils.sudo_set_subnet_emission_weights_v2 — pallets/admin-utils/src/lib.rs#L3048:

#[pallet::call_index(120)]
#[pallet::weight(<T as Config>::WeightInfo::sudo_set_subnet_emission_weights_v2()
    .saturating_add(T::DbWeight::get().reads_writes(
        u64::from(pallet_subtensor::MAX_EMISSION_SLOTS).saturating_mul(4),
        u64::from(pallet_subtensor::MAX_EMISSION_SLOTS).saturating_mul(2).saturating_add(1),
    )))]
pub fn sudo_set_subnet_emission_weights_v2(
    origin: OriginFor<T>,
    netuid: NetUid,
    split: pallet_subtensor::EmissionSplit,
) -> DispatchResult {
    let maybe_owner = pallet_subtensor::Pallet::<T>::ensure_sn_owner_or_root_with_limits(
        origin,
        netuid,
        &[Hyperparameter::EmissionWeights.into()],
    )?;
    pallet_subtensor::Pallet::<T>::ensure_admin_window_open(netuid)?;

    pallet_subtensor::Pallet::<T>::do_set_subnet_emission_weights_v2(netuid, split)?;

    pallet_subtensor::Pallet::<T>::record_owner_rl(
        maybe_owner,
        netuid,
        &[Hyperparameter::EmissionWeights.into()],
    );
    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).