tx_search - Cosmos
tx_search. Explore how to search for transactions
tx_search - Cosmos [Value: 20CU]
Retrieves how to search for transactions
Use cases
- Search for transactions using custom query criteria
- Retrieve transaction details based on specific conditions
- Analyze transaction outcomes and associated events
Constraints
- Query syntax must be accurate
- Results may vary depending on prove flag
- Search results are limited to specified range
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": "tx_search",
"params": ["YOUR_QUERY", PROVE, "1", "30", "ORDER_BY"],
"id": 1
}'
Response
200
{
"jsonrpc": "2.0",
"result": {
"txs": [
{
"hash": "0x29452510AC68D7C63E3B45024BE446DB03A3CFCC595AA88723C4DE4C8DB57956",
"height": "20431584",
"index": 0,
"tx_result": {
"code": 0,
"log": "Transaction processed successfully",
"info": "",
"gas_wanted": "200000",
"gas_used": "150000",
"events": [
{
"type": "transfer",
"attributes": [
{
"key": "sender",
"value": "cosmos1..."
},
{
"key": "recipient",
"value": "cosmos1..."
},
{
"key": "amount",
"value": "1000uatom"
}
]
}
]
},
"tx": "Base64-encoded transaction data"
}
],
"total_count": 1
},
"id": 1
}
Request params
idinteger
jsonrpcstring
methodstring
object
querystring
The search query to filter transactions. The query string can include conditions based on transaction attributes.
proveboolean
Indicates whether a proof of the transactions should be included in the response. If true, Merkle proofs are provided.
pageinteger
The page number to retrieve in a paginated result set.
per_pageinteger
The number of transactions to display per page in a paginated result set.
order_bystring
The order in which to sort the transactions. Valid values are 'asc' for ascending and 'desc' for descending.
Response
200
Containing the list of transactions that match the search queryResponse params
object
idinteger
jsonrpcstring
resultobject
object
total_countinteger
The total number of transactions that match the search criteria.
txsarray
An array of transactions that match the search criteria.
object
hashstring
The hash of the transaction.
heightstring
The block height at which the transaction was included.
indexinteger
The index of the transaction within the block.
tx_resultobject
The result of executing the transaction, including logs, codes, and gas information.
object
codeinteger
The response code indicating the result of the transaction execution. A code of 0 indicates success.
datastring
Any data returned by the transaction execution.
logstring
The log output from the transaction execution, providing details about events and messages.
infostring
Additional information related to the transaction execution.
gas_wantedstring
The amount of gas requested by the transaction.
gas_usedstring
The amount of gas actually used by the transaction.
eventsarray
An array of events emitted by the transaction during execution.
object
typestring
The type of event emitted.
attributesarray
Key-value pairs providing additional information about the event.
object
keystring
The key of the attribute.
valuestring
The value of the attribute.
codespacestring
The namespace for the error code, if any.
txobject
The actual transaction data, typically encoded in base64.
object
typestring
The type of the transaction.
valueobject
The transaction's value, which includes all its fields and data.
proofobject
The Merkle proof for the transaction, included if requested.
object
root_hashstring
The root hash of the Merkle tree for the block.
datastring
The transaction data used in the Merkle proof.
proofobject
Details of the proof structure, including the hashes and paths used to verify the transaction's inclusion.
object
totalstring
The total number of leaf nodes in the Merkle tree.
indexstring
The index of the transaction within the Merkle tree.
leaf_hashstring
The hash of the transaction leaf node.
auntsarray
The sibling hashes on the path from the transaction leaf to the root.