getBlockByHash
This method obtains the block by hash of the chains passed as parameters.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
input | [ChainHashInput!]! | Yes | List of block queries with chain name and block hash. |
ChainHashInput Fields
| Name | Type | Required | Description |
|---|---|---|---|
chain | String! | Yes | Chain ID. |
hash | String! | Yes | Block hash. |
chain
Type: Chain!
Allowed Values: A chain ID from the list of supported chains.
[!WARNING] This query requires archive data. While it works for all listed supported chains, some chains might fail for older blocks. These limited chains are marked in the supported chains list.
hash
Type: String!
Allowed Values: Any block hash as string.
Response
Returns a list of ChainBlockDetails objects, each corresponding to a requested chain/block.
ChainBlockDetails
| Field | Type | Description |
|---|---|---|
chain | String! | The blockchain name. |
height | String | The block number or height. |
hash | String | The block hash. |
block | BlockDetails | The detailed block information (type varies by chain). |
error | String | Error message if fetching failed for this block. |
BlockDetails (Union)
The block field is a union type and can be one of the following types depending on the blockchain:
EVMBlockDetails(Ethereum-compatible chains)BitcoinBlockDetails(Bitcoin)SolanaBlockDetails(Solana)TendermintBlockDetails(Cosmos and Tendermint chains)
Query Example
Query
query GetBlockByHash($input: [ChainHashInput!]!) {
getBlockByHash(input: $input) {
chain
hash
block {
... on EVMBlockDetails {
chain
baseFeePerGas
blobGasUsed
gasUsed
hash
number
}
... on BitcoinBlockDetails {
chain
hash
confirmations
merkleroot
previousblockhash
}
... on SolanaBlockDetails {
chain
blockHeight
blockTime
blockhash
parentSlot
previousBlockhash
}
... on TendermintBlockDetails {
chain
header {
version {
block
app
}
chain_id
height
time
last_block_id {
hash
part_set_header {
total
hash
}
}
last_commit_hash
data_hash
evidence_hash
proposer_address
}
}
}
error
}
}Variables
{
"input": [
{
"chain": "CHAIN_BITCOIN_MAINNET",
"hash": "000000000000000000008821ef71d5916c449073616cebf8fc8ca5ca6c8dc8ec"
},
{
"chain": "CHAIN_NOBLE_1",
"hash": "0FB87E11F2BA66814A720A56E2A635680B8FCE1926E6B99D63E73AF753A48104"
},
{
"chain": "CHAIN_0X1",
"hash": "0xe305c4089d540324fff0d34be9fdbf90249188d7c9d98a5af4c964175de84479"
}
]
}Curl
curl -X POST https://your-api-endpoint/graphql \
-H "Content-Type: application/json" \
-d '{
"query": "query GetBlockByHash($input: [ChainHashInput!]!) { getBlockByHash(input: $input) { chain hash block { ... on EVMBlockDetails { chain baseFeePerGas blobGasUsed gasUsed hash number } ... on BitcoinBlockDetails { chain hash confirmations merkleroot previousblockhash } ... on SolanaBlockDetails { chain blockHeight blockTime blockhash parentSlot previousBlockhash } ... on TendermintBlockDetails { chain header { version { block app } chain_id height time last_block_id { hash part_set_header { total hash } } last_commit_hash data_hash evidence_hash proposer_address } } } error } }",
"variables": {
"input": [
{ "chain": "CHAIN_BITCOIN_MAINNET", "hash": "000000000000000000008821ef71d5916c449073616cebf8fc8ca5ca6c8dc8ec" },
{ "chain": "CHAIN_0X1", "hash": "0xe305c4089d540324fff0d34be9fdbf90249188d7c9d98a5af4c964175de84479" }
]
}
}'Response Example
{
"data": {
"getBlockByHash": [
{
"chain": "CHAIN_BITCOIN_MAINNET",
"hash": "000000000000000000008821ef71d5916c449073616cebf8fc8ca5ca6c8dc8ec",
"block": {
"chain": "CHAIN_BITCOIN_MAINNET",
"hash": "000000000000000000008821ef71d5916c449073616cebf8fc8ca5ca6c8dc8ec",
"confirmations": "4",
"merkleroot": "01e534b27b1ff8b8c2c7df6231ccc7d5b3cdf41bfa25fb3de042df3a86047666",
"previousblockhash": "00000000000000000001594e65f1ff81d66c910248451e441468520729520e45"
},
"error": null
},
{
"chain": "CHAIN_0X1",
"hash": "0xe305c4089d540324fff0d34be9fdbf90249188d7c9d98a5af4c964175de84479",
"block": {
"chain": "CHAIN_0X1",
"baseFeePerGas": "0xdc35e66",
"blobGasUsed": "0xc0000",
"gasUsed": "0x143658b",
"hash": "0xe305c4089d540324fff0d34be9fdbf90249188d7c9d98a5af4c964175de84479",
"number": "0x16686cd"
},
"error": null
}
]
}
}