An instruction is a request to execute a specific function on a Solana program. Instructions are the fundamental building block for on-chain operations. Each instruction specifies exactly one program to call, the accounts it needs, and a byte array of data that the program interprets (typically a discriminator to identify which instruction handler to run, followed by serialized arguments). Execution logic for each instruction is stored on a program, where each program defines its own set of instructions. To interact with the Solana network, one or more instructions are added to a transaction and sent to the network to be processed.
Diagram depicting a transaction with an instruction, broken up into its 3 components
Instruction Structure
The three fields of an instruction (program_id, accounts, data), AccountMeta, compiled instructions, and the SOL transfer example.
Instruction Introspection
How programs inspect sibling instructions in the current transaction via the Instructions sysvar.
Key facts
- Single program: Each instruction targets exactly one program via
program_id. - Account metadata: The
accountsarray providesAccountMetafor every account the instruction reads or writes. - Opaque data: The
datafield is a byte array whose format is defined by the target program.
Is this page helpful?