Solana

Solana Transactions

Build, sign, and broadcast Solana transactions, and construct transfer and nonce account instructions with Zafeguard Solana components.

Solana Transactions

Components for building, signing, and broadcasting Solana transactions, including SOL/SPL transfers and durable nonce account setup.

Public RPC URLs enforce rate limits per IP address and can fail under concurrent load. Use a private endpoint (Helius, Alchemy, or self-hosted). See Connecting to Solana.


BROADCAST_SOLANA_TRANSACTION

BROADCAST_SOLANA_TRANSACTION Workflow Component

Broadcasts a fully-signed Solana transaction to the network and returns the transaction signature.

Config

None.

Inputs

FieldTypeDescription
jsonRpcUrlstring (URL)Solana JSON-RPC endpoint URL
signedTransactionstring (base64)Base64-encoded signed transaction

Outputs

FieldTypeDescription
transactionSignaturestring (base58)Transaction signature (txid) — directly usable in Solana explorers

SDK example

import { WorkspaceClient, ComponentModule } from '@zafeguard/caller-sdk';
const workspace = new WorkspaceClient({ apiKey: process.env.ZAFEGUARD_API_KEY! });

const result = await workspace.call(ComponentModule.BROADCAST_SOLANA_TRANSACTION, {
  jsonRpcUrl: 'https://api.mainnet-beta.solana.com',
  signedTransaction: 'AQAAAAAAAABh...',
}).promise();
console.log(result.transactionSignature);

BUILD_SOLANA_TRANSACTION

BUILD_SOLANA_TRANSACTION Workflow Component

Builds an unsigned Solana transaction with SOL transfer and/or custom program instructions. Supports durable nonce auto-detection, gas sponsorship via a separate fee payer, and fee deduction.

Config

FieldTypeRequiredDefaultDescription
deductFeebooleanNofalseWhen true, subtracts the transaction fee from the lamports amount. Only applies when from equals feePayer. Ignored for gas sponsorship

Inputs

FieldTypeDescription
jsonRpcUrlstring (URL)Solana JSON-RPC endpoint
feePayerstring (base58)Public key of the account paying transaction fees
fromstring | null (base58)Public key of the account sending SOL. Defaults to feePayer. Set differently for gas sponsorship
tostring | null (base58)Recipient public key for SOL transfer. Leave null if only using instructions
lamportsstringAmount to transfer in lamports (1 SOL = 1,000,000,000). Decimal or 0x hex. Default "0"
instructionsInstruction[]Custom program instructions (default [])
nonceAccountstring | null (base58)Durable nonce account public key. If provided, nonce is auto-fetched and a nonceAdvance instruction is prepended. Leave null for recent blockhash
priorityFeeMicroLamportsnumber | nullOptional priority fee per compute unit, in micro-lamports. When provided, a ComputeBudgetProgram.setComputeUnitPrice instruction is prepended to the transaction. Solana's base fee (~5,000 lamports per signature) is set by the protocol — this controls how the validator orders your tx under load. Pass null to use the network default. See Customizing Transaction Fees for typical priority-fee ranges

Outputs

FieldTypeDescription
unsignedTransactionstring (base64)Base64-encoded unsigned transaction
serializedHashstring (hex)Transaction message hash each signer must sign with Ed25519
signersstring[]Base58 public keys that must sign (fee payer + instruction signers)
estimatedFeestring (decimal)Estimated transaction fee in lamports, fetched via connection.getFeeForMessage

Instruction type

{
  programId: string;            // base58 program ID
  keys: Array<{
    pubkey: string;             // base58
    isSigner: boolean;
    isWritable: boolean;
  }>;
  data: string | null;          // hex-encoded instruction data
}

SDK example

import { WorkspaceClient, ComponentModule } from '@zafeguard/caller-sdk';
const workspace = new WorkspaceClient({ apiKey: process.env.ZAFEGUARD_API_KEY! });

