Skip to main content
Creates a new Solana account funded with lamports and assigned to an owner program.
This method returns a SolanaInstruction. Add it to a transaction and use the Transaction Service to execute it on-chain. See Instructions & Transactions.

Create

Creates a new Solana account funded with lamports and assigned to an owner program.

Request

payer
Base58-encoded public key (string)
required
The account paying for creation. Must be a signer.
new_account
Base58-encoded public key (string)
required
The new account’s public key. Must be a signer.
owner
Base58-encoded public key (string)
Program that will own the new account. Defaults to the System Program.
lamports
uint64
required
Lamports to deposit into the new account. Must cover rent exemption. Use GetMinimumBalanceForRentExemption to calculate.
space
uint64
required
Bytes to allocate for the account’s data. Use 0 for wallet accounts with no data.

Response

instruction
SolanaInstruction (object)
The System Program create_account instruction. Add to a transaction via CompileTransaction.

Code Examples

resp, err := client.Create(ctx, &system_v1.CreateRequest{
    Payer:      "YOUR_PAYER_ADDRESS",
    NewAccount: "YOUR_NEW_ACCOUNT_ADDRESS",
    Owner:      "11111111111111111111111111111111",
    Lamports:   1_000_000,
    Space:      0,
})
if err != nil {
    log.Fatal(err)
}
// Add instruction to your transaction
instruction := resp.Instruction

CreateWithSeed

Creates an account at an address derived from a base public key and seed string. Useful when the account address must be deterministic.

Request

payer
Base58-encoded public key (string)
required
The account paying for creation. Must be a signer.
new_account
Base58-encoded public key (string)
required
The derived account address. Must match PublicKey.createWithSeed(base, seed, owner).
base
Base58-encoded public key (string)
required
Base public key used to derive new_account.
seed
string
required
Seed string (max 32 bytes) used to derive new_account.
lamports
uint64
required
Lamports to deposit into the new account. Must cover rent exemption. Use GetMinimumBalanceForRentExemption to calculate.
space
uint64
required
Bytes to allocate for the account’s data.

Response

instruction
SolanaInstruction (object)
The System Program create_account_with_seed instruction. Add to a transaction via CompileTransaction.

Code Examples

resp, err := client.CreateWithSeed(ctx, &system_v1.CreateWithSeedRequest{
    Payer:      "YOUR_PAYER_ADDRESS",
    NewAccount: "YOUR_DERIVED_ACCOUNT_ADDRESS",
    Base:       "YOUR_BASE_ADDRESS",
    Seed:       "my-seed",
    Lamports:   1_000_000,
    Space:      165,
})
if err != nil {
    log.Fatal(err)
}
// Add instruction to your transaction
instruction := resp.Instruction