Skip to main content

System program composability libraries

Repository​

System program Solidity libraries

Example contract​

CallSystemProgram - example contract demonstrating how the System program Solidity libraries can be used in practice to interact with Solana's System program.

Libraries​

LibSystemProgram library​

This library provides helper functions for formatting instructions to be executed by Solana's System program.

Available System program instructions​

  • createAccountWithSeed: creates a new Solana PDA (program-derived account) which public key is derived from a base public key, a program id and a seed. A payer account pays for the rent exemption balance of the created PDA based on the size of the storage allocated to the account. See instruction formatting.

  • transfer: transfers an amount of SOL to another Solana account. See instruction formatting.

  • assignWithSeed: assigns a Solana PDA (program-derived account) to a Solana program. See instruction formatting.

  • allocateWithSeed: allocates storage space to a Solana PDA (program-derived account). See instruction formatting.

LibSystemData library​

This library provides a set of getter functions for querying System accounts data from Solana.

System accounts data​

The following data fields are stored by System accounts and can be queried using the LibSystemData library:

bytes32 pubkey
uint64 lamports
bytes32 owner
bool executable
uint64 rent_epoch

LibSystemErrors library​

This library provides a set of custom errors that may be thrown when using LibSystemProgram and LibSystemData libraries.

Was this page helpful?