signTransaction on a Viem WalletClient to produce a signed, serialized transaction without submitting it. This is useful when you need to:
- Hand the signed transaction to a relayer or sponsor service for submission.
- Co-sign a multi-step flow before broadcasting atomically.
- Inspect or store the raw signed bytes before sending.
Usage
- JavaScript
- React
Submitting later
The output ofsignTransaction is a serialized, signed transaction (hex). When you’re ready to broadcast it, send it through any RPC — for example, with a Viem PublicClient:
Notes
- The wallet account must be an EVM account. Narrow the type with
isEvmWalletAccountbefore callingcreateWalletClientForWalletAccount. - Some wallet apps refuse to sign without broadcasting — they will surface a user-rejection error in that case. Check the wallet’s UX expectations before relying on this flow in production.
- Signing uses the wallet’s currently active chain. Switch first with
switchActiveNetworkif you need a different one. - Need to estimate fees before signing? See Calculate EVM transaction fee.