force_set_balance

Call v149 → current #8

Sets an account balance to a specific value (root only).

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: validators

The Big Picture

A root-only escape hatch to directly set an account balance. Used in emergencies when normal transfer mechanisms cannot fix a problem.

Use Cases

  • Emergency balance corrections
  • Genesis state setup
  • Recovery from bugs

From Chain Metadata

See [`Pallet::force_set_balance`].

Input Parameters

#NameTypeDescription
0
who
MultiAddress who (MultiAddress)
1
new_free
Compact<u64> Cptnew_free (Compact<u64>) (SCALE compact -> integer)

Permissions

Origin
Unknown
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Caller is root account
  • Target account specified

Effects

Events Emitted

Storage Modified

Postconditions

  • Target account free balance set to new_free
  • BalanceSet event emitted

Side Effects

  • May create account if it did not exist
  • May affect TotalIssuance
  • Bypasses normal transfer checks

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 });

// Build force_set_balance call
const who = 0 as any /* MultiAddress */;
const new_free = 0;

const call = api.tx[stringCamelCase("Balances")][stringCamelCase("force_set_balance")](
  who,
  new_free
);

Runtime Info

Pallet Index
5
Call Index
8
First Version
v149
Current Version
v393