System Program

ID: Final[Pubkey] = Pubkey(     11111111111111111111111111111111, )

Pubkey that identifies the System program.

transfer_many(from_pubkey, to_lamports)

Create new Transfer instructions to many destinations.

Parameters:
  • from_pubkey (Pubkey) – The sender pubkey.

  • to_lamports (Sequence[tuple[int, Pubkey]]) – The lamports to transfer to each pubkey.

Returns:

The Transfer instructions.

Return type:

list[Instruction]

create_nonce_account(from_pubkey, nonce_pubkey, authority, lamports)

Generate instructions to create and initialize a nonce account.

Parameters:
  • from_pubkey (Pubkey) – The account that will transfer lamports to the created nonce account.

  • nonce_pubkey (Pubkey) – Nonce account which will be created and initialized.

  • authority (Pubkey) – Pubkey to set as authority of the initialized nonce account.

  • lamports (int) – Amount of lamports to transfer to the created account.

Returns:

The CreateAccount instruction and the InitializeNonceAccount instruction.

Return type:

tuple[Instruction, Instruction]

create_nonce_account_with_seed(from_pubkey, nonce_pubkey, base, seed, authority, lamports)

Generate instructions to create a nonce account with seed.

Parameters:
  • from_pubkey (Pubkey) – The account that will transfer lamports to the created nonce account.

  • nonce_pubkey (Pubkey) – Nonce account which will be created and initialized. Must be pre-calculated with create_with_seed()

  • base (Pubkey) – Base public key to use to derive the address of the created account. Must be the same as the base key used to create nonce_pubkey.

  • seed (str) – Seed to use to derive the address of the created account. Must be the same as the seed used to create nonce_pubkey.

  • authority (Pubkey) – Pubkey to set as authority of the initialized nonce account.

  • lamports (int) – Amount of lamports to transfer to the created account.

Returns:

The CreateAccountWithSeed instruction and the InitializeNonceAccount instruction.

Return type:

tuple[Instruction, Instruction]

class CreateAccountParams

Create account system transaction params.

from_pubkey: Pubkey

The account that will transfer lamports to the created account.

to_pubkey: Pubkey

Pubkey of the created account.

lamports: int

Amount of lamports to transfer to the created account.

space: int

Amount of space in bytes to allocate to the created account.

owner: Pubkey

Pubkey of the program to assign as the owner of the created account.

create_account(params: CreateAccountParams) Instruction

Generate an instruction that creates a new account.

Parameters:

params – The CreateAccount params.

Example

>>> from solders.pubkey import Pubkey
>>> from solders.system_program import create_account, CreateAccountParams
>>> from_account = Pubkey.new_unique()
>>> new_account = Pubkey.new_unique()
>>> program_id = Pubkey.new_unique()
>>> instruction = create_account(
...     CreateAccountParams(
...         from_pubkey=from_account, to_pubkey=new_account,
...         lamports=1, space=1, owner=program_id)
... )
>>> type(instruction)
<class 'solders.instruction.Instruction'>
Returns:

The instruction to create the account.

Return type:

Instruction

decode_create_account(instruction: Instruction) CreateAccountParams

Decode a create account instruction and retrieve the instruction params.

Parameters:

instruction (Instruction) – The CreateAccount instruction.

Returns:

The params used to create the instruction.

Return type:

CreateAccountParams

class CreateAccountWithSeedParams

Create account with seed system transaction params.

from_pubkey: Pubkey

The account that will transfer lamports to the created account.

to_pubkey: Pubkey

Pubkey of the created account. Must be pre-calculated with create_with_seed().

base: Pubkey

Base public key to use to derive the address of the created account. Must be the same as the base key used to create to_pubkey.

seed: str

Seed to use to derive the address of the created account. Must be the same as the seed used to create to_pubkey.

lamports: int

Amount of lamports to transfer to the created account.

space: int

Amount of space in bytes to allocate to the created account.

owner: Pubkey

Pubkey of the program to assign as the owner of the created account.

create_account_with_seed(params: CreateAccountWithSeedParams) Instruction

Generate an instruction that creates a new account at an address generated with from, a seed, and program_id.

Parameters:

params (CreateAccountWithSeedParams) – The CreateAccountWithSeed params.

Returns:

The instruction to create the account.

