Lock TAO on subnets behind hotkeys to earn emission rewards. Staking converts TAO into subnet-specific alpha tokens via the AMM pool.
Stake TAO on a subnet. Converts TAO → alpha via the subnet's AMM pool.
agcli stake add --amount 10.0 --netuid 1 [--hotkey SS58] [--max-slippage 2.0] [--password PW] [--yes]On-chain: SubtensorModule::add_stake(origin, hotkey, netuid, amount_staked)
- Flow: withdraw TAO from coldkey →
stake_into_subnet()→swap_tao_for_alpha()via AMM → increase alpha shares - Storage:
Alpha(hotkey, coldkey, netuid)shares,TotalHotkeyAlpha,SubnetTAO,SubnetAlphaIn/Out,TotalStake - Events:
StakeAdded(coldkey, hotkey, tao_amount, alpha_amount, netuid, block) - Pre-checks: balance >= amount, spending limit check, slippage simulation
- Errors:
NotEnoughBalanceToStake,HotKeyAccountNotExists,StakingRateLimitExceeded,InsufficientLiquidity
Unstake alpha from a subnet. Converts alpha → TAO via the AMM pool.
agcli stake remove --amount 5.0 --netuid 1 [--hotkey SS58] [--max-slippage 2.0]On-chain: SubtensorModule::remove_stake(origin, hotkey, netuid, amount_unstaked)
- Flow: decrease alpha shares →
unstake_from_subnet()→swap_alpha_for_tao()via AMM → deposit TAO to coldkey - Events:
StakeRemoved(coldkey, hotkey, tao_amount, alpha_amount, netuid, block) - Errors:
NotEnoughStakeToWithdraw,StakingRateLimitExceeded,InsufficientLiquidity
Show all stakes for a coldkey across all subnets.
agcli stake list [--address SS58] [--at-block N]
# JSON output: [{"netuid", "hotkey", "stake_rao", "alpha_raw"}]On-chain: reads StakingHotkeys → per-hotkey Stake entries. No extrinsic.
Move alpha between subnets (same hotkey). Sells alpha on source subnet, buys on destination.
agcli stake move --amount 5.0 --from 1 --to 2 [--hotkey SS58]On-chain: SubtensorModule::move_stake(origin, hotkey, origin_netuid, destination_netuid, alpha_amount)
- Events:
StakeMoved(coldkey, origin_hotkey, origin_netuid, dest_hotkey, dest_netuid, tao_equivalent) - Two AMM operations:
swap_alpha_for_tao()on source,swap_tao_for_alpha()on destination - All move/swap/transfer operations funnel through
transition_stake_internal()
Swap stake between hotkeys on the same subnet.
agcli stake swap --amount 5.0 --netuid 1 --from-hotkey HK1 --to-hotkey HK2On-chain: SubtensorModule::swap_stake(origin, from_hotkey, from_netuid, to_netuid, alpha_amount)
Unstake all alpha from a hotkey across all subnets.
agcli stake unstake-all [--hotkey SS58]Limit orders for staking operations. Execute when AMM price reaches target.
agcli stake add-limit --amount 10.0 --netuid 1 --price 0.5 [--partial] [--hotkey SS58]
agcli stake remove-limit --amount 5.0 --netuid 1 --price 0.8 [--partial] [--hotkey SS58]
agcli stake swap-limit --amount 5.0 --from 1 --to 2 --price 0.5 [--partial] [--hotkey SS58]Set the childkey take percentage for a hotkey on a subnet.
agcli stake childkey-take --take 10.0 --netuid 1 [--hotkey SS58]On-chain: SubtensorModule::set_childkey_take(origin, hotkey, netuid, take) where take is u16 (pct * 65535 / 100)
- Errors:
InvalidChildkeyTake,TxChildkeyTakeRateLimitExceeded
Delegate weight to child hotkeys on a subnet.
agcli stake set-children --netuid 1 --children "0.5:5Child1...,0.3:5Child2..."On-chain: SubtensorModule::set_children(origin, hotkey, netuid, children) → do_schedule_children()
- Children are NOT applied immediately — they go into
PendingChildKeyswith a cooldown period - Events:
SetChildrenScheduled(hotkey, netuid, cooldown_block, children) - Errors:
InvalidChild,DuplicateChild,ProportionOverflow,TooManyChildren(max 5),ChildParentInconsistency(bipartite separation enforced),NotEnoughStakeToSetChildkeys
Remove ALL stake for a hotkey/subnet pair, optionally with a price limit.
agcli stake remove --amount MAX --netuid 1 [--hotkey SS58]On-chain: SubtensorModule::remove_stake_full_limit(origin, hotkey, netuid, limit_price)
- If
limit_priceis set, uses limit order logic; otherwise unstakes everything at market.
Recycle alpha tokens back to TAO (burns alpha, reduces SubnetAlphaOut — increases alpha price).
agcli stake recycle-alpha --amount 100.0 --netuid 1 [--hotkey SS58]Permanently burn alpha tokens. Unlike recycle, does NOT reduce SubnetAlphaOut (pool ratio unchanged).
agcli stake burn-alpha --amount 50.0 --netuid 1 [--hotkey SS58]Unstake all alpha across all subnets for a hotkey.
agcli stake unstake-all-alpha [--hotkey SS58]Claim root network dividends for a specific subnet.
agcli stake claim-root --netuid 1 [--hotkey SS58]On-chain: SubtensorModule::claim_root_dividends(origin, hotkey, netuid)
Batch claim root dividends across multiple subnets.
agcli stake process-claim [--hotkey SS58] [--netuids "1,2,3"]Iterates over all subnets where the hotkey has stake and calls claim_root_dividends for each.
Set automatic staking destination for a subnet.
agcli stake set-auto --netuid 1 [--hotkey SS58]Show auto-stake destinations for a coldkey.
agcli stake show-auto [--address SS58]Set how root emissions are handled (swap to TAO, keep as alpha, or keep for specific subnets).
agcli stake set-claim --claim-type swap|keep|keep-subnets [--subnets "1,2,3"]Transfer stake to a different coldkey owner.
agcli stake transfer-stake --dest 5Dest... --amount 10.0 --from 1 --to 2 [--hotkey SS58]On-chain: SubtensorModule::transfer_stake(origin, destination_coldkey, hotkey, origin_netuid, destination_netuid, alpha_amount)
Interactive or fully-scripted staking wizard.
agcli stake wizard [--netuid 1] [--amount 5.0] [--hotkey SS58] [--password PW] [--yes]--mev— Encrypt staking extrinsic via MEV shield (ML-KEM-768)--dry-run— Show what would be submitted without broadcasting--output json— Machine-readable JSON output--batch/--yes— Non-interactive mode
| Error | Cause | Fix |
|---|---|---|
NotEnoughBalanceToStake |
Coldkey balance < stake amount | Check agcli balance |
StakingRateLimitExceeded |
Too many stake ops in short time | Wait and retry |
NotEnoughStakeToWithdraw |
Unstake amount > staked amount | Check agcli stake list |
HotKeyAccountNotExists |
Hotkey not registered on chain | Register hotkey first |
TooManyChildren |
>5 children set | Reduce child count |
AmountTooLow |
Stake amount below minimum | Increase amount |
agcli handler: src/cli/stake_cmds.rs — handle_stake() at L9, subcommands: Add L100, Remove L140, List L17, Move L165, Swap L188, UnstakeAll L216, AddLimit L233, RemoveLimit L257, SwapLimit L356, ChildkeyTake L278, SetChildren L298, RecycleAlpha L314, BurnAlpha L340, UnstakeAllAlpha L330, ClaimRoot L226, ProcessClaim L480, SetAuto L378, ShowAuto L395, SetClaim L417, TransferStake L457, Wizard L554
Subtensor pallet:
staking/add_stake.rs—add_stakeextrinsic + AMM swapstaking/remove_stake.rs—remove_stake+ unstake flowstaking/move_stake.rs—move_stake,swap_stake,transfer_stakestaking/set_children.rs—set_children,set_childkey_takestaking/recycle_alpha.rs—recycle_alpha, burn operationsstaking/claim_root.rs—claim_root_dividendsstaking/stake_utils.rs— AMM:swap_tao_for_alpha(),swap_alpha_for_tao()macros/dispatches.rs— all dispatch entry pointsmacros/events.rs— event definitionsmacros/errors.rs— error definitions
agcli balance— Check balance before stakingagcli view portfolio— See all stakes and positionsagcli subnet show --netuid N— Check subnet AMM pool depthagcli view swap-sim --netuid N --tao X— Simulate swap before stakingagcli explain --topic stake-weight— Min stake for weight setting