Stake Operations
StakingTransfer TAO between coldkeys and hotkeys, converting to/from subnet-specific Alpha tokens.
Staking Flow
Stake Operations
- User submits add_stake, remove_stake, or move_stake call
- Batch operations via add_stake_multiple
Click items to navigate to their reference pages.
The Big Picture
Staking is how you put your TAO to work. When you stake, your TAO enters a subnet's Alpha pool and you receive Alpha tokens representing your share of the pool. These Alpha tokens determine your weight in emission distribution. More Alpha = more earnings.
Why This Matters
Staking is the primary way TAO holders earn yield. Your stake weight determines your share of subnet emissions, and the exchange rate between TAO and Alpha means timing affects returns.
Example Scenario
Alice stakes 100 TAO to hotkey H on subnet 1. The Alpha pool has 1000 TAO and 1500 Alpha, so her 100 TAO converts to ~130 Alpha at the current rate (100 × 1500/1100). She now holds 130 Alpha of ~1630 total, giving her ~8% of the stake weight.
Common Questions
- Is staking the same as buying Alpha?
- Effectively yes — staking deposits TAO into the pool and mints Alpha proportionally. The Alpha represents your pool share.
- Can I lose TAO when unstaking?
- If the Alpha price dropped since you staked (more TAO was unstaked from the pool), you receive less TAO back. The exchange rate is dynamic.
Use Cases
- Earning yield on TAO holdings
- Supporting specific subnets and validators
- Moving stake between hotkeys and subnets
- Managing multi-subnet stake portfolios
Staking is the primary mechanism for network participation. TAO holders stake to hotkeys on specific subnets, which converts their TAO to Alpha tokens in the subnet's pool. This Alpha represents their stake weight for emission distribution. Unstaking converts Alpha back to TAO.
The staking mechanism handles balance transfers, Alpha conversion math, and updates to all stake-tracking storage items. It enforces minimum stake requirements and existential deposit rules.
Miners can configure an AutoStakeDestination per (coldkey, netuid) to redirect incentive emissions to a different hotkey, allowing earned stake to auto-compound to a preferred validator.
Triggers
- User submits add_stake, remove_stake, or move_stake call
- Batch operations via add_stake_multiple
Inputs (5)
| Item | Type | Role |
|---|---|---|
| add_stake SubtensorModule | call | Add stake from coldkey to hotkey |
| remove_stake SubtensorModule | call | Remove stake from hotkey to coldkey |
| move_stake SubtensorModule | call | Move stake between hotkeys |
| Account System | storage | Coldkey free balance |
| AutoStakeDestination SubtensorModule | storage | Per (coldkey, netuid) redirect target for incentive emission auto-staking |
Outputs (6)
| Item | Type | Role |
|---|---|---|
| StakeAdded SubtensorModule | event | Emitted when stake is added |
| StakeRemoved SubtensorModule | event | Emitted when stake is removed |
| Alpha SubtensorModule | storage | Per-hotkey-per-coldkey Alpha share balance |
| TotalStake SubtensorModule | storage | Network-wide total staked TAO |
| TotalHotkeyAlpha SubtensorModule | storage | Total Alpha on a specific hotkey per subnet |
| StakeMoved SubtensorModule | event | Emitted when stake is moved between hotkeys/subnets |
Source Files
pallets/subtensor/src/staking/add_stake.rs pallets/subtensor/src/staking/remove_stake.rs pallets/subtensor/src/staking/move_stake.rs pallets/subtensor/src/coinbase/run_coinbase.rs Formulas
Stake Balance Transfer
TAO is transferred from coldkey free balance to the subnet's Alpha pool. The Alpha received depends on the pool exchange rate.
// Staking: free_balance -= tao_amount alpha_received = swap_tao_for_alpha(tao_amount, pool) stake[hotkey][coldkey] += alpha_received // Unstaking: tao_received = swap_alpha_for_tao(alpha_amount, pool) stake[hotkey][coldkey] -= alpha_amount free_balance += tao_received
Existential Deposit Check
After staking, the coldkey must retain at least the existential deposit (500 RAO) to keep the account alive.
free_balance check uses Substrate Preservation::Preserve flag // Existential deposit (500 RAO) enforced by balance pallet