2

I want to setup some democracy on one chain. Democracy is voting with tokens. So it is important to know if tokens distributed well enough.

I looked into some tools and indexers, none provided such information.

Simplest solution I thought of to take storage snapshot and go over balances account prefix.

I tried polkadotjs, but it seems "empty"

enter image description here

2 Answers 2

2

Have you already started your chain? If not, you could have the accounts and balances in the genesis config:

#[pallet::genesis_config]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
    pub balances: Vec<(T::AccountId, T::Balance)>,
}

OR

You could use transfer() (if you have a fund account) or setBalance().

Keep in mind setBalance() requires root origin. Do you have a sudo key?

setBalance() will alter FreeBalance and ReservedBalance in storage for an account and it will also alter the total issuance so make sure this is what you intend. It will overwrite the balance.

Write a script using polkadotJS api to iterate over accounts and call the balances -> setBalance() extrinsic. Coupling this with a batch_all call might make things easier depending on the number of accounts you need to update.

For example:

await api.tx.sudo.sudo(api.tx.balances.setBalance(...))

Note: I would not modify state directly like you mentioned, it could lead to undesired consequences.

The simplest and cleanest way may be to do a storage migration. Check this post out:

0

I got help and got script via polkadotjs, not direct storage usage. But after digging what accounts own what, found https://.subscan.io/account does it. Need to clock more in subscan.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.