# gamma-spent (/docs/query/gamma-spent)

It only grows, until the subnet is dissolved, which clears it. A service crediting spends
reads it at a finalized block:
`(await client.at(await client.finalized_block())).gamma.gamma_spent(...)`.

**Category:** Gamma

## Parameters [#parameters]

| Parameter             | Type    | Description            |
| --------------------- | ------- | ---------------------- |
| `netuid`              | integer | Subnet of the service. |
| `service_hotkey_ss58` | string  | Hotkey of the service. |
| `hotkey_ss58`         | string  | Hotkey that spent.     |

## CLI [#cli]

```bash
btcli query gamma-spent --netuid <integer> --service-hotkey <ss58|name> --hotkey <ss58|name> --json
```

## Python [#python]

Namespace method (autocomplete, signature help):

```python
import bittensor as bt

sub = bt.Subtensor()
result = sub.gamma.gamma_spent(netuid=1, service_hotkey_ss58="5F...", hotkey_ss58="5F...")
```

Or dispatch by name, as an agent would:

```python
result = sub.read("gamma_spent", netuid=1, service_hotkey_ss58="5F...", hotkey_ss58="5F...")
```

Async is the same surface awaited: `async with bt.Subtensor() as client:`.

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

* Storage [`SubtensorModule.GammaSpent`](/code/pallets/subtensor/src/lib.rs#L4027)

Every file is browsable under [/code](/code) exactly as built into the runtime.
