Blocks
The blocks field allows us to retrieve details about blocks from Algorand blockchain.
Here's an example that demonstrates how to fetch information about 10 latest block from Algorand:
{
algorand {
blocks(
options: {desc: "timestamp.iso8601", limit: 10}
date: {after: "2023-07-17T00:00:00Z"}
) {
currentProtocol
hash
height
nextProtocol
nextProtocolApprovals
nextProtocolSwitchOn
nextProtocolVoteBefore
previousBlockHash
proposer {
address
annotation
}
reward
timestamp {
iso8601
}
txnRoot
upgradeApprove
upgradePropose
}
}
}
Filtering Blocks
Blocks can be filtered using the following arguments:
any: A catch-all filter (OR Logic) that can be used to filter the results by any of the other fields.blockHash: Filter by block hashblockReward: Filter by block rewardcurrentProtocol: Filter by current protocol of the blockdate: Filter by date on which block is producedheight: Filter by height of the blocknextProtocol: Filter by next protocol of the blockoptions: Filter returned data by ordering, limiting, and constraining it.proposer: Filter by address block proposer or listtime: Filter by selecting the date in a range, list or just date
any: A catch-all filter (OR Logic) that can be used to filter the results by any of the other fields.count: returns counts and other metricscountBigInt: returns count and other metricscurrentProtocol: returns current protocol versiondate: returns date of the blocksexpression: performs arithematic operation on fields in the query and returns value of the operationfrac: returns value of frac fieldhash: returns block hashheight: returns block heightmaximum: returns maximum of selected measurable field of Algorand blocksminimum: returns minimum of selected measurable field of Algorand blocksnextProtocol: returns the next proposed protocol versionnextProtocolApprovals: returns number of blocks which approved the protocol upgradenextProtocolSwitchOn: returns round on which the protocol upgrade will take effectnextProtocolVoteBefore: returns dealine round for this protocol upgradepreviousBlockHash: returns previous block hashproposer: returns address and annotation (if available) for block proposerrate: returns reward ratereward: returns reward for the blockseed: reutrns seed of the blocktimestamp: returns timestamp of the blocktxnRoot: returns transaction rootupgradeApprove: returns number of vote for the current proposalupgradePropose: returns proposed upgrade