Skip to main content

Sign Transaction

Sign Solana transactions without broadcasting them to the network. This is useful for advanced use cases like off-chain transaction batching, meta-transactions, or custom transaction submission workflows.

Overview

Signing transactions without sending allows you to:
  • Batch transactions: Collect multiple signed transactions before submitting
  • Off-chain processing: Sign now, broadcast later
  • Custom submission: Use custom RPC logic or transaction relayers
  • Transaction inspection: Review signed transaction data before broadcasting
Unlike sendTransaction which signs and broadcasts immediately, signTransaction only signs the transaction and returns it for you to broadcast separately.

Signing vs Sending

React SDK

To sign a transaction, use the signTransaction method from the useSignTransaction hook:

Parameters

Transaction | VersionedTransaction
required
The Solana transaction to sign. Can be either a legacy Transaction or VersionedTransaction from @solana/web3.js.Example:

Options Object

The second parameter is an optional configuration object:
object
Configuration for the signing confirmation modal.

Hook Callbacks

(result: { signedTransaction: Uint8Array }) => void
Callback executed after successful signing. Receives the signed transaction as Uint8Array.
(error: Error) => void
Callback executed if signing fails or user cancels.

Returns

Uint8Array
The signed transaction as a Uint8Array. This can be serialized and broadcast to the network.

Complete Examples

Sign and Broadcast Later

Batch Transaction Signing

Broadcasting Signed Transactions

After signing a transaction, you can broadcast it using Solana’s connection:

With Custom Commitment

Transaction Serialization

Serialize to Base64

Deserialize from Base64

UI Customization

Customize the signing modal:

Hide Modal

Hiding the modal removes the user’s ability to review the transaction before signing. Only use this for trusted operations or after obtaining explicit user consent.

Best Practices

Always fetch a recent blockhash before signing:
Always specify the fee payer:
If storing signed transactions, use secure storage:
Signed transactions can expire if blockhash is old:
Check transaction validity before signing:
Always wait for confirmation after broadcasting:

Troubleshooting

Signed transactions expire if blockhash is too old:
Ensure transaction is properly constructed:
Use proper serialization/deserialization:
Handle cancellations gracefully:

Send Transaction

Sign and broadcast transactions

Sign Message

Sign messages with Solana wallet

Solana Web3.js

Official Solana JavaScript library

Transaction Format

Solana transaction structure

Next Steps