3

I just started learning Solana, and I have a question that is confusing me. A tokenMint are account that holds specific information about a token. But createMint only requires the mint freeze authority but not the total supply. Where is stored the total supply of the tokenMint? Is it the mintAuthority associated tokenAccount which is responsible for keeping the maximum supply of a tokenMint, which is also responsible in the first stage to distribute the tokens to the users?

1 Answer 1

3

The total supply of a token mint is tracked by the amount that have been minted. This meaning, when you initially create a mint it will have a supply of 0, but as soon as you mint 5000 (for example) the total supply will be updated to be 5000. If you then mint another 555 (for example), the total supply will change to 5555.

https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/processor.rs#L565-L568

Total supply is dynamically calculated during each instruction call to the mint_to instruction for the token program for a given mint. The on-chain data itself is stored within the token mint program account.

https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/state.rs#L14-L29

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.