Introducing a new way to review your PRs.

Read the announcement

solana-foundation / solana-go

Go SDK library and RPC client for the Solana Blockchain

View on GitHub

26 documents · Updated Nov 16, 2026

docs / transaction-submission

Transaction submission and confirmation

Transaction submission turns a constructed and signed transaction into a cluster result. The RPC client can first simulate the transaction, encode it for the JSON-RPC request, submit it, and then track the returned signature until the cluster reports success or failure. This page complements the RPC client, JSON-RPC transport, and WebSocket subscriptions pages.

Transaction lifecycle

The transaction lifecycle joins local transaction work with two kinds of remote feedback. A transaction carries its message and signatures; the first signature identifies it after submission. The client uses that identifier to distinguish acceptance by an RPC node from later processing by the cluster.

The normal lifecycle is:

  1. Obtain a recent blockhash and use it to construct the transaction.
  2. Sign every required signer position.
  3. Optionally simulate the signed transaction to inspect execution before submission.
  4. Submit the serialized transaction through sendTransaction.
  5. Track the returned signature until the required commitment level is reached.
  6. Treat a non-null execution error as a failed transaction even when the cluster confirms it.

The transaction's recent blockhash limits how long the cluster can accept it. A submission response only means that the RPC service accepted the request. It does not mean that the transaction reached the cluster or completed.

References: transaction.go• L185-227 transaction.go• L524-548 rpc/sendTransaction.go• L27-68 rpc/getLatestBlockhash.go• L25-80

Transaction simulation

Simulation evaluates a transaction against a bank state without submitting it for execution on the cluster. It is useful for checking instruction behavior, logs, fees, compute use, account changes, and return data before a real send.

SimulateTransaction accepts a transaction object and sends its binary form as base64. Its options control signature checks, commitment, recent-blockhash replacement, inner-instruction output, minimum context slot, and selected account output. The default path uses finalized commitment and does not verify signatures, while a caller can enable checks when it needs a closer preflight result.

Simulation reports execution details in SimulateTransactionResult:

ResultMeaning
ErrThe simulation failed or an instruction returned an error.
LogsMessages emitted while the instructions ran.
UnitsConsumedCompute budget used by the simulated transaction.
FeeFee charged by the simulated execution.
PreBalances and PostBalancesBalance changes caused by the simulation.
ReturnDataThe latest return data produced by an instruction.

Simulation does not replace signing and confirmation. A simulation can use a replacement blockhash or skip signature checks, while a live submission must use a valid transaction accepted by the cluster.

References: rpc/simulateTransaction.go• L27-75 rpc/simulateTransaction.go• L83-143 rpc/simulateTransaction.go• L146-193 rpc/…/simulateTransaction.go• L27-80

Transaction encoding and submission

Submission accepts the same signed transaction in three input forms. All forms converge on the JSON-RPC sendTransaction request, which returns the transaction signature used for later tracking.

Input formEntry pointConversion before the RPC call
Transaction objectSendTransactionWithOptsBinary transaction data is encoded as base64.
Raw bytesSendRawTransactionWithOptsBytes are encoded as base64.
Base64 textSendEncodedTransactionWithOptsText is sent as supplied.

The submission options carry the wire encoding, preflight behavior, preflight commitment, retry limit, and minimum context slot. By default, preflight is enabled and the request uses base64 encoding. Preflight checks signatures and simulates the transaction unless the caller sets SkipPreflight.

The client returns the first transaction signature as soon as the RPC service accepts the request. Use the returned signature for status checks; do not interpret the return from SendTransaction as confirmation.

References: rpc/sendTransaction.go• L69-84 rpc/sendRawTransaction.go• L26-54 rpc/sendEncodedTransaction.go• L25-56 rpc/types.go• L610-642 transaction.go• L642-655

Signature status polling

Signature status polling asks the RPC node whether a submitted transaction has reached a chosen cluster state. GetSignatureStatuses accepts one or more signatures and returns a matching status for each signature, so callers can poll after submission when they do not use a WebSocket subscription.

Each status has three important parts:

FieldUse
ConfirmationStatusShows processed, confirmed, or finalized.
ErrShows whether transaction execution failed. A null value means success.
Slot and ConfirmationsLocate processing and show progress when the status is not rooted.

