SigningStargateClient.
Prerequisites
- Node.js v22 or later
@cosmjs/stargateand@cosmjs/proto-signinginstalled- An RPC endpoint for the target chain
Set Up a Signing Client
Create a wallet and connect a signing client. This example uses a mnemonic-based wallet for simplicity — see Local Wallets and Injected Wallets for production options.gasPrice in the client options enables "auto" fee estimation for all transactions. Without it, you must pass an explicit StdFee to every transaction method.
Transaction Lifecycle
Every transaction follows these steps:- Build messages — describe what the transaction should do
- Estimate gas — simulate execution to determine fees
- Sign — produce a cryptographic signature over the transaction bytes
- Broadcast — send the signed transaction to a node
- Confirm — wait for the transaction to be included in a block
Convenience Methods
SigningStargateClient provides high-level methods for the most common transactions. They construct the message internally and call signAndBroadcast:
These convenience methods accept the same three fee forms —
"auto", a number multiplier, or an explicit StdFee.
Next Steps
Building Messages
Construct message objects for token transfers, staking, and multi-message transactions.
Simulating Gas
Estimate gas with auto fees, manual simulation, or explicit fee objects.
Signing & Broadcasting
Sign and broadcast transactions, or separate the two steps for advanced workflows.
Waiting for Confirmation
Configure polling timeouts and handle transactions that take too long.
Error Handling
Handle CheckTx rejections, execution failures, and timeouts.
Events & Lookups
Read transaction events and look up past transactions by hash or query.