# set-subnet-gamma-emission-whitelisted (/docs/tx/set-subnet-gamma-emission-whitelisted)

A subnet owner's gamma share may only name a subnet on this whitelist (see
the `set_subnet_emission_weights` intent). Removing a subnet removes every
gamma share to it: each share is added to the paying subnet's miner slot and
its unconverted alpha to that subnet's pending miner emission.

| Signer    | Origin            | Pallet     | Wraps                                                                                                                    |
| --------- | ----------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------ |
| `coldkey` | root (chain sudo) | AdminUtils | [`AdminUtils.sudo_set_subnet_gamma_emission_whitelisted`](/code/pallets/admin-utils/src/lib.rs#L3038-L3062), `Sudo.sudo` |

## Verify [#verify]

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

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

## Parameters [#parameters]

| Parameter     | Type    | Required | Description                                       |
| ------------- | ------- | -------- | ------------------------------------------------- |
| `netuid`      | integer | yes      | Subnet to whitelist or remove from the whitelist. |
| `whitelisted` | boolean | yes      | True to whitelist the subnet, false to remove it. |

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-gamma-emission-whitelisted \
  --netuid <int> \
  --whitelisted/--no-whitelisted --dry-run
btcli tx set-subnet-gamma-emission-whitelisted \
  --netuid <int> \
  --whitelisted/--no-whitelisted -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.SetSubnetGammaEmissionWhitelisted(netuid=1, whitelisted=True)

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

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

`AdminUtils.sudo_set_subnet_gamma_emission_whitelisted` — [`pallets/admin-utils/src/lib.rs#L3041`](/code/pallets/admin-utils/src/lib.rs#L3038-L3062):

```rust
#[pallet::call_index(121)]
#[pallet::weight(<T as Config>::WeightInfo::sudo_set_subnet_gamma_emission_whitelisted()
    .saturating_add(pallet_subtensor::Pallet::<T>::remove_gamma_emission_target_weight()))]
pub fn sudo_set_subnet_gamma_emission_whitelisted(
    origin: OriginFor<T>,
    netuid: NetUid,
    whitelisted: bool,
) -> DispatchResult {
    ensure_root(origin)?;
    ensure!(
        pallet_subtensor::Pallet::<T>::if_subnet_exist(netuid),
        Error::<T>::SubnetDoesNotExist
    );
    ensure!(!netuid.is_root(), Error::<T>::NotPermittedOnRootSubnet);
    if whitelisted {
        pallet_subtensor::SubnetGammaEmissionWhitelisted::<T>::insert(netuid, true);
    } else {
        pallet_subtensor::Pallet::<T>::remove_gamma_emission_target(netuid);
    }
    Self::deposit_event(Event::SubnetGammaEmissionWhitelistedSet {
        netuid,
        whitelisted,
    });
    Ok(())
}
```

`Sudo.sudo` is implemented by Substrate's `pallet_sudo`, outside this repository's pallets.

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)).
