Skip to content

Balances & Assets

Native D9 lives in Balances (12 decimals). Registered assets such as USDT, Energy, and Bandwidth live in Assets (6 decimals).

Storage / Constant Returns
System::Account(account) Account balances, nonce, and reference counts
Balances::Holds(account) Named balance holds
Balances::Freezes(account) Frozen (non-transferable) balance
Balances::ExistentialDeposit 1,000,000 raw units (0.000001 D9)
Assets::Account(asset_id, account) Registered asset balance and account status
Assets::Metadata(asset_id) Asset name, symbol, and decimal precision
Call Purpose
Balances::transfer_keep_alive(dest, value) Standard D9 transfer; fails if the sender would drop below the existential deposit.
Balances::transfer_allow_death(dest, value) Transfer D9 even if the sender account drops below the existential deposit and is reaped.
Balances::transfer_all(dest, keep_alive) Transfer the entire transferable balance; keep_alive controls whether the account stays alive.

Pass value in raw units (amount × 10^12):

// 2.5 D9 = 2500000000000 raw units
const tx = chain.api.tx.Balances.transfer_keep_alive({
dest: { type: "Id", value: recipientAddress },
value: 2500000000000n,
});
Assets::transfer(id, target, amount)
Assets::transfer_keep_alive(id, target, amount)

Read decimals from Assets::Metadata(id) and scale amount to raw units. USDT is asset 1 with 6 decimals:

// 10 USDT (asset ID 1, 6 decimals)
const tx = chain.api.tx.Assets.transfer_keep_alive({
id: 1,
target: { type: "Id", value: recipientAddress },
amount: 10000000n,
});