broadcast_tx_commit - Cosmos

broadcast_tx_commit. Learn how to broadcast and commit transactions

broadcast_tx_commit - Cosmos [Value: 20CU]
Retrieves how to broadcast and commit transactions
Use cases

Use cases

  • Broadcast and confirm transaction within the same request
  • Ensure transaction is included in the blockchain
  • Validate transaction execution and get immediate feedback
Constraints

Constraints

  • Increased latency due to immediate commit
  • Possible higher resource consumption on nodes
  • Transaction could fail after initial check
Get started
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
curl --location 'https://cosmos-hub.drpc.org' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "method": "broadcast_tx_commit",
    "params": ["YOUR_TRANSACTION"],
    "id": 1
}'
Copy
Response
200
{
  "jsonrpc": "2.0",
  "result": {
    "check_tx": {
      "code": 0,
      "data": "CHECK_TX_DATA",
      "log": "CheckTx passed successfully",
      "info": "",
      "gas_wanted": "200000",
      "gas_used": "150000",
      "events": [],
      "codespace": ""
    },
    "deliver_tx": {
      "code": 0,
      "data": "DELIVER_TX_DATA",
      "log": "DeliverTx passed successfully",
      "info": "",
      "gas_wanted": "200000",
      "gas_used": "150000",
      "events": [],
      "codespace": ""
    },
    "hash": "TX_HASH",
    "height": "100000"
  },
  "id": 1
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersstring
string
txstring
The encoded transaction to be broadcast. The transaction should be base64 encoded.

Response

200
Contains the result of the transaction broadcast

Response params

object
idinteger
jsonrpcstring
resultobject
object
check_txobject
The result of the CheckTx phase, which checks the transaction's validity.
object
codeinteger
The response code of the CheckTx phase. A code of 0 indicates success.
datastring
Any data returned from the CheckTx phase.
logstring
The log output from the CheckTx phase.
infostring
Additional information about the CheckTx phase.
gas_wantedstring
The amount of gas requested for the transaction during the CheckTx phase.
gas_usedstring
The amount of gas actually used by the transaction during the CheckTx phase.
eventsarray
A list of events triggered during the CheckTx phase.
object
typestring
The type of event triggered.
attributesarray
Attributes associated with the event.
object
keystring
The key of the attribute.
valuestring
The value of the attribute.
codespacestring
The namespace for the error code, if any, during the CheckTx phase.
deliver_txobject
The result of the DeliverTx phase, where the transaction is executed.
object
codeinteger
The response code of the DeliverTx phase. A code of 0 indicates success.
datastring
Any data returned from the DeliverTx phase.
logstring
The log output from the DeliverTx phase.
infostring
Additional information about the DeliverTx phase.
gas_wantedstring
The amount of gas requested for the transaction during the DeliverTx phase.
gas_usedstring
The amount of gas actually used by the transaction during the DeliverTx phase.
eventsarray
A list of events triggered during the DeliverTx phase.
object
typestring
The type of event triggered.
attributesarray
Attributes associated with the event.
object
keystring
The key of the attribute.
valuestring
The value of the attribute.
codespacestring
The namespace for the error code, if any, during the DeliverTx phase.
hashstring
The transaction hash, which is unique for each transaction.
heightstring
The height of the block that included this transaction.