Solana txs

Solana txs.


Notes

  • Tx include one or more instructions. Instructions are the atomic actions that can be performed on a Solana account (each instruction is an specific operation).
  • Logic behind instructions is defined in the programs deployed to the Soalna Network.
  • Instructions are executed in the order they are defined in the transaction.
  • A transaction is atomic, either fully completed with all instructions processed or fails together. If one fail, all fail -Tx max size 1232 bytes.

Example: Accounts in solaan are owned by the System Program. Based on the Solana Account Model, only owner of an account is allow to modify the data of the account.

Therefore, transfering SOL from account to account requires invoking the System Program with an instruction. In this case, the account where lamports are deducted must sign the tx (is_signer: true) and both accounts must be mutable (is_writable: true).

  • A tx is composed by signatures (array) and a message (list of ixs)

  • A message consists of:

    • Message header -> Indicates the number of required signatures, the number of RO accounts that require signature, the number of RO accounts that do not require signatures
    • Instructions -> List of instructions
    • Accounts -> List of accounts needed by the ixs of the tx. Being, writable and signers, RO and signers, writable and no signers and RO and no signers
    • Recent blockhash -> The last Proof of History (PoH) hash for a slot acts as the timestamp for the tx. If it is older than 150 blocks, it is assumed to be expired
  • Each instruction in the array specifies:

    • Program ID -> Program to process instruction
    • Accounts- > List of accounts that will be used by the program
    • Data -> The data to be processed by the program
  • Each account is requried to specify the pubkey and is_signer and is_writable flags. This is the accountMeta

Links

Solana