/cosmos/tx/v1beta1/txs - TAC
Example code for the broadcast tx JSON-RPC method. Complete guide on how to use broadcast tx JSON-RPC in GetBlock Web3 documentation.
Broadcasts a signed, protobuf-encoded transaction. The body carries the base64 tx_bytes and a broadcast mode (SYNC, ASYNC, or BLOCK).
Endpoint
POST /cosmos/tx/v1beta1/txsExample
export TAC_REST=https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/
curl -X POST "${TAC_REST}cosmos/tx/v1beta1/txs" \
-H "Content-Type: application/json" \
-d '{"tx_bytes": "Cr4BCr...base64-encoded-tx", "mode": "BROADCAST_MODE_SYNC"}'Response
{
"tx_response": {
"height": "0",
"txhash": "9A1B2C...",
"code": 0,
"raw_log": "",
"gas_wanted": "200000",
"gas_used": "42000"
}
}Response Fields
tx_response.txhash
string
The transaction hash
tx_response.code
number
Result code (0 = accepted)
tx_response.raw_log
string
Log or error message
tx_response.gas_used
string
Gas used
Use Cases
Submission: Broadcast a signed Cosmos transaction
Mode choice: Use SYNC for mempool confirmation, ASYNC for fire-and-forget
Error Handling
400 / Bad request
Bad request
A path, query, or body parameter was invalid
404 / Not found
Not found
The account, validator, proposal, or resource does not exist
403 / RBAC: access denied
Access denied
The GetBlock access token is missing or incorrect
Was this helpful?