8

How does a Substrate chain set the max total supply? Looking at the staking module, each era will increase the total_issuance through the issue. In the issue function, Self::Balance::max_value() is not configurable, and the binding is the max_value of u128.

For example, the Bitcoin max total supply is 21 million.

3
  • If I understand you correctly, you want to know how to set a "hard" limit or cap on total issuance?
    – Bruno
    Commented Jul 15, 2022 at 20:37
  • yes, dou you have any ways to do it.
    – Smith
    Commented Jul 16, 2022 at 11:17
  • 2
    If you want a Substrate chain to set a max total supply then see how Nodle has done it in their allocations pallet here github.com/NodleCode/chain/blob/… and then if you are using a parachain then either use their custom staking pallet or integrate it into Moonbeam's parachain-staking pallet github.com/PureStake/moonbeam/tree/master/pallets/… that is already working in production Commented Jul 18, 2022 at 22:36

1 Answer 1

4

The Balances pallet itself does not have logic which allows for a max supply of the token.

In fact, the Balances pallet has no logic which itself automatically increases or decreases the total balance in the system. Only functions / APIs which can be called by other runtime logic.

Instead, if you want to program some hard cap, you should modify whatever system is minting new tokens on your chain, and before you mint tokens, check the current total supply, and only mint so that you do not go over your max value. But you will need to do this external to the balances pallet.

Using the staking module and balances pallet together, there is no way to do this as far as I know since these two are meant to work together in a no-fixed-supply way.

You could create a new staking pallet which manages such a check, or just have no staking pallet at all.

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.