The blocks field allows us to fetch details about the blocks from Tron network.
Here is an example that demonstrates how to retrieve blocks data:
{
tron {
blocks(
date: {after: "2023-07-23"}
options: {desc: "timestamp.iso8601", limit: 10}
) {
hash
height
parentBlockHash
timestamp {
iso8601
}
txTrieRoot
version
witness {
address
annotation
}
witnessSignature
}
}
}
Filtering Blocks
any:blockHash: filter by hash of the blockdate: filter by date of the blockheight: filter by block heightoptions: filter returned data by ordering, limiting, and constraining it.parentBlockHash: fitler by parent block hashtime: filter by selecting time in range, list or just timeversion: fitler by block versionwitness: filter by block witness
any:count: returns aggregate count of the blockscountBigInt: returns count asBigIntdate: returns date of the blockexpression: performs arithematic operation on fields in the query and returns value of the operationhash: returns block hashheight: returns block heightmaximum: returns maximum of selected measurable field of Tron Blocksminimum: returns minimum of selected measurable field of Tron BlocksparentBlockHash: returns parent block hash for the blocktimestamp: returns timestamp of the blocktxTrieRoot: returns transaction trie root hashversion: returns block versionwitness: returns block witnesswitnessSignature: returns block witness signature