Skip to main content
When using Privy’s server-side SDKs to sign transactions, you can use the authorization context to automatically sign requests. Learn more about signing on the server.
Use the signTransaction method exported from the useSignTransaction hook to sign a transaction with a Solana wallet.

Usage

Parameters

Uint8Array
required
The encoded transaction to be signed.
ConnectedStandardSolanaWallet
required
The Solana wallet to use for signing the transaction.
SolanaChain
Type of all Solana chains supported by Privy.
SolanaSignTransactionOptions & {uiOptions?: SendTransactionModalUIOptions}
Additional options for signing the transaction.

Response

Uint8Array
The signed transaction that can be sent to the network.

External wallets that only support signing (not sign-and-send)

Some external wallets connected via wallet_connect_qr_solana (such as Fireblocks) only support signing and do not support sign-and-send. For these wallets, the signedTransaction returned by signTransaction is a raw 64-byte Ed25519 signature, not a fully signed serialized transaction.Passing this value directly to sendTransaction will result in a deserialization error, because the network expects a complete wire transaction (message + signatures), not a bare signature.
To send a transaction signed by one of these wallets, attach the returned signature to the original compiled transaction before encoding and submitting it. Below is a complete example using @solana/kit:
A raw Ed25519 signature is exactly 64 bytes. A serialized Solana transaction is always longer than 64 bytes. Checking the byte length of the signedTransaction response can help determine which type the wallet returned.