Return type:

Instruction

decode_create_account_with_seed(instruction: Instruction) CreateAccountWithSeedParams

Decode create account with seed instruction and retrieve the instruction params.

Parameters:

instruction (Instruction) – The CreateAccountWithSeed instruction.

Returns:

The params used to create the instruction.

Return type:

CreateAccountWithSeedParams

class AssignParams

Assign system transaction params.

pubkey: Pubkey

Pubkey of the account which will be assigned a new owner.

owner: Pubkey

Pubkey of the program to assign as the owner.

assign(params: AssignParams) Instruction

Generate an instruction that assigns an account to a program.

Parameters:

params (AssignParams) – The assign params.

Returns:

The generated instruction.

Return type:

Instruction

Example

>>> from solders.pubkey import Pubkey
>>> from solders.system_program import assign, AssignParams
>>> account, program_id = Pubkey.default(), Pubkey.default()
>>> instruction = assign(
...     AssignParams(pubkey=account, owner=program_id)
... )
>>> type(instruction)
<class 'solders.instruction.Instruction'>
decode_assign(instruction: Instruction) AssignParams

Decode an assign instruction and retrieve the instruction params.

Parameters:

instruction (Instruction) – The Assign instruction.

Returns:

The params used to create the instruction.

Return type:

AssignParams

class AssignWithSeedParams

Assign account with seed system transaction params.

address: Pubkey

Pubkey of the account which will be assigned a new owner.

base: Pubkey

Base public key to use to derive the address of the assigned account.

seed: str

Seed to use to derive the address of the assigned account.

owner: Pubkey

Pubkey of the program to assign as the owner.

assign_with_seed(params: AssignWithSeedParams) Instruction

Generate an instruction that assigns an account to a program.

Parameters:

params (AssignWithSeedParams) – The AssignWithSeed params.

Returns:

The generated instruction.

Return type:

Instruction

decode_assign_with_seed(instruction: Instruction) AssignWithSeedParams

Decode an assign with seed instruction and retrieve the instruction params.

Parameters:

instruction (Instruction) – The AssignWithSeed instruction.

Returns:

The params used to create the instruction.

Return type:

AssignWithSeedParams

class TransferParams

Transfer system transaction params.

from_pubkey: Pubkey

Account that will transfer lamports.

to_pubkey: Pubkey

Account that will receive transferred lamports.

lamports: int

Amount of lamports to transfer.

transfer(params: TransferParams) Instruction

Generate an instruction that transfers lamports from one account to another.

Parameters:

params – The transfer params.

Example

>>> from solders.pubkey import Pubkey
>>> from solders.system_program import transfer, TransferParams
>>> sender, receiver = Pubkey.default(), Pubkey.default()
>>> instruction = transfer(
...     TransferParams(from_pubkey=sender, to_pubkey=receiver, lamports=1000)
... )
>>> type(instruction)
<class 'solders.instruction.Instruction'>
Returns:

The transfer instruction.

Return type:

Instruction

decode_transfer(instruction: Instruction) TransferParams

Decode a transfer instruction and retrieve the instruction params.

Parameters:

instruction (Instruction) – The Transfer instruction.

Returns:

The params used to create the instruction.

Return type:

TransferParams

class TransferWithSeedParams

Transfer with seed system transaction params.

from_pubkey: Pubkey

Account that will transfer lamports.

from_base: Pubkey

Base public key to use to derive the funding account address.

from_seed: str

Seed to use to derive the funding account address.

from_owner: Pubkey

Program id to use to derive the funding account address.

to_pubkey: Pubkey

Account that will receive transferred lamports.

lamports: int

Amount of lamports to transfer.

transfer_with_seed(params: TransferWithSeedParams) Instruction

Generate an instruction that transfers lamports from one account to another.

Parameters:

params (TransferWithSeedParams) – The TransferWithSeed params.

Returns:

The TransferWithSeed instruction.

Return type:

Instruction

decode_transfer_with_seed(instruction: Instruction) TransferWithSeedParams

Decode a transfer with seed instruction and retrieve the instruction params.

Parameters:

instruction (Instruction) – The TransferWithSeed instruction.

Returns:

The params used to create the instruction.

Return type:

TransferWithSeedParams

class AllocateParams

Allocate account system transaction params.

