Skip to main content

Module instruction

Module 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 create_account function requires that the account have zero lamports. create_account_allow_prefund allows for the account to have lamports prefunded; note that without feature activation of SIMD-0312, create_account_allow_prefund will fail downstream.

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.

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§

SystemInstruction
An instruction to the system program.

Functions§

advance_nonce_accountbincode or wincode
Advance the value of a durable transaction nonce.
allocatebincode or wincode
Allocate space for an account.
allocate_with_seedbincode or wincode
assignbincode or wincode
Assign ownership of an account from the system program.
assign_with_seedbincode or wincode
authorize_nonce_accountbincode or wincode
Change the authority of a durable transaction nonce account.
create_accountbincode or wincode
Create an account, failing if the account previously had any balance.
create_account_allow_prefundbincode or wincode
Create a new account without enforcing zero lamports on the destination account.
create_account_with_seedbincode or wincode
create_nonce_accountbincode or wincode
Create an account containing a durable transaction nonce.
create_nonce_account_with_seedbincode or wincode
transferbincode or wincode
Transfer lamports from an account owned by the system program.
transfer_manybincode or wincode
Transfer lamports from an account owned by the system program to multiple accounts.
transfer_with_seedbincode or wincode
upgrade_nonce_accountbincode or wincode
One-time idempotent upgrade of legacy nonce versions in order to bump them out of chain blockhash domain.
withdraw_nonce_accountbincode or wincode
Withdraw lamports from a durable transaction nonce account.