The default lookup searches the recent status cache. Set searchTransactionHistory when a signature is not in that cache and a ledger search is needed. A missing result is exposed as ErrNotFound, so a caller must distinguish “not known yet” from a status that reports execution failure.

Commitment is the required confidence level for the caller. processed is the node's latest view, confirmed has supermajority voting support, and finalized has reached the cluster's final state. The required level should match the business effect that depends on the transaction.

References: rpc/getSignatureStatuses.go• L23-51 rpc/getSignatureStatuses.go• L54-83 rpc/types.go• L509-525

Send-and-confirm flow

The send-and-confirm helper combines RPC submission with WebSocket signature confirmation. It sends the transaction with preflight enabled and finalized preflight commitment, then subscribes to the returned signature at finalized commitment and waits for the terminal notification.

The flow is:

sequenceDiagram
    participant App as Application
    participant RPC as RPC client
    participant Cluster as Cluster
    participant WS as WebSocket client

    App->>RPC: SendTransactionWithOpts(transaction)
    RPC->>Cluster: sendTransaction
    Cluster-->>RPC: transaction signature
    RPC-->>App: signature
    App->>WS: SignatureSubscribe(signature, finalized)
    WS-->>App: terminal signature notification
    App->>App: inspect notification error
    App-->>App: success, execution failure, or timeout

SendAndConfirmTransaction uses a default two-minute wait. The timeout variant lets the caller choose a duration, while the options variant lets the caller control transaction submission options and the timeout. The helper unsubscribes after it receives the terminal notification or after the wait ends.

The helper returns a successful outcome only when the finalized notification has no execution error. A finalized transaction with an instruction error returns confirmed == true together with an error. A context cancellation, subscription error, or timeout returns confirmed == false; timeout is exposed as ErrTimeout.

The WebSocket path is an event-driven alternative to repeated GetSignatureStatuses calls. Use the status method when polling fits the surrounding control flow or when a WebSocket connection is not available.

References: rpc/…/sendAndConfirmTransaction.go• L27-136 rpc/…/signatureSubscribe.go• L33-53 rpc/…/signatureSubscribe.go• L108-196

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the accepted transaction input forms aligned with the base64 wire format used by sendTransaction.
  • Keep the meaning of a submission response separate from the confirmation contract. A returned signature is not a completed transaction.
  • Keep commitment values consistent between preflight, status polling, and WebSocket confirmation when callers expect one level of assurance.
  • Preserve the distinction between an unknown signature, a transport or subscription error, a timeout, and a confirmed transaction with an execution error.
  • If the signature notification shape changes, update both the WebSocket result contract and the send-and-confirm interpretation of Value.Err.

Important failure modes

TriggerConsequenceGuard
The transaction uses an expired recent blockhash before it lands.The RPC node can accept the request but the cluster can reject the transaction.Build and submit with a current blockhash, then track the returned signature.
Preflight simulation or signature checks fail.sendTransaction returns an error and no usable submission result exists.Inspect the simulation result and sign every required signer before sending.
The status cache no longer contains the signature.A normal status lookup reports no known transaction.Use searchTransactionHistory when the application must search the ledger.
A confirmed or finalized notification contains a non-null Err.The transaction reached the requested cluster state but its instructions failed.Check Err after confirmation instead of checking only the commitment level.
The WebSocket does not deliver a terminal notification before the deadline.The helper returns ErrTimeout without claiming confirmation.Set a suitable timeout and use status polling when the subscription path is not reliable.

Key files

FileWhy to read it
transaction.goShows how a constructed transaction becomes signed binary data and how its first signature identifies it.
rpc/simulateTransaction.goDefines the pre-send simulation boundary and the execution data returned to callers.
rpc/sendTransaction.goDefines object-based submission and explains why submission is not confirmation.
rpc/sendEncodedTransaction.goShows the common JSON-RPC submission request for already encoded transactions.
rpc/getSignatureStatuses.goDefines the polling result and the three cluster confirmation levels.
rpc/…/sendAndConfirmTransaction.goConnects submission to finalized WebSocket confirmation and outcome handling.
rpc/…/signatureSubscribe.goDefines the signature notification used by the send-and-confirm flow.
rpc/…/sendTransaction.goDemonstrates the broad build, sign, blockhash, and submit path with a live RPC client.