block_search - Cosmos
block_search. Learn how to effectively search for blocks
block_search - Cosmos [Value: 20CU]
Retrieves how to effectively search for blocks
Use cases
- Search for blocks matching specific criteria
- Audit blockchain activity within a specific range
- Filter blocks by attributes for targeted analysis
Constraints
- Performance impact with complex queries
- Query results depend on node indexing
- Potential rate limiting on public RPC endpoints
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": "block_search",
"params": ["YOUR_QUERY", PROVE, "1", "30", "ORDER_BY"],
"id": 1
}'
Response
200
{
"jsonrpc": "2.0",
"result": {
"total_count": "1",
"blocks": [
{
"block_id": {
"hash": "0x1234567890ABCDEF...",
"parts": {
"total": 1,
"hash": "0xABCDEF1234567890..."
}
},
"block": {
"header": {
"version": {
"block": "11",
"app": "0"
},
"chain_id": "cosmoshub-4",
"height": "20431584",
"time": "2022-10-12T10:55:50.385Z",
"last_block_id": {
"hash": "0x1234567890...",
"parts": {
"total": 1,
"hash": "0x9876543210..."
}
},
"last_commit_hash": "0xABCDE12345...",
"data_hash": "0x56789ABCDEF...",
"validators_hash": "0x123456789ABC...",
"next_validators_hash": "0xDEF123456789...",
"consensus_hash": "0xABCDEF123456...",
"app_hash": "0x12345ABCDEF...",
"last_results_hash": "0xFEDCBA54321...",
"evidence_hash": "0x98765ABCDE...",
"proposer_address": "12345ABCDE..."
},
"data": {
"txs": [
"ABCDEFG1234567890..."
]
},
"evidence": {
"evidence": []
},
"last_commit": {
"height": "20431583",
"round": 0,
"block_id": {
"hash": "0xQRSTU1234567890...",
"parts": {
"total": 1,
"hash": "0xVWXYZ1234567890..."
}
},
"signatures": [
{
"block_id_flag": 2,
"validator_address": "ABCDEFGH1234567...",
"timestamp": "2022-10-12T10:55:50.385Z",
"signature": "12345ABCDE..."
}
]
}
}
}
]
},
"id": 1
}
Request params
idinteger
jsonrpcstring
methodstring
object
querystring
The query string used to search for blocks. This should follow the Tendermint query format (e.g., 'tx.height=5').
pageinteger
The page number of the result set to retrieve. Used for pagination.
per_pageinteger
The number of blocks to return per page. Used for pagination.
order_bystring
The order in which results should be returned. Valid values are 'asc' for ascending and 'desc' for descending order.
Response
200
Contains the result of the block search queryResponse params
object
idinteger
jsonrpcstring
resultobject
Contains the result of the block search query, including the blocks found and pagination details.
object
total_countinteger
The total number of blocks that match the query.
page_numberinteger
The current page number of the results.
page_totalinteger
The total number of pages available for the query.
limitinteger
The number of blocks returned per page.
blocksarray
An array containing the blocks that match the query.
object
block_idobject
The unique identifier of the block.
object
hashstring
The unique hash of the block.
partsobject
Information about block parts.
object
totalinteger
The total number of parts in the block.
hashstring
The hash of the block parts.
blockobject
Details of the block itself.
object
headerobject
Header information of the block.
object
versionobject
The version information of the block.
object
blockstring
The version of the block.
appstring
The version of the application.
chain_idstring
The identifier of the blockchain.
heightstring
The height of the block in the blockchain.
timestring
The timestamp when the block was created.
last_block_idobject
The ID of the previous block.
object
hashstring
The hash of the previous block.
partsobject
Information about the parts of the previous block.
object
totalinteger
The total number of parts in the previous block.
hashstring
The hash of the parts of the previous block.
last_commit_hashstring
The hash of the last commit.
data_hashstring
The hash of the block's data.
validators_hashstring
The hash of the validators set for this block.
next_validators_hashstring
The hash of the next validators set.
consensus_hashstring
The hash of the consensus.
app_hashstring
The hash of the application state after this block.
last_results_hashstring
The hash of the results of the last block.
evidence_hashstring
The hash of any evidence of misbehavior.
proposer_addressstring
The address of the block proposer.
dataobject
The transactions contained in the block.
object
txsarray
An array of transactions included in the block.
evidenceobject
Evidence of any malicious behavior.
object
evidencearray
Array of evidence.
object
last_commitobject
Information about the last commit.
object
heightstring
The height of the block that was committed.
roundinteger
The round number of the last commit.
block_idobject
The block ID that was committed.
object
hashstring
The hash of the committed block.
partsobject
The parts of the committed block.
object
totalinteger
The total number of parts of the committed block.
hashstring
The hash of the parts of the committed block.
signaturesarray
Array of signatures for the last commit.
object
block_id_flaginteger
Flag indicating the block ID.
validator_addressstring
The address of the validator.
timestampstring
The timestamp of the signature.
signaturestring
The signature of the validator.