Skip to main content

get_processed_instruction

Function get_processed_instruction 

Source
pub fn get_processed_instruction(index: u64) -> Option<ProcessedInstruction>
Expand description

Retrieve a previously processed sibling instruction from the current transaction.

index is 0-based: 0 = most recently processed instruction before the current one, 1 = the one before that, etc.

Returns None if no instruction exists at that index.

ยงUse case: Ed25519 signature verification

To verify an Ed25519 signature on-chain:

  1. The transaction includes an instruction to the Ed25519 precompile with the message, signature, and public key.
  2. Your program calls get_processed_instruction(0) to read that instruction.
  3. Verify the program_id is the Ed25519 precompile address.
  4. Parse the instruction data to extract the verified message.