pubkey: Pubkey

Account to allocate.

space: int

Amount of space in bytes to allocate.

allocate(params: AllocateParams) Instruction

Generate an instruction that allocates space in an account without funding.

Parameters:

params (AllocateParams) – The allocate params.

Returns:

The allocate instruction.

Return type:

Instruction

Example

>>> from solders.pubkey import Pubkey
>>> from solders.system_program import allocate, AllocateParams
>>> allocator = Pubkey.default()
>>> instruction = allocate(
...     AllocateParams(pubkey=allocator, space=65537)
... )
>>> type(instruction)
<class 'solders.instruction.Instruction'>
decode_allocate(instruction: Instruction) AllocateParams

Decode an allocate instruction and retrieve the instruction params.

Parameters:

instruction (Instruction) – The Allocate instruction.

Returns:

The params used to create the instruction.

Return type:

AllocateParams

class AllocateWithSeedParams

Allocate account with seed system transaction params.

address: Pubkey

Account to allocate.

base: Pubkey

Base public key to use to derive the address of the allocated account.

seed: str

Seed to use to derive the address of the allocated account.

space: int

Amount of space in bytes to allocate.

owner: Pubkey

Pubkey of the program to assign as the owner of the allocated account.

allocate_with_seed(params: AllocateWithSeedParams) Instruction

Generate an instruction that allocates space in an account without funding.

Parameters:

params (AllocateWithSeedParams) – The AllocateWithSeed params.

Returns:

The AllocateWithSeed instruction.

Return type:

Instruction

decode_allocate_with_seed(instruction: Instruction) AllocateWithSeedParams

Decode an allocate with seed instruction and retrieve the instruction params.

Parameters:

instruction (Instruction) – The AllocateWithSeed instruction.

Returns:

The params used to create the instruction.

Return type:

AllocateWithSeedParams

class InitializeNonceAccountParams

Initialize nonce account system instruction params.

nonce_pubkey: Pubkey

Nonce account which will be initialized.

authority: Pubkey

Pubkey to set as authority of the initialized nonce account.

initialize_nonce_account(params: InitializeNonceAccountParams) Instruction

Generate an instruction to initialize a Nonce account.

Parameters:

params (InitializeNonceAccountParams) – The InitializeNonceAccount params.

Returns:

The InitializeNonceAccount instruction.

Return type:

Instruction

decode_initialize_nonce_account(instruction: Instruction) InitializeNonceAccountParams

Decode initialize nonce account instruction and retrieve the instruction params.

Parameters:

instruction (Instruction) – The InitializeNonceAccount instruction.

Returns:

The params used to create the instruction.

Return type:

InitializeNonceAccountParams

class AdvanceNonceAccountParams

Advance nonce account system instruction params.

nonce_pubkey: Pubkey

Nonce account.

authorized_pubkey: Pubkey

Pubkey of the nonce authority.

advance_nonce_account(params: AdvanceNonceAccountParams) Instruction

Generate an instruction to advance the nonce in a Nonce account.

Parameters:

params (AdvanceNonceAccountParams) – The AdvanceNonceAccount params.

Returns:

The AdvanceNonceAccount instruction.

Return type:

Instruction

decode_advance_nonce_account(instruction: Instruction) AdvanceNonceAccountParams

Decode an advance nonce account instruction and retrieve the instruction params.

Parameters:

instruction (Instruction) – The AdvanceNonceAccount instruction.

Returns:

The params used to create the instruction.

Return type:

AdvanceNonceAccountParams

class WithdrawNonceAccountParams

Withdraw nonce account system transaction params.

nonce_pubkey: Pubkey

Nonce account.

authorized_pubkey: Pubkey

Pubkey of the nonce authority.

to_pubkey: Pubkey

Pubkey of the account which will receive the withdrawn nonce account balance.

lamports: int

Amount of lamports to withdraw from the nonce account.

withdraw_nonce_account(params: WithdrawNonceAccountParams) Instruction

Generate an instruction that withdraws lamports from a Nonce account.

Parameters:

params (WithdrawNonceAccountParams) – The WithdrawNonceAccount params.

Returns:

The WithdrawNonceAccount instruction.

Return type:

Instruction

decode_withdraw_nonce_account(instruction: Instruction) WithdrawNonceAccountParams

