searchTransactions

Cosmos RPC

Overview

The searchTransactions method allows you to search for transactions matching a set of provided conditions in canonical blocks. This can be useful for querying transaction data based on various criteria.

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.
operatorenumNoConditions or and and for complex queries.
max_blocknumberNoThe largest block index to consider.
offsetnumberNoThe offset into the result set to start returning transactions.
limitnumberNoThe maximum number of transactions to return.
transactionIdentifierobjectNoIdentifies the transaction by hash.
hashstring (from transactionIdentifier)YesThe hash of the transaction.
accountIdentifierobjectNoInformation about the account involved.
addressstring (from accountIdentifier)YesThe Cosmos account address associated with the operation.
sub_accountobject (from accountIdentifier)NoOptional sub-account object.
metadataobject (from accountIdentifier)NoMetadata for the account.
coinIdentifierobjectNoConditions for coin identifier.
identifierstring (from coinIdentifier)YesA globally unique identifier of a Coin.
currencyobjectNoSpecifies the currency details.
symbolstring (from currency)YesThe symbol or code of the currency.
decimalsnumber (from currency)YesThe number of decimal places for the currency.
statusstringNoThe network-specific operation status type.
typestringNoThe network-specific operation type.
addressstringNoAccount address for transaction search.
successbooleanNoA synthetic condition indicating success.

Returns

FieldDescription
transactionsA list of transactions that match the search criteria.

Example Result

{
  "transactions": [
    {
      "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
            }
          }
        }
      ]
    }
  ],
  "total_count": 5,
  "next_offset": 5
}

Request Example

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

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

const transactions = await cosmos.rpc.searchTransactions({
  networkIdentifier: {
    blockchain: "cosmos",
    network: "mainnet",
  },
});

// Log the retrieved transactions
console.log("Transactions:", transactions);

// Always destroy the Tatum SDK instance when done to stop any background processes
await tatum.destroy();