SubnetTAO

Storage Map v233 → v490 · 1 shape change

TAO in the subnet liquidity pool.

Explore chain
Queried by: stakersvalidatorsanalyticsdevelopers

The Big Picture

SubnetTAO is the TAO side of the AMM pool. Together with SubnetAlphaIn, it determines the exchange rate for staking and unstaking. More TAO in the pool means alpha is relatively cheaper (you get more alpha per TAO). The constant product (SubnetTAO × SubnetAlphaIn = k) ensures there's always liquidity.

Why This Matters

What's the exchange rate for staking? SubnetTAO is half the equation. TAO/Alpha rate = SubnetAlphaIn / SubnetTAO. This determines how much alpha you receive when you stake.

Example Scenario

Query SubnetTAO(netuid=1) returns 1000000000000000 (1M TAO in RAO). SubnetAlphaIn returns 10T alpha. Rate = 10T / 1M TAO = 10,000 alpha per TAO. Staking 100 TAO gets you ~1M alpha (minus slippage).

Common Questions

Why does this change?
When you stake, you add TAO to the pool (SubnetTAO increases) and receive alpha (SubnetAlphaIn decreases). The opposite happens when unstaking.
What's slippage?
Large trades move the price. If SubnetTAO is 1M and you stake 100K TAO, you're adding 10% to the pool - the rate changes significantly during your trade.
Can the pool run out of TAO?
The AMM curve prevents depletion. As TAO gets scarce, unstaking becomes very unfavorable, naturally discouraging withdrawal.

Use Cases

  • Calculate current TAO/alpha exchange rate
  • Estimate slippage for large stake operations
  • Build AMM pool visualizations and analytics
  • Monitor subnet liquidity depth
  • Track TAO inflows and outflows per subnet

From Chain Metadata

MAP ( netuid ) --> tao_in_subnet | Returns the amount of TAO in the subnet.

Purpose & Usage

Purpose

Track TAO side of subnet AMM - the other half of the constant product formula.

Common Query Patterns

  • Query by netuid for pool state
  • Combine with SubnetAlphaIn to calculate exchange rate
  • Monitor pool depth for slippage estimation
Part of: Block EmissionAlpha Conversion

Migration Notes

v424 v432 Breaking

key type changed from u16 to NetUid; value type changed from u64 to TaoBalance

Update decoders: SCALE encoding is positional, so any signature change (added, removed, or type-changed fields, or storage shape changes) shifts byte offsets and existing decoders will misparse this item. Re-derive types from the new metadata.

Query Keys

#NameTypeDescription
1
netuid
NetUid u16netuid (NetUid, hashed key component)

Stored Value

tao_in_subnet (TaoBalance)

Default Value

0 0x0000000000000000

Absent keys read as this value — querying a key that has never been written returns this default, not an error or empty result.

Relationships

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Query SubnetTAO storage
const netuid = 1;

const result = await api.query.SubtensorModule.SubnetTAO.getValue(netuid);
console.log("SubnetTAO:", result);

On-Chain Activity

Write Frequency
●●●●●● Ultra-High >10M est. writes

More than 10M writes

#10 most written storage item

Write Source Calls + Hooks

Modified by both user extrinsics and runtime hooks

As of block 9,385,000

Version History

v233 block 4,920,350 Added
v425–v431 · runtime versions skipped on chain (never deployed)
v432 block 8,636,190 Shape changed Current
  • key : u16 → NetUid
  • value : u64 → TaoBalance

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Map
First Version
v233
Current Version
v490