const result = await workspace.call(ComponentModule.BUILD_SOLANA_TRANSACTION, {
  jsonRpcUrl: 'https://api.mainnet-beta.solana.com',
  feePayer: 'FEEPAYERpubkey...',
  from: null,
  to: 'RECIPIENTpubkey...',
  lamports: '1000000000',
  instructions: [],
  nonceAccount: null,
  priorityFeeMicroLamports: null, // or e.g. 50_000 micro-lamports per CU for faster inclusion
}).promise();
console.log(result.unsignedTransaction);
console.log(result.serializedHash); // sign this
console.log(result.signers);

SIGN_SOLANA_TRANSACTION

SIGN_SOLANA_TRANSACTION Workflow Component

Applies one or more Ed25519 signatures to an unsigned Solana transaction. Supports multi-party signing for gas sponsorship and multi-sig workflows.

Config

None.

Inputs

FieldTypeDescription
unsignedTransactionstring (base64)Base64-encoded unsigned transaction
signaturesSignaturePair[]Array of { publicKey, signature } pairs

Outputs

FieldTypeDescription
signedTransactionstring (base64)Base64-encoded fully-signed transaction, ready to broadcast

SignaturePair type

{
  publicKey: string;   // base58 (32–44 chars)
  signature: string;   // hex (128 chars or 130 with 0x prefix)
}

BUILD_SOLANA_TRANSFER_INSTRUCTION

BUILD_SOLANA_TRANSFER_INSTRUCTION Component

Builds transfer instructions for native SOL or SPL tokens. When tokenMint is provided, auto-resolves Associated Token Accounts (ATAs) and creates the destination ATA if needed. When tokenMint is null, builds a native SOL transfer.

Config

None.

Inputs

FieldTypeDescription
jsonRpcUrlstring (URL)Solana JSON-RPC endpoint
fromstring (base58)Sender public key
tostring (base58)Recipient public key
amountstringAmount in smallest unit (lamports for SOL, raw amount for SPL tokens). Decimal or 0x hex
tokenMintstring | null (base58)SPL token mint address. null for native SOL

Outputs

FieldTypeDescription
instructionsInstruction[]Instructions to pass into BUILD_SOLANA_TRANSACTION

SDK example

import { WorkspaceClient, ComponentModule } from '@zafeguard/caller-sdk';
const workspace = new WorkspaceClient({ apiKey: process.env.ZAFEGUARD_API_KEY! });

// SOL transfer instructions
const result = await workspace.call(ComponentModule.BUILD_SOLANA_TRANSFER_INSTRUCTION, {
  jsonRpcUrl: 'https://api.mainnet-beta.solana.com',
  from: 'FROMpubkey...',
  to: 'TOPubkey...',
  amount: '500000000',
  tokenMint: null,
}).promise();
console.log(result.instructions);

BUILD_SOLANA_NONCE_ACCOUNT_INSTRUCTION

BUILD_SOLANA_NONCE_ACCOUNT_INSTRUCTION Component

Builds instructions to create and initialize a durable nonce account. Pass the output instructions into BUILD_SOLANA_TRANSACTION.

Config

None.

Inputs

FieldTypeDescription
jsonRpcUrlstring (URL)Solana JSON-RPC endpoint (used to fetch minimum rent-exempt balance)
feePayerstring (base58)Account funding the nonce account creation
nonceAccountstring (base58)Public key of the new nonce account (must be a fresh keypair)
nonceAuthoritystring | null (base58)Account authorized to use the nonce. Defaults to feePayer when null

Outputs

FieldTypeDescription
instructionsInstruction[]createAccount + nonceInitialize instructions

Transaction flow (SOL transfer)

GET_SOLANA_DERIVATION_PATH


  (external signing)
  → public key


COMPUTE_SOLANA_ADDRESS         BUILD_SOLANA_TRANSFER_INSTRUCTION
         │                                    │ instructions
         │                                    ▼
         └────────────▶ BUILD_SOLANA_TRANSACTION
                                 │ serializedHash

                        (external signing)
                           │ signature

              BUILD_SOLANA_SIGNATURE_PAIR_ITEM
                           │ item

                 SIGN_SOLANA_TRANSACTION
                           │ signedTransaction

              BROADCAST_SOLANA_TRANSACTION

On this page