blockchain - Cosmos
blockchain. Understand how to access a range of block data within a specific height range
blockchain - Cosmos [Value: 20CU]
Retrieves a range of block data within a specific height range
Use cases
- Retrieve a range of block headers
- Analyze blockchain activity over multiple blocks
- Verify block integrity across a range
Constraints
- Performance impact with large ranges
- Data inconsistency during chain reorganizations
- 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": "blockchain",
"params": [20431584, 20431604],
"id": 1
}'
Response
200
{
"jsonrpc": "2.0",
"result": {
"last_height": "20431604",
"block_metas": [
{
"block_id": {
"hash": "0x1234567890ABCDEF...",
"parts": {
"total": 1,
"hash": "0xABCDEF1234567890..."
}
},
"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..."
}
}
// Other blocks would be included here
]
},
"id": 1
}
Request params
idinteger
jsonrpcstring
methodstring
object
minHeightstring
The minimum block height to start retrieving blocks from.
maxHeightstring
The maximum block height to stop retrieving blocks at.
Response
200
The parameters used to retrieve blocks within a specific height range from the blockchainResponse params
object
idinteger
jsonrpcstring
resultobject
Contains the information about the blockchain from the specified block height range, including the blocks' metadata and block IDs.
object
last_heightstring
The height of the last block in the requested range.
block_metasarray
An array containing metadata for each block in the range.
object
block_idobject
The unique identifier of the block.
object
hashstring
The unique hash of the block.
partsobject
Information about the parts of the block.
object
totalinteger
The total number of parts in the block.
hashstring
The hash of the block parts.
headerobject
Header information for 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.