Decode a withdraw nonce account instruction and retrieve the instruction params.

Parameters:

instruction (Instruction) – The WithdrawNonceAccount instruction.

Returns:

The params used to create the instruction.

Return type:

WithdrawNonceAccountParams

class AuthorizeNonceAccountParams

Authorize nonce account system transaction params.

nonce_pubkey: Pubkey

Nonce account.

authorized_pubkey: Pubkey

Pubkey of the current nonce authority.

new_authority: Pubkey

Pubkey of the new nonce authority.

authorize_nonce_account(params: AuthorizeNonceAccountParams) Instruction

Generate an instruction that authorizes a new Pubkey as the nonce authority.

Parameters:

params (AuthorizeNonceAccountParams) – The AuthorizeNonceAccount params.

Returns:

The AuthorizeNonceAccount instruction.

Return type:

Instruction

decode_authorize_nonce_account(instruction: Instruction) AuthorizeNonceAccountParams

Decode authorize nonce account instruction and retrieve the instruction params.

Parameters:

instruction (Instruction) – The AuthorizeNonceAccount instruction.

Returns:

The params used to create the instruction.

Return type:

AuthorizeNonceAccountParams

class CloseLookupTableParams

Close lookup table system transaction params.

lookup_table_address: Pubkey
authority_address: Pubkey
recipient_address: Pubkey
close_lookup_table(params: CloseLookupTableParams) Instruction

Returns an instruction that closes an address lookup table account.

The account will be deallocated and the lamports will be drained to the recipient address.

Parameters:

params (CloseLookupTableParams) – The CloseLookupTable params.

Returns:

The CloseLookupTable instruction.

Return type:

Instruction

class CreateLookupTableParams

Create lookup table system transaction params.

authority_address: Pubkey
payer_address: Pubkey
recent_slot: int
create_lookup_table(params: CreateLookupTableParams) Tuple[Instruction, Pubkey]

Constructs an instruction to create a table account.

Returns the instruction and the table account`s derived address.

Parameters:

params (CreateLookupTableParams) – The CreateLookupTable params.

Returns:

The CreateLookupTable instruction and the table account`s derived address

Return type:

Tuple[Instruction, PubKey]

class CreateLookupTableSignedParams

Create lookup table signed system transaction params.

authority_address: Pubkey
payer_address: Pubkey
recent_slot: int
create_lookup_table_signed(params: CreateLookupTableSignedParams) Tuple[Instruction, Pubkey]

Constructs an instruction to create a table account.

Returns the instruction and the table account`s derived address.

Parameters:

params (CreateLookupTableSignedParams) – The CreateLookupTableSigned params.

Returns:

The CreateLookupTableSigned instruction and the table account’s derived address

Return type:

Tuple[Instruction, PubKey]

class DeactivateLookupTableParams

Deactivate lookup table system transaction params.

lookup_table_address: Pubkey
authority_address: Pubkey
deactivate_lookup_table(params: DeactivateLookupTableParams) Instruction

Constructs an instruction that deactivates an address lookup table.

So that it cannot be extended again and will be unusable and eligible for closure after a short amount of time.

Parameters:

params (DeactivateLookupTableParams) – The DeactivateLookupTable params.

Returns:

The DeactivateLookupTable instruction.

Return type:

Instruction

class ExtendLookupTableParams

Extend lookup table system transaction params.

payer_address: Pubkey | None
lookup_table_address: Pubkey
authority_address: Pubkey
new_addresses: List[Pubkey]
extend_lookup_table(params: ExtendLookupTableParams) Instruction

Constructs an instruction which extends an ATL account with new addresses.

Parameters:

params (ExtendLookupTableParams) – the ExtendLookupTable params.

Returns:

The ExtendLookupTable instruction.

Return type:

Instruction

class FreezeLookupTableParams

Freeze lookup table system transaction params.

lookup_table_address: Pubkey
authority_address: Pubkey
freeze_lookup_table(params: FreezeLookupTableParams) Instruction

Constructs an instruction that freezes an address lookup table.

So that it can never be closed or extended again. Empty lookup tables cannot be frozen.

Parameters:

params (FreezeLookupTableParams) – The FreezeLookupTable params.

Returns:

The FreezeLookupTable instruction.

Return type:

Instruction