The substrate-node-template
allows you to query the system.account
storage item, see screenshot
The corresponding command is
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "state_getStorage", "params": ["0x26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9de1e86a9a8c739864cf3cc5ec2bea59fd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"]}' http://127.0.0.1:9933
{"jsonrpc":"2.0","result":"0x01000000000000000100000000000000dcb114568172fc0f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","id":1}
The frame_system
declares an AccountInfo
struct that details the data field of an account:
/// Information of an account.
#[derive(Clone, Eq, PartialEq, Default, RuntimeDebug, Encode, Decode)]
pub struct AccountInfo<Index, AccountData> {
/// The number of transactions this account has sent.
pub nonce: Index,
/// The number of other modules that currently depend on this account's existence. The account
/// cannot be reaped until this is zero.
pub consumers: RefCount,
/// The number of other modules that allow this account to exist. The account may not be reaped
/// until this is zero.
pub providers: RefCount,
/// The additional data that belongs to this account. Used to store the balance(s) in a lot of
/// chains.
pub data: AccountData,
}
The runtime/src/lib.rs
is where all of your configs are created. If you look carefully at
impl frame_system::Config for Runtime {
...
type AccountData = pallet_balances::AccountData<Balance>;
...
}
and
impl pallet_balances::Config for Runtime {
...
type AccountStore = System;
...
}
you will see why the system
storage exposes the balances in the data, not the balances
storage. Use type AccountStore = Balances;
instead to leverage the usage of pallet-balances
.
Balances::FreeBalance
, it was probably how balances were formerly handled. The answer below from Lana explains the new way of getting the free balance.