Transactions

spend-gamma

Spend gamma from the deposit at this hotkey, at a service on its subnet.

View as Markdown

Destroys amount_gamma of the deposit and adds it to what the hotkey has spent at the service at service_hotkey_ss58, which credits it. The amount is at least 0.1 gamma unless it empties the deposit, and within its balance and what its daily spend cap allows. Signed by the hotkey, which pays no fee: the chain refuses an invalid spend before it enters a block.

SignerOriginPalletWraps
hotkeysigned account (pallet role may apply)SubtensorModuleSubtensorModule.spend_gamma

Parameters

ParameterTypeRequiredDescription
netuidintegeryesSubnet of the deposit and the service.
service_hotkey_ss58stringyesHotkey of the service spent at.
amount_gammanumberyesGamma spent.

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 spend-gamma \
  --netuid <int> \
  --service-hotkey <ss58|name> \
  --amount-gamma <amount> --dry-run
btcli tx spend-gamma \
  --netuid <int> \
  --service-hotkey <ss58|name> \
  --amount-gamma <amount> -w my_coldkey

Python

import bittensor as bt
from bittensor.wallet import Wallet

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.SpendGamma(netuid=1, service_hotkey_ss58="5F...", amount_gamma=1.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("spend_gamma", {...}, wallet)

On-chain implementation

SubtensorModule.spend_gamma — pallets/subtensor/src/macros/dispatches.rs#L3282:

#[pallet::call_index(168)]
#[pallet::weight((<T as Config>::WeightInfo::spend_gamma(), DispatchClass::Normal, Pays::No))]
pub fn spend_gamma(
    origin: OriginFor<T>,
    service: T::AccountId,
    netuid: NetUid,
    amount: GammaBalance,
) -> DispatchResult {
    Self::do_spend_gamma(origin, service, netuid, amount)
}

Delegates to do_spend_gamma.

Every file is browsable under /code exactly as built into the runtime, or as plain text under /code/raw/<path> (index: /code/index.json).