substrateparity-io

Why does Total Issuance (balances pallet) go down when making a transaction?


So I am starting a chain with the intention that it would have a fixed number of tokens, and the way I went about doing it is to configure one endowed_account: Alice with a set number of tokens in the genesis configuration. Alice so happens to also be the only validator, and she's also the only person running the node. When I create a try to send some tokens say 10 units from Alice to Bob, Bob gets the full amount, but total issuance goes down, presumably by the fees amount. Like if Alice initially had 100, and sent 10 to Bob, the total issuance in the block explorer shows something like 99.999 Units.

My intuition is that pub type TotalIssuance<T: Config<I>, I: 'static = ()> = StorageValue<_, T::Balance, ValueQuery>; calculates the sum of free and reserved balance of all accounts above existential deposit and then stores that value, which is why we don't see the "fees" being accounted for in it, and the "fees" is effectively burned. However this is my speculation and I am not sure. I would initially think of TotalIssuance as a hard upper limit on the number of tokens in circulation but is it so?

Besides this, I don't understand that since Alice is the only one validator and block producer in this chain, the fees should be going to her right, since typically block rewards go to the block producer? Yet, it's NOT so.

The second doubt I had regarding the transfer function is that the documentation says that if a transfer call puts the balance below existential deposit, the account will be "reaped". What does that mean? They've also provided an alternative transfer_keep_alive which quote:

works the same way as transfer, but has an additional check that the transfer will not kill the origin account.

I am having trouble understanding these terms, since something I read previously said all valid pub/private key pairs are valid "accounts". So what does killing and reaping mean in this context?


Solution

  • About the variations on the total supply I would recommend to read this entry about Imbalances, it directly tackle what you are asking for. https://crates.parity.io/frame_support/traits/tokens/imbalance/trait.Imbalance.html

    As for the rewards if you are running just a simple dev network with no staking or nominations built in, I would say that is fair to assume that there will be no incentives for those running nodes. I can see that the more "basic" fee payment uses withdrawals. In the implementation for withdraw we can see that it returns an imbalance if successful, coming back to my first paragraph.

    About existential deposit there is this very good writing about it already in the following FAQ page https://support.polkadot.network/support/solutions/articles/65000168651-what-is-the-existential-deposit- Hope it solves your doubts, if not I am happy to edit this response to add some info.

    But I would like to add to that that the reaping only happens on one network at a time, meaning that if an account is reaped of a relay chain' state, it doesn't mean loosing the balances on other paras for that same key.