Skip to content

Instantly share code, notes, and snippets.

@nikkaroraa
Created February 28, 2022 07:50
Show Gist options
  • Save nikkaroraa/92e0998dc0dd6f673f7f1c1850eb71e2 to your computer and use it in GitHub Desktop.
Save nikkaroraa/92e0998dc0dd6f673f7f1c1850eb71e2 to your computer and use it in GitHub Desktop.

The latest loader serializes the program input parameters as follows (all encoding is little endian):

  • 8 bytes unsigned number of accounts
  • For each account
    • 1 byte indicating if this is a duplicate account, if not a duplicate then the value is 0xff, otherwise the value is the index of the account it is a duplicate of.
    • If duplicate: 7 bytes of padding
    • If not duplicate:
      • 1 byte boolean, true if account is a signer
      • 1 byte boolean, true if account is writable
      • 1 byte boolean, true if account is executable
      • 4 bytes of padding
      • 32 bytes of the account public key
      • 32 bytes of the account's owner public key
      • 8 bytes unsigned number of lamports owned by the account
      • 8 bytes unsigned number of bytes of account data
      • x bytes of account data
      • 10k bytes of padding, used for realloc
      • enough padding to align the offset to 8 bytes.
      • 8 bytes rent epoch
  • 8 bytes of unsigned number of instruction data
  • x bytes of instruction data
  • 32 bytes of the program id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment