Account

Storage Map v101 → current

Account balance data including free, reserved, and frozen amounts.

Explore chain
Queried by: walletsdevelopersanalyticsstakers

The Big Picture

Every account balance on Subtensor is stored here. Contains free (transferable), reserved (held for specific purposes), and frozen (locked but may overlap) amounts. This is the primary storage for TAO balances.

Use Cases

  • Display account balance in wallet
  • Check available balance before transfer
  • Track reserved balance for staking
  • Monitor frozen amounts from locks

From Chain Metadata

The Balances pallet example of storing the balance of an account. # Example ```nocompile impl pallet_balances::Config for Runtime { type AccountStore = StorageMapShim<Self::Account<Runtime>, frame_system::Provider<Runtime>, AccountId, Self::AccountData<Balance>> } ``` You can also store the balance of an account in the `System` pallet. # Example ```nocompile impl pallet_balances::Config for Runtime { type AccountStore = System } ``` But this comes with tradeoffs, storing account balances in the system pallet stores `frame_system` data alongside the account data contrary to storing account balances in the `Balances` pallet, which uses a `StorageMap` to store balances data only. NOTE: This is only used in the case that this pallet is used to store balances.

Purpose & Usage

Purpose

Core storage for all account token balances on the network.

Common Query Patterns

  • Query by account address
  • Get free balance for transfers
  • Check reserved/frozen amounts

Query Keys

#NameTypeDescription
1
key1
AccountId key1 (AccountId) (hex -> SS58)

Stored Value

value (AccountData)

Relationships

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Query Account storage
const key1 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";

const result = await api.query
  [stringCamelCase("Balances")]
  [stringCamelCase("Account")](
  key1
);

console.log("Account:", result.toHuman());

On-Chain Activity

Write Frequency
●●●●○○ Medium 100K–1M est. writes

100K–1M estimated writes

#25 most written storage item

Write Source Calls + Hooks

Modified by both user extrinsics and runtime hooks

As of block 7,429,232

Runtime Info

Pallet
Balances
Storage Kind
Map
First Version
v101
Current Version
v393