broadcast_tx_sync

Returns with the response from CheckTx. Does not wait for DeliverTx result.

If you want to be sure that the transaction is included in a block, you can subscribe for the result using JSONRPC via a websocket. See https://docs.cometbft.com/v0.34/core/subscription.html If you haven't received anything after a couple of blocks, resend it. If the same happens again, send it to some other node. A few reasons why it could happen:

  1. malicious node can drop or pretend it had committed your tx
  2. malicious proposer (not necessary the one you're communicating with) can drop transactions, which might become valid in the future (https://github.com/tendermint/tendermint/issues/3322)

Please refer to https://docs.cometbft.com/v0.34/core/using-cometbft.html#formatting for formatting/encoding rules.

Parameters

  • OBJECT - parameters
    • hash: STRING - base64 encoded transaction hash to retrieve

      πŸ“˜

      Tip

      To pass a transaction hash as a parameter in JSON RPC, you need to convert the transaction hash from hexadecimal format to base64 format. Since the transaction hash is already in hexadecimal format, you first need to decode it into bytes and then convert it to base64 format.

      You can easily convert hex to base64 at once here.

curl https://cosmos-mainnet-archive.allthatnode.com:26657/8U3JLUhzIDg3GShvy9hkCCSYkLGc11kj \
--header "Content-Type: application/json" \
--data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "broadcast_tx_sync",
  "params": {
    "tx": "b0XPyHNC8jIvYhQL6u2ZHav5HU6kDalNvYvd5yxJgok="
  }
}'

Returns

  • OBJECT - Transaction information
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "code": 2,
        "data": "",
        "log": "expected 2 wire type, got 7: tx parse error",
        "codespace": "sdk",
        "hash": "667E3D959BE2F5E6A2A741DA09DC4833E417E2D516D250AEC33F3D9CEF35C0D1"
    }
}

Try Yourself

Language
Click Try It! to start a request and see the response here!