Broadcast modes
After signing, CometBFT accepts the tx via RPC broadcast_tx_* methods. CosmJS signAndBroadcast uses sync by default and waits for CheckTx.
- Web
- React Native
- Flutter (CosmJS)
import { assertIsDeliverTxSuccess } from '@cosmjs/stargate';
const result = await client.signAndBroadcast(sender, [msg], 'auto');
assertIsDeliverTxSuccess(result);
console.log(result.transactionHash, result.height);
assertIsDeliverTxSuccess(result);
// Poll REST /cosmos/tx/v1beta1/txs/{hash} if you need deliver confirmation on slow RPC
import { assertIsDeliverTxSuccess } from '@cosmjs/stargate';
const result = await client.signAndBroadcast(sender, [msg], 'auto');
assertIsDeliverTxSuccess(result);
Broadcast modes
| Mode | Behavior |
|---|---|
sync | Returns after CheckTx (CosmJS default) |
async | Returns immediately after mempool accept |
block | Waits until tx is included in a block |
Common errors
| Error | Cause | Fix |
|---|---|---|
account sequence mismatch | Stale sequence | Re-fetch account, rebuild tx |
insufficient fees | Below globalfee min | Use 0.05usaf gas prices |
out of gas | Gas limit too low | Simulate with higher adjustment |
Offline and multisig
Generate an unsigned tx for hardware or multisig co-signers:
safrochaind tx bank send ... --generate-only > unsigned.json
Full flag reference: CLI tx.