Skip to main content
Transfers SOL (in lamports) between Solana accounts.
This method returns a SolanaInstruction. Add it to a transaction and use the Transaction Service to execute it on-chain. See Instructions & Transactions.

Transfer

Transfers SOL (in lamports) from one account to another.

Request

from
Base58-encoded public key (string)
required
The sender account. Must be a signer.
to
Base58-encoded public key (string)
required
The recipient account.
lamports
uint64
required
Amount of SOL to transfer, in lamports. 1 SOL = 1,000,000,000 lamports.

Response

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

Code Examples

resp, err := client.Transfer(ctx, &system_v1.TransferRequest{
    From:     "YOUR_SENDER_ADDRESS",
    To:       "YOUR_RECIPIENT_ADDRESS",
    Lamports: 1_000_000_000, // 1 SOL
})
if err != nil {
    log.Fatal(err)
}
// Add instruction to your transaction
instruction := resp.Instruction

TransferWithSeed

Transfers SOL from a seed-derived account. The sending account’s address is derived from a base public key and seed, so the base key (not the derived address) signs the transaction.

Request

from
Base58-encoded public key (string)
required
The seed-derived sender account address.
from_base
Base58-encoded public key (string)
required
Base public key used to derive from. This account must be a signer.
from_seed
string
required
Seed string used to derive from.
to
Base58-encoded public key (string)
required
The recipient account.
lamports
uint64
required
Amount to transfer, in lamports. 1 SOL = 1,000,000,000 lamports.

Response

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

Code Examples

resp, err := client.TransferWithSeed(ctx, &system_v1.TransferWithSeedRequest{
    From:      "YOUR_DERIVED_SENDER_ADDRESS",
    FromBase:  "YOUR_BASE_ADDRESS",
    FromSeed:  "my-seed",
    To:        "YOUR_RECIPIENT_ADDRESS",
    Lamports:  500_000_000, // 0.5 SOL
})
if err != nil {
    log.Fatal(err)
}
// Add instruction to your transaction
instruction := resp.Instruction