1

In an 82 bytes Mint account what are the first 4 bytes and the last 4 bytes.

00-03 (4 bytes) : ??

04-35 (32 bytes): Mint Authority

36-43 (8 bytes) : Supply

44 (1 byte) : Decimals

45 (1 byte) : Initialized

46-49 (4 bytes) : ??

50-81 (32 bytes): Freeze Authority

0

1 Answer 1

2

If you talk about the Token Program Mint (program id TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA) then it's the best check the Mint state definition at https://github.com/solana-labs/solana-program-library/blob/token-client-v0.10.0/token/program/src/state.rs#L18

From there we can see there is no Discriminator and directly there is used the mint_authority: COption<Pubkey> and the deserialization and serialization is then implemented down in the code.

The COption is defined at the Solana Program at https://github.com/anza-xyz/agave/blob/v1.18.14/sdk/program/src/program_option.rs#L15 but the serialization is within here which is defined as 4 bytes data https://github.com/solana-labs/solana-program-library/blob/token-client-v0.10.0/token/program/src/state.rs#L255

So that's the answer. First 4 bytes is either [1,0,0,0] as saying the next bytes will be valid authority pubkey or [0,0,0,0] as the mint authority is not set. I.e., the first 4 bytes is data serialization of COption data structure.

The same for the last bytes which is not defined correctly in the question. It will be

46-49 (4 bytes) COption data

50-82 (32 bytes): Freeze Authority
4
  • Thanks, it seems to be right. Commented May 21 at 17:58
  • 0-3 (4 bytes) and 46-49 (4 bytes) both take [1,0,0,0] or [0,0,0,0] as value, but in both cases you can have wallet or not. So, this case is possible: [0,0,0,0] => Wallet Commented May 21 at 18:24
  • I edit my question to write down bytes as you pointed (so that I don't make other people get confused). Commented May 21 at 18:29
  • 1
    It seems that: 0-3 (4 bytes): Mint authority enabled. 46-49 (4 bytes): Freeze authority enabled. Commented May 21 at 20:56

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