Skip to main content

Broadcast modes

After signing, CometBFT accepts the tx via RPC broadcast_tx_* methods. CosmJS signAndBroadcast uses sync by default and waits for CheckTx.

import { assertIsDeliverTxSuccess } from '@cosmjs/stargate';

const result = await client.signAndBroadcast(sender, [msg], 'auto');
assertIsDeliverTxSuccess(result);
console.log(result.transactionHash, result.height);

Broadcast modes

ModeBehavior
syncReturns after CheckTx (CosmJS default)
asyncReturns immediately after mempool accept
blockWaits until tx is included in a block

Common errors

ErrorCauseFix
account sequence mismatchStale sequenceRe-fetch account, rebuild tx
insufficient feesBelow globalfee minUse 0.05usaf gas prices
out of gasGas limit too lowSimulate 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.

Next