Returns with the responses from CheckTx and DeliverTx.
IMPORTANT
Use only for testing and development. In production, use
broadcast_tx_sync
orbroadcast_tx_async
. You can subscribe for the transaction result using JSONRPC via a websocket. See https://docs.cometbft.com/v0.34/core/subscription.html
CONTRACT: only returns error if mempool.CheckTx() errs or if we timeout waiting for tx to commit.
If check_tx
or deliver_tx
fail, no error will be returned, but the returned result will contain a non-OK ABCI code.
Please refer to https://docs.cometbft.com/v0.34/core/using-cometbft.html#formatting for formatting/encoding rules.
Parameters
OBJECT
- parameterstx
:STRING
- base64 encoded transaction hash to retrieveTip
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_commit",
"params": {
"tx": "b0XPyHNC8jIvYhQL6u2ZHav5HU6kDalNvYvd5yxJgok="
}
}'
Returns
OBJECT
- Transaction information
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"check_tx": {
"code": 2,
"data": null,
"log": "expected 2 wire type, got 7: tx parse error",
"info": "",
"gas_wanted": "0",
"gas_used": "13350",
"events": [],
"codespace": "sdk",
"sender": "",
"priority": "0",
"mempoolError": ""
},
"deliver_tx": {
"code": 0,
"data": null,
"log": "",
"info": "",
"gas_wanted": "0",
"gas_used": "0",
"events": [],
"codespace": ""
},
"hash": "667E3D959BE2F5E6A2A741DA09DC4833E417E2D516D250AEC33F3D9CEF35C0D1",
"height": "0"
}
}