Balances docs
Look up any call, event, or storage item with code examples. Runtime v472 · Block #9,197,056
Developer documentation for the Balances pallet of the Subtensor blockchain, part of the Bittensor decentralized AI network. This page is designed for developers integrating with the chain: look up any call, event, or storage item, copy code examples in TypeScript, Python, or Rust, and filter by your role. For in-depth explanations, version history, and relationships between items, see the Reference section.
Balances
Transfer some liquid free balance to another account.
Calls 9
Transfers TAO allowing sender account to be reaped.
Parameters
| Name | Type | Format | Description |
|---|---|---|---|
dest | MultiAddress | — | dest: Account address as a lookup source (typically resolves to AccountId) |
value | Compact<TaoBalance> | TaoBalance | value: Balance in chain native currency (RAO for TAO; ÷10⁹) |
// ----------------------------------------------------------------------
// HEADS UP: 2 args below have a complex type with no usable default.
// Look for `undefined as any` and replace them with real values
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
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);
// Build transfer_allow_death call (typed, named args)
const dest = undefined as any /* MultiAddress — replace with real value */;
const value = undefined as any /* TaoBalance — replace with real value */;
const tx = api.tx.Balances.transfer_allow_death({
dest,
value,
});Transfers TAO between accounts (root only, can specify source).
Parameters
| Name | Type | Format | Description |
|---|---|---|---|
source | MultiAddress | — | source: Account address as a lookup source (typically resolves to AccountId) |
dest | MultiAddress | — | dest: Account address as a lookup source (typically resolves to AccountId) |
value | Compact<TaoBalance> | TaoBalance | value: Balance in chain native currency (RAO for TAO; ÷10⁹) |
// ----------------------------------------------------------------------
// HEADS UP: 3 args below have a complex type with no usable default.
// Look for `undefined as any` and replace them with real values
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
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);
// Build force_transfer call (typed, named args)
const source = undefined as any /* MultiAddress — replace with real value */;
const dest = undefined as any /* MultiAddress — replace with real value */;
const value = undefined as any /* TaoBalance — replace with real value */;
const tx = api.tx.Balances.force_transfer({
source,
dest,
value,
});Transfers TAO while ensuring sender account stays alive.
Parameters
| Name | Type | Format | Description |
|---|---|---|---|
dest | MultiAddress | — | dest: Account address as a lookup source (typically resolves to AccountId) |
value | Compact<TaoBalance> | TaoBalance | value: Balance in chain native currency (RAO for TAO; ÷10⁹) |
// ----------------------------------------------------------------------
// HEADS UP: 2 args below have a complex type with no usable default.
// Look for `undefined as any` and replace them with real values
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
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);
// Build transfer_keep_alive call (typed, named args)
const dest = undefined as any /* MultiAddress — replace with real value */;
const value = undefined as any /* TaoBalance — replace with real value */;
const tx = api.tx.Balances.transfer_keep_alive({
dest,
value,
});Transfers entire free balance to recipient.
Parameters
| Name | Type | Format | Description |
|---|---|---|---|
dest | MultiAddress | — | dest: Account address as a lookup source (typically resolves to AccountId) |
keep_alive | bool | Boolean (true/false) | keep_alive (bool) |
// ----------------------------------------------------------------------
// HEADS UP: 1 arg below has a complex type with no usable default.
// Look for `undefined as any` and replace it with real value
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
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);
// Build transfer_all call (typed, named args)
const dest = undefined as any /* MultiAddress — replace with real value */;
const keep_alive = true;
const tx = api.tx.Balances.transfer_all({
dest,
keep_alive,
});Unreserves balance from an account (root only).
Parameters
| Name | Type | Format | Description |
|---|---|---|---|
who | MultiAddress | — | who: Account address as a lookup source (typically resolves to AccountId) |
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
// ----------------------------------------------------------------------
// HEADS UP: 1 arg below has a complex type with no usable default.
// Look for `undefined as any` and replace it with real value
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
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);
// Build force_unreserve call (typed, named args)
const who = undefined as any /* MultiAddress — replace with real value */;
const amount = 1_000_000_000n;
const tx = api.tx.Balances.force_unreserve({
who,
amount,
});Upgrades legacy accounts to the new balance format.
Parameters
| Name | Type | Format | Description |
|---|---|---|---|
who | Vec<AccountId> | Array of SS58 Address | who: list of Account address (32 bytes, SS58-encoded) |
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);
// Build upgrade_accounts call (typed, named args)
const who = [] as [];
const tx = api.tx.Balances.upgrade_accounts({
who,
});Sets an account balance to a specific value (root only).
Parameters
| Name | Type | Format | Description |
|---|---|---|---|
who | MultiAddress | — | who: Account address as a lookup source (typically resolves to AccountId) |
new_free | Compact<TaoBalance> | TaoBalance | new_free: Balance in chain native currency (RAO for TAO; ÷10⁹) |
// ----------------------------------------------------------------------
// HEADS UP: 2 args below have a complex type with no usable default.
// Look for `undefined as any` and replace them with real values
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
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);
// Build force_set_balance call (typed, named args)
const who = undefined as any /* MultiAddress — replace with real value */;
const new_free = undefined as any /* TaoBalance — replace with real value */;
const tx = api.tx.Balances.force_set_balance({
who,
new_free,
});Adjusts TotalIssuance up or down (root only).
Parameters
| Name | Type | Format | Description |
|---|---|---|---|
direction | AdjustmentDirection | — | direction (AdjustmentDirection) |
delta | Compact<TaoBalance> | TaoBalance | delta: Balance in chain native currency (RAO for TAO; ÷10⁹) |
// ----------------------------------------------------------------------
// HEADS UP: 2 args below have a complex type with no usable default.
// Look for `undefined as any` and replace them with real values
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
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);
// Build force_adjust_total_issuance call (typed, named args)
const direction = undefined as any /* AdjustmentDirection — replace with real value */;
const delta = undefined as any /* TaoBalance — replace with real value */;
const tx = api.tx.Balances.force_adjust_total_issuance({
direction,
delta,
});Burns TAO from the caller, permanently reducing total issuance.
Parameters
| Name | Type | Format | Description |
|---|---|---|---|
value | Compact<TaoBalance> | TaoBalance | value: Balance in chain native currency (RAO for TAO; ÷10⁹) |
keep_alive | bool | Boolean (true/false) | keep_alive (bool) |
// ----------------------------------------------------------------------
// HEADS UP: 1 arg below has a complex type with no usable default.
// Look for `undefined as any` and replace it with real value
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
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);
// Build burn call (typed, named args)
const value = undefined as any /* TaoBalance — replace with real value */;
const keep_alive = true;
const tx = api.tx.Balances.burn({
value,
keep_alive,
});Events 22
Emitted when an account is created with some free balance.
When it fires
- Account did not exist or had zero balance
- Balance meets existential deposit
Fields
| Name | Type | Format | Description |
|---|---|---|---|
account | AccountId | SS58 Address | account: Account address (32 bytes, SS58-encoded) |
free_balance | TaoBalance | — | free_balance: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to Endowed events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Endowed.get(block.hash);
for (const evt of events) {
console.log("Endowed:", evt.payload);
}
});Emitted when an account's remaining balance is below existential deposit.
When it fires
- Account balance fell below existential deposit
- Balance was non-zero
Fields
| Name | Type | Format | Description |
|---|---|---|---|
account | AccountId | SS58 Address | account: Account address (32 bytes, SS58-encoded) |
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to DustLost events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.DustLost.get(block.hash);
for (const evt of events) {
console.log("DustLost:", evt.payload);
}
});Emitted when tokens are transferred between accounts.
When it fires
- Sender has sufficient balance
- Transfer won't kill sender (or transfer_allow_death used)
- Recipient will meet existential deposit
Fields
| Name | Type | Format | Description |
|---|---|---|---|
from | AccountId | SS58 Address | Sender account |
to | AccountId | SS58 Address | Recipient account |
amount | TaoBalance | — | Transfer amount (RAO) |
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);
// Subscribe to Transfer events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Transfer.get(block.hash);
for (const evt of events) {
console.log("Transfer:", evt.payload);
}
});Emitted when an account's balance is set by root.
When it fires
- Caller has root/sudo privileges
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | who: Account address (32 bytes, SS58-encoded) |
free | TaoBalance | — | free: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to BalanceSet events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.BalanceSet.get(block.hash);
for (const evt of events) {
console.log("BalanceSet:", evt.payload);
}
});Emitted when balance is moved from free to reserved.
When it fires
- Account has sufficient free balance
- Reserve operation requested
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | who: Account address (32 bytes, SS58-encoded) |
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to Reserved events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Reserved.get(block.hash);
for (const evt of events) {
console.log("Reserved:", evt.payload);
}
});Emitted when balance is moved from reserved to free.
When it fires
- Account has sufficient reserved balance
- Unreserve operation requested
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | who: Account address (32 bytes, SS58-encoded) |
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to Unreserved events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Unreserved.get(block.hash);
for (const evt of events) {
console.log("Unreserved:", evt.payload);
}
});Emitted when reserved balance is moved from one account to another.
When it fires
- Source account has sufficient reserved balance
- Repatriation operation authorized
Fields
| Name | Type | Format | Description |
|---|---|---|---|
from | AccountId | SS58 Address | from: Account address (32 bytes, SS58-encoded) |
to | AccountId | SS58 Address | to: Account address (32 bytes, SS58-encoded) |
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
destination_status | BalanceStatus | — | destination_status (BalanceStatus) |
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);
// Subscribe to ReserveRepatriated events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.ReserveRepatriated.get(block.hash);
for (const evt of events) {
console.log("ReserveRepatriated:", evt.payload);
}
});Emitted when tokens are deposited into an account.
When it fires
- Deposit operation executed
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | Account receiving deposit |
amount | TaoBalance | — | Deposit amount (RAO) |
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);
// Subscribe to Deposit events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Deposit.get(block.hash);
for (const evt of events) {
console.log("Deposit:", evt.payload);
}
});Emitted when tokens are withdrawn from an account.
When it fires
- Account has sufficient balance
- Withdrawal operation executed
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | Account funds withdrawn from |
amount | TaoBalance | — | Withdrawal amount (RAO) |
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);
// Subscribe to Withdraw events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Withdraw.get(block.hash);
for (const evt of events) {
console.log("Withdraw:", evt.payload);
}
});Emitted when tokens are removed as punishment.
When it fires
- Account has balance to slash
- Slash condition triggered
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | who: Account address (32 bytes, SS58-encoded) |
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to Slashed events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Slashed.get(block.hash);
for (const evt of events) {
console.log("Slashed:", evt.payload);
}
});Emitted when new tokens are minted into an account.
When it fires
- Minting operation authorized
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | who: Account address (32 bytes, SS58-encoded) |
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to Minted events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Minted.get(block.hash);
for (const evt of events) {
console.log("Minted:", evt.payload);
}
});Emitted when tokens are permanently burned.
When it fires
- Account has tokens to burn
- Burn operation executed
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | who: Account address (32 bytes, SS58-encoded) |
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to Burned events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Burned.get(block.hash);
for (const evt of events) {
console.log("Burned:", evt.payload);
}
});Emitted when balance is suspended from an account (can be restored later).
When it fires
- Account has sufficient balance
- Suspension operation authorized
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | who: Account address (32 bytes, SS58-encoded) |
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to Suspended events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Suspended.get(block.hash);
for (const evt of events) {
console.log("Suspended:", evt.payload);
}
});Emitted when suspended balance is restored to an account.
When it fires
- Account has suspended balance
- Restore operation authorized
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | who: Account address (32 bytes, SS58-encoded) |
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to Restored events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Restored.get(block.hash);
for (const evt of events) {
console.log("Restored:", evt.payload);
}
});Emitted when an account is upgraded to a new balance format.
When it fires
- Account exists
- Upgrade operation triggered
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | who: Account address (32 bytes, SS58-encoded) |
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);
// Subscribe to Upgraded events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Upgraded.get(block.hash);
for (const evt of events) {
console.log("Upgraded:", evt.payload);
}
});Emitted when total issuance is increased.
When it fires
- Issuance increase authorized
Fields
| Name | Type | Format | Description |
|---|---|---|---|
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to Issued events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Issued.get(block.hash);
for (const evt of events) {
console.log("Issued:", evt.payload);
}
});Emitted when total issuance is decreased.
When it fires
- Issuance decrease authorized
Fields
| Name | Type | Format | Description |
|---|---|---|---|
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to Rescinded events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Rescinded.get(block.hash);
for (const evt of events) {
console.log("Rescinded:", evt.payload);
}
});Emitted when balance is locked.
When it fires
- Account has balance to lock
- Lock operation requested
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | who: Account address (32 bytes, SS58-encoded) |
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to Locked events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Locked.get(block.hash);
for (const evt of events) {
console.log("Locked:", evt.payload);
}
});Emitted when balance is unlocked.
When it fires
- Account has locked balance
- Unlock conditions met
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | who: Account address (32 bytes, SS58-encoded) |
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to Unlocked events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Unlocked.get(block.hash);
for (const evt of events) {
console.log("Unlocked:", evt.payload);
}
});Emitted when balance is frozen.
When it fires
- Account has balance to freeze
- Freeze operation authorized
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | who: Account address (32 bytes, SS58-encoded) |
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to Frozen events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Frozen.get(block.hash);
for (const evt of events) {
console.log("Frozen:", evt.payload);
}
});Emitted when frozen balance is thawed.
When it fires
- Account has frozen balance
- Thaw operation authorized
Fields
| Name | Type | Format | Description |
|---|---|---|---|
who | AccountId | SS58 Address | who: Account address (32 bytes, SS58-encoded) |
amount | TaoBalance | — | amount: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to Thawed events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.Thawed.get(block.hash);
for (const evt of events) {
console.log("Thawed:", evt.payload);
}
});Emitted when total issuance is forcefully changed.
When it fires
- Caller has root/sudo privileges
Fields
| Name | Type | Format | Description |
|---|---|---|---|
old | TaoBalance | — | old: Balance in chain native currency (RAO for TAO; ÷10⁹) |
new | TaoBalance | — | new: Balance in chain native currency (RAO for TAO; ÷10⁹) |
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);
// Subscribe to TotalIssuanceForced events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Balances.TotalIssuanceForced.get(block.hash);
for (const evt of events) {
console.log("TotalIssuanceForced:", evt.payload);
}
});Storage 7
Account balance data including free, reserved, and frozen amounts.
AccountData Keys
| Name | Type | Format | Description |
|---|---|---|---|
key1 | AccountId | SS58 Address | — |
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 Account storage
const key1 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const result = await api.query.Balances.Account.getValue(key1);
console.log("Account:", result);Frozen balance entries for accounts.
BoundedVec Keys
| Name | Type | Format | Description |
|---|---|---|---|
key1 | AccountId | SS58 Address | — |
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 Freezes storage
const key1 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const result = await api.query.Balances.Freezes.getValue(key1);
console.log("Freezes:", result);Held balance entries with reason identifiers.
BoundedVec Keys
| Name | Type | Format | Description |
|---|---|---|---|
key1 | AccountId | SS58 Address | — |
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 Holds storage
const key1 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const result = await api.query.Balances.Holds.getValue(key1);
console.log("Holds:", result);Total amount of tokens that are inactive (not in circulation).
TaoBalance 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 InactiveIssuance storage (no keys - plain value)
const result = await api.query.Balances.InactiveIssuance.getValue();
console.log("InactiveIssuance:", result);Locks on an account's balance.
WeakBoundedVec Keys
| Name | Type | Format | Description |
|---|---|---|---|
key1 | AccountId | SS58 Address | — |
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 Locks storage
const key1 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const result = await api.query.Balances.Locks.getValue(key1);
console.log("Locks:", result);Named reserves on an account's balance.
BoundedVec Keys
| Name | Type | Format | Description |
|---|---|---|---|
key1 | AccountId | SS58 Address | — |
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 Reserves storage
const key1 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const result = await api.query.Balances.Reserves.getValue(key1);
console.log("Reserves:", result);Total tokens in circulation.
TaoBalance 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 TotalIssuance storage (no keys - plain value)
const result = await api.query.Balances.TotalIssuance.getValue();
console.log("TotalIssuance:", result);Constants 4
Minimum balance required to keep an account alive.
TaoBalance"500"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 ExistentialDeposit constant
const value = await api.constants.Balances.ExistentialDeposit();
console.log("ExistentialDeposit:", value);
// Balance: divide by 10^9 for TAO
const tao = value / 1_000_000_000n;Maximum number of freezes on a single account.
u3250import { 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 MaxFreezes constant
const value = await api.constants.Balances.MaxFreezes();
console.log("MaxFreezes:", value);Maximum number of locks on a single account.
u3250import { 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 MaxLocks constant
const value = await api.constants.Balances.MaxLocks();
console.log("MaxLocks:", value);Maximum number of named reserves on a single account.
u3250import { 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 MaxReserves constant
const value = await api.constants.Balances.MaxReserves();
console.log("MaxReserves:", value);Errors 12
Vesting balance is too high to send the requested value.
Common Causes
- Trying to transfer more than unlocked vesting balance
- Vesting schedule has not released enough tokens yet
- Attempting to send locked vesting tokens
How to Fix
Wait for more tokens to vest (unlock),Check your vesting schedule for unlock timeline,Only transfer up to your free (non-vesting) balance
Account liquidity restrictions prevent this withdrawal.
Common Causes
- Funds are locked for staking
- Funds are reserved for another purpose
- Vesting schedule prevents withdrawal
How to Fix
Check Balances.Locks for locked amounts,Check Balances.Reserves for reserved amounts,Wait for locks to expire or unlock them first
Your account doesn't have enough free balance for this transfer.
Common Causes
- Transfer amount exceeds available balance
- Not accounting for existential deposit
- Funds are locked or reserved
How to Fix
Check System.Account for your free balance,Reduce transfer amount,Check Balances.Locks for any locked funds
The transfer would leave the sender's account below the existential deposit (minimum balance).
Common Causes
- Trying to transfer almost all balance
- Not leaving enough for existential deposit
- Existential deposit on Bittensor is very small but non-zero
How to Fix
Leave at least the existential deposit in your account,Use transfer_allow_death if you want to empty the account,Check Balances.ExistentialDeposit constant for minimum
The transfer or payment would kill the account.
Common Causes
- Operation would reduce balance below existential deposit
- Using transfer_keep_alive but balance would go too low
- Account has references that prevent it from being killed
How to Fix
Use transfer_allow_death if you want to allow account reaping,Ensure enough balance remains after the operation,Check if account has references preventing deletion
A vesting schedule already exists for this account.
Common Causes
- Trying to create a new vesting schedule when one exists
- Account already has locked vesting tokens
How to Fix
Not reachable on this chain: no vesting pallet is installed, so no schedule can be created
The beneficiary account must pre-exist before receiving funds.
Common Causes
- Target account has never been created
- Target account was reaped (balance went to zero)
- Sending to an address that has no on-chain presence
How to Fix
Ensure recipient account exists first,Send enough to cover the existential deposit,Create the account with an initial transfer before this operation
The number of named reserves on this account exceeds MaxReserves.
Common Causes
- Too many simultaneous reserve operations
- MaxReserves limit reached
How to Fix
Unreserve some existing reserves first,Check Balances.Reserves for current count,Consolidate operations to reduce reserve count
The number of holds on this account exceeds the maximum allowed.
Common Causes
- Too many simultaneous holds on the account
- Reached VariantCountOf<RuntimeHoldReason> limit
How to Fix
Release some existing holds first,Check Balances.Holds for current hold count,Consolidate operations to reduce hold count
The number of freezes on this account exceeds the maximum allowed.
Common Causes
- Too many simultaneous freeze locks on the account
- MaxFreezes limit reached
How to Fix
Remove some existing freezes first,Check Balances.Freezes for current freeze count,Consolidate operations to reduce freeze count
The issuance cannot be modified because it is already deactivated.
Common Causes
- Trying to adjust deactivated issuance
- Issuance operations on inactive balance
How to Fix
Check Balances.InactiveIssuance status,Reactivate issuance before modification if needed
The balance adjustment amount cannot be zero.
Common Causes
- Passing zero as the adjustment delta
- Attempting to adjust total issuance by zero
How to Fix
Provide a non-zero delta value,Check your calculation is producing a positive amount