solana_program

Module system_instruction

Source
Expand description

Instructions and constructors for the system program.

The system program is responsible for the creation of accounts and nonce accounts. It is responsible for transferring lamports from accounts owned by the system program, including typical user wallet accounts.

Account creation typically involves three steps: allocate space, transfer lamports for rent, assign to its owning program. The create_account function does all three at once. All new accounts must contain enough lamports to be rent exempt, or else the creation instruction will fail.

The accounts created by the system program can either be user-controlled, where the secret keys are held outside the blockchain, or they can be program derived addresses, where write access to accounts is granted by an owning program.

The system program ID is defined in system_program.

Most of the functions in this module construct an Instruction, that must be submitted to the runtime for execution, either via RPC, typically with RpcClient, or through cross-program invocation.

When invoking through CPI, the invoke or invoke_signed instruction requires all account references to be provided explicitly as AccountInfo values. The account references required are specified in the documentation for the SystemInstruction variants for each system program instruction, and these variants are linked from the documentation for their constructors.

Enums§

Constants§

Functions§