rustsubstrate

How to query the Account Balance of Alice in a substrate node?


Using the polkadot UI, I can see the account Balances of Alice, Bob, displayed in the Accounts tab.

Using Developer> ChainState, I can query the storage on ("Balances" "TotalIssuance"), but there seems to be no content in ("Balances", "Account", alice_account_id) I'm using substrate branch = "polkadot-v0.9.24"

Alternative, I can get the "Balance", "TotalIssuance" using polkadot.js.org/apps connected locally via browser extension.

enter image description here

So, where is the total balance of accounts like Alice stored if not in ("Balances", "Account")?


Solution

  • It's actually stored in the Storage map ("System", "Account", <alice_account_id>).

    AccountInfoGen {
                nonce: 3,
                consumers: 0,
                providers: 1,
                sufficients: 0,
                data: AccountDataGen {
                    free: 1142921504349461553,
                    reserved: 0,
                    misc_frozen: 0,
                    fee_frozen: 0,
                },
            },