tx - Cosmos

Returns a transaction by its hash, with its execution result and (optionally) a Merkle inclusion proof.

Method

tx

Parameters

ParameterTypeDescription
hashstringTransaction hash
provestringInclude a Merkle proof

Example

bashexport COSMOS_TM=https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/

# JSON-RPC over HTTP (POST)
curl -X POST "${COSMOS_TM}" -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": "getblock.io", "method": "tx", "params": {"hash": "0x9A1B2C...", "prove": "true"}}'

# URI over HTTP (GET)
curl "${COSMOS_TM}tx?hash=0x9A1B2C...&prove=true"

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "hash": "9A1B2C...",
        "height": "31378844",
        "index": 0,
        "tx_result": {
            "code": 0,
            "gas_used": "84000",
            "events": []
        },
        "tx": "Cg8K..."
    }
}

Response Fields

FieldTypeDescription
hashstringThe transaction hash
heightstringBlock height of inclusion
tx_resultobjectExecution result: code, gas, events
txstringBase64-encoded transaction bytes

Use Cases

  • Receipt lookup: Resolve a transaction and its result by hash

Error Handling

ErrorMessageDescription
-32600 / Invalid requestInvalid requestThe JSON-RPC envelope was malformed
-32602 / Invalid paramsInvalid paramsA parameter was missing or of the wrong type
403 / RBAC: access deniedAccess deniedThe GetBlock access token is missing or incorrect