getBlockTransaction

Cosmos RPC

Overview

The getBlockTransaction method is used to retrieve detailed information about a specific transaction within a Cosmos block, utilizing the transaction's unique identifier and the block's identifier.

Description

Retrieve a specific transaction by its identifier from a Cosmos block. This request needs to specify the block by its hash or index and the transaction by its hash. If the transaction is found within the specified block, its details are returned.

Request Parameters

NameTypeRequiredDescription
networkIdentifierobjectYesIdentifies the Cosmos blockchain and network details.
blockchainstring (from networkIdentifier)YesThe blockchain identifier, typically "cosmos".
networkstring (from networkIdentifier)YesThe network name on which the transaction is taking place.
subNetworkIdentifierobject (from networkIdentifier)NoOptional sub-network identifier object.
networkstring (from subNetworkIdentifier)YesThe name of the sub-network within Cosmos.
metadataobject (from subNetworkIdentifier)NoMetadata associated with the sub-network.
blockIdentifierobjectYesThe identifier of the block to fetch. Can be by hash or height.
indexnumber (from blockIdentifier)NoThe height of the block (optional if hash is provided).
hashstring (from blockIdentifier)NoThe hash of the block (optional if index is provided).
transactionIdentifierobjectYesIdentifies the transaction within the specified block.
hashstringYesThe hash of the transaction.

Returns

FieldDescription
transactionThe details of the requested transaction.
transaction_identifierThe unique identifier of the transaction.
operationsA list of operations involved in the transaction.

Example Result

{
  "transaction": {
    "transaction_identifier": {
      "hash": "TRANSACTION_HASH"
    },
    "operations": [
      {
        "operation_identifier": {
          "index": 0
        },
        "type": "TRANSFER",
        "status": "SUCCESS",
        "account": {
          "address": "cosmos1..."
        },
        "amount": {
          "value": "-1000",
          "currency": {
            "symbol": "ATOM",
            "decimals": 6
          }
        }
      }
    ]
  }
}

Request Example

curl --location 'https://api.tatum.io/v3/blockchain/node/cosmos-mainnet/block/transaction' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
  "network_identifier": {
    "blockchain": "cosmos",
    "network": "mainnet"
  },
  "block_identifier": {
    "hash": "0x1f2cc6c5027d2f201a5453ad1119574d2aed23a392654742ac3c78783c071f85"
  },
  "transaction_identifier": {
    "hash": "TRANSACTION_HASH"
  }
}
import { TatumSDK, Cosmos, Network } from "@tatumio/tatum";

const cosmos = await TatumSDK.init<Cosmos>({ network: Network.COSMOS_MAINNET });

const transactionDetails = await tatum.rpc.getBlockTransaction({
  networkIdentifier: {
    blockchain: "cosmos",
    network: "mainnet",
  },
  blockIdentifier: {
    index: 19865674,
  },
  transactionIdentifier: {
    hash: "TRANSACTION_HASH",
  },
});

console.log("Transaction Details:", transactionDetails);

await tatum.destroy();