broadcast_tx_sync - Cosmos

Example code for the broadcast_tx_sync JSON-RPC method. Complete guide on how to use broadcast_tx_sync JSON-RPC in GetBlock Web3 documentation.

Broadcasts a signed transaction and returns after CheckTx is run (synchronous mempool admission). The transaction is in the mempool when this returns, but not yet committed in a block. Recommended for most submission flows.

Parameters

Parameter
Type
Required
Description

tx

string

Yes

Base64-encoded signed transaction bytes

Request Example

# JSON-RPC over HTTP POST (canonical)
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/broadcast_tx_sync' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "broadcast_tx_sync",
    "params": {
        "tx": "Co0BCooBChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEmoKLWNvc21vczF0NnJsZ2Y4MGpkOHRhbnBubnZtbXhmcWRjbTljbjd3Y3RyczdoaxItY29zbW9zMWdoZDc1M3NoamVjajRpdjJ4Mmk4eHJrenphbnpqdnZjMjJ4MmtuGgoKBXVhdG9tEgExEnIKWg=="
    },
    "id": "getblock.io"
}'

# URI over HTTP GET (alternate, for simple methods)
curl --location --request GET 'https://go.getblock.io/<ACCESS-TOKEN>/broadcast_tx_sync?tx="Co0BCooBChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEmoKLWNvc21vczF0NnJsZ2Y4MGpkOHRhbnBubnZtbXhmcWRjbTljbjd3Y3RyczdoaxItY29zbW9zMWdoZDc1M3NoamVjajRpdjJ4Mmk4eHJrenphbnpqdnZjMjJ4MmtuGgoKBXVhdG9tEgExEnIKWg=="'

Response Example

Response Parameters

Field
Type
Description

result.code

integer

ABCI response code from CheckTx — 0 if accepted into the mempool

result.log

string

Log message (empty on success)

result.codespace

string

Module codespace if the tx was rejected

result.hash

string

Transaction hash — use tx or tx_search to confirm block inclusion

Use Cases

  • Wallet flows submitting signed transactions

  • Smart contract interactions (CosmWasm chains)

  • IBC relayer transaction submission

Error Handling

Status Code
Error Message
Cause

404

Not found

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

-32603

Internal error

Server-side error while processing the request

429

Too Many Requests

Rate limit exceeded for your plan

non-zero result.code

Rejected by CheckTx

Insufficient funds, invalid signature, sequence mismatch, etc.

SDK Integration

Last updated

Was this helpful?