Blocks
The blocks field allows us to fetch details about the blocks from Cosmos blockchain.
Here is an example that demonstrates how to retrieve blocks data:
{
cosmos {
blocks(
date: {after: "2023-08-06"}
options: {desc: "timestamp.iso8601", limit: 10}
) {
hash
header
height
metadata
proposer {
address
}
timestamp {
iso8601
}
}
}
}
Filtering Blocks
Blocks data can be filtered using following arguments:
any: A catch-all filter (OR logic) that can be used to filter the results by any of the other fields.date: filter by date of block creationhash: filter by block hashheight: filter by block heightoptions: filter returned data by ordering, limiting, and constraining itproposer: filter by address of block proposertime: filter by time of block creation
any: catch-all field that can be used to fetch the results by any of the other fieldscount: returns count and other metricscountBigInt: returns count and other metrics as BigIntdate: returns date when block is createdexpression: performs arithematic operation on fields in the query and returns value of the operationhash: returns block hashheader: returns block headermaximum: returns maximum for selected measurable field of Cosmos blocksmetadata: returns metadata of blockminimum: returns minimum for selected measurable field of Cosmos blocksproposer: returns address and annotation (if available) of block proposertimestamp: returns block timestamp