# total-alpha-staked (/docs/query/total-alpha-staked)

This is the chain-maintained O(1) aggregate: it equals the sum of
`TotalHotkeyAlpha` for the subnet. Use this instead of walking every
position. After the v448 upgrade, the historical total is backfilled over
otherwise-idle blocks. Until the bounded migration finishes, keys ahead of
its cursor are omitted; concurrent stake changes are reconciled by
completion but are not necessarily visible in this aggregate immediately.

**Category:** Staking

## Parameters [#parameters]

| Parameter | Type    | Description      |
| --------- | ------- | ---------------- |
| `netuid`  | integer | Subnet to query. |

## CLI [#cli]

```bash
btcli query total-alpha-staked --netuid <integer> --json
```

## Python [#python]

Namespace method (autocomplete, signature help):

```python
import bittensor as bt

sub = bt.Subtensor()
result = sub.staking.total_alpha_staked(netuid=1)
```

Or dispatch by name, as an agent would:

```python
result = sub.read("total_alpha_staked", netuid=1)
```

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

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

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

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