# set-subnet-emission-weights (/docs/tx/set-subnet-emission-weights)

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.

| Signer    | Origin       | Pallet     | Wraps                                                                                                |
| --------- | ------------ | ---------- | ---------------------------------------------------------------------------------------------------- |
| `coldkey` | subnet owner | AdminUtils | [`AdminUtils.sudo_set_subnet_emission_weights_v2`](/code/pallets/admin-utils/src/lib.rs#L3042-L3068) |

## Verify [#verify]

After inclusion, confirm the effect with the
[`subnet-emission-weights`](/docs/query/subnet-emission-weights) read:

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

## Parameters [#parameters]

| Parameter     | Type                                      | Required | Description                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ------------- | ----------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `netuid`      | integer                                   | yes      | Subnet to configure; the signer must be its owner.                                                                                                                                                                                                                                                                                                                                                                                   |
| `slots`       | array of \['integer', 'string']           | yes      | Slots 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.                                                                                                                                                                                                                                                     |
| `values`      | array of \['integer', 'number', 'string'] | yes      | New 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. |
| `renormalize` | boolean                                   | no       | Keep 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).                                                                                                                          |
| `gamma`       | object                                    | no       | Gamma 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 [#cli]

Preview with `--dry-run` (shows fee, effects, and policy result without
submitting), then submit:

```bash
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 [#python]

```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](/docs/concepts/client).) Or build the intent by op name, as
an agent would:

```python
result = sub.execute_tool("set_subnet_emission_weights", {...}, wallet)
```

## On-chain implementation [#on-chain-implementation]

`AdminUtils.sudo_set_subnet_emission_weights_v2` — [`pallets/admin-utils/src/lib.rs#L3048`](/code/pallets/admin-utils/src/lib.rs#L3042-L3068):

```rust
#[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](/code) exactly as built into the runtime, or as plain text under `/code/raw/<path>` (index: [`/code/index.json`](/code/index.json)).
