Skip to main content
SUBMIT A PRSUBMIT AN ISSUElast edit: Jun 10, 2026

Alpha Precompile

The Alpha precompile exposes the state of every subnet's AMM pool to EVM smart contracts. It is a read-only interface for token prices, pool reserves, swap simulation, and emission rates. Any contract that needs to react to subnet token economics uses this precompile as its data source.

Concepts

Spot price vs. moving price

getAlphaPrice returns the current instantaneous price derived from the pool reserves (TaoIn / AlphaIn). This is the price you would get at this exact block.

getMovingAlphaPrice returns an exponential moving average of the spot price, smoothed over getEMAPriceHalvingBlocks blocks. Use the moving price when you need a tamper-resistant value—it is significantly harder to manipulate through flash transactions than the spot price.

Pool reserves vs. outstanding supply

The pool holds two reserves:

  • TaoInPool — TAO locked in the subnet's AMM pool.
  • AlphaInPool — alpha tokens locked in the AMM pool.

AlphaOutPool (also called AlphaOut) tracks the total alpha outstanding outside the pool — staked by validators, miners, and delegators. AlphaIssuance is the total ever minted.

The ratio AlphaInPool / (AlphaInPool + AlphaOutPool) tells you what fraction of alpha supply is available for immediate trading.

Swap simulation

simSwapTaoForAlpha and simSwapAlphaForTao compute expected output for a given input using the constant-product formula, including fees. Use these before a stake or unstake operation to estimate slippage and decide whether to use a limit-price variant.

Function reference

Prices and pool state

FunctionParametersReturnsDescription
getAlphaPrice(uint16 netuid)netuiduint256 (RAO per alpha)Spot price
getMovingAlphaPrice(uint16 netuid)netuiduint256 (RAO per alpha)EMA price
getTaoInPool(uint16 netuid)netuiduint64TAO reserves in pool
getAlphaInPool(uint16 netuid)netuiduint64Alpha reserves in pool
getAlphaOutPool(uint16 netuid)netuiduint64Alpha outstanding outside pool
getAlphaIssuance(uint16 netuid)netuiduint64Total alpha ever minted
getTaoWeight()uint256Global TAO weight scalar
getSumAlphaPrice()uint256Sum of alpha prices across all subnets
getCKBurn()uint256CK burn rate

Swap simulation

FunctionParametersReturns
simSwapTaoForAlpha(uint16 netuid, uint64 tao)netuid, tao amount in RAOExpected alpha received (uint256)
simSwapAlphaForTao(uint16 netuid, uint64 alpha)netuid, alpha amountExpected TAO received in RAO (uint256)

Emission rates (per block)

FunctionParametersReturnsDescription
getTaoInEmission(uint16 netuid)netuiduint256TAO flowing into the pool per block
getAlphaInEmission(uint16 netuid)netuiduint256Alpha minted into the pool per block
getAlphaOutEmission(uint16 netuid)netuiduint256Alpha emitted outside the pool (to stakers) per block

Subnet metadata

FunctionParametersReturnsDescription
getSubnetMechanism(uint16 netuid)netuiduint16 (0=Stable, 1=Dynamic)AMM mechanism type
getRootNetuid()uint16Root subnet ID (always 0)
getEMAPriceHalvingBlocks(uint16 netuid)netuiduint64Blocks for EMA half-life
getSubnetVolume(uint16 netuid)netuiduint256Recent trading volume