> For the complete documentation index, see [llms.txt](https://docs.getblock.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.getblock.io/api-reference/ethereum-eth/eth_getblockbyhash-ethereum.md).

# eth\_getBlockByHash - Ethereum

This method returns block data given a block hash. It includes all header fields, the transactions list (either hashes or full objects depending on the second parameter), and the withdrawals list (post-Shapella). Post-Cancun blocks include blob-related fields; post-Pectra blocks include the `requestsHash`.

## Parameters

| Parameter                | Type    | Required | Description                                                                                                |
| ------------------------ | ------- | -------- | ---------------------------------------------------------------------------------------------------------- |
| `blockHash`              | string  | Yes      | 32-byte block hash to look up                                                                              |
| `fullTransactionObjects` | boolean | Yes      | If `true`, returns full transaction objects in `transactions`; if `false`, returns just transaction hashes |

## Request

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```bash
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_getBlockByHash",
    "params": [
        "0x9ec8e2f6b78d8f5f2ac3e5d61b0d38d4d5a8f0e7c8b5a2f9d3e6c1b7a4d0f2e5c",
        false
    ],
    "id": "getblock.io"
}'
```

{% endcode %}
{% endtab %}

{% tab title="Axios" %}
{% code title="example.js" %}

```javascript
const axios = require('axios');

const response = await axios.post('https://go.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    method: 'eth_getBlockByHash',
    params: [
        "0x9ec8e2f6b78d8f5f2ac3e5d61b0d38d4d5a8f0e7c8b5a2f9d3e6c1b7a4d0f2e5c",
        false
    ],
    id: 'getblock.io'
}, {
    headers: { 'Content-Type': 'application/json' }
});

console.log(response.data.result);
```

{% endcode %}
{% endtab %}

{% tab title="Request" %}
{% code title="example.py" %}

```python
import requests

response = requests.post(
    'https://go.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'eth_getBlockByHash',
        'params': [
        "0x9ec8e2f6b78d8f5f2ac3e5d61b0d38d4d5a8f0e7c8b5a2f9d3e6c1b7a4d0f2e5c",
        false
    ],
        'id': 'getblock.io'
    }
)

print(response.json())
```

{% endcode %}
{% endtab %}

{% tab title="Rust" %}
{% code title="example.rs" %}

```rust
use reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    
    const response = client
        .post("https://go.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "eth_getBlockByHash",
            "params": [
        "0x9ec8e2f6b78d8f5f2ac3e5d61b0d38d4d5a8f0e7c8b5a2f9d3e6c1b7a4d0f2e5c",
        false
    ],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;
    
    println!("Result: {}", response["result"]);
    Ok(())
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Response

```json
{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "number": "0x1720340",
        "hash": "0x9ec8e2f6b78d8f5f2ac3e5d61b0d38d4d5a8f0e7c8b5a2f9d3e6c1b7a4d0f2e5c",
        "parentHash": "0x8db7d1e5a67c7e4f1bb2d4c50a9c27c3b4a7f9e6b7a4919c2d5b0a6f3d9e1c4b",
        "nonce": "0x0000000000000000",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "transactionsRoot": "0x9c8f0e4f8d2e7c6b5a4f3e2d1c0b9a8e7f6d5c4b3a2b1c9d8e7f6a5b4c3d2e1f",
        "stateRoot": "0x5eae9c5cbe0e8d3e2f5cd8b0a4e3b1f2c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4",
        "receiptsRoot": "0x3a2b1c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3f2a1b",
        "miner": "0x1f9090aae28b8a3dceadf281b0f12828e676c326",
        "difficulty": "0x0",
        "totalDifficulty": "0xc70d815d562d3cfa955",
        "extraData": "0x546974616e2028746974616e6275696c6465722e78797a29",
        "size": "0x28a4b",
        "gasLimit": "0x39dc7fb",
        "gasUsed": "0x1c7db2c",
        "timestamp": "0x67abcdef",
        "baseFeePerGas": "0x5f5e100",
        "blobGasUsed": "0x180000",
        "excessBlobGas": "0x2a0000",
        "withdrawalsRoot": "0x1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3",
        "parentBeaconBlockRoot": "0x2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4",
        "requestsHash": "0x3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5",
        "mixHash": "0x9ac2e6f3a5b8c1d4e7f0a3b6c9d2e5f8a1b4c7d0e3f6a9b2c5d8e1f4a7b0c3d6",
        "uncles": [],
        "transactions": [
            "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b",
            "0x1cd7d1e5a67c7e4f1bb2d4c50a9c27c3b4a7f9e6b7a4919c2d5b0a6f3d9e1c4b"
        ],
        "withdrawals": [
            {
                "index": "0x1a2b3c",
                "validatorIndex": "0x1234",
                "address": "0x1234567890abcdef1234567890abcdef12345678",
                "amount": "0x1c9c380"
            }
        ]
    }
}
```

## Response Parameters

| Parameter                      | Type            | Description                                                                      |
| ------------------------------ | --------------- | -------------------------------------------------------------------------------- |
| `jsonrpc`                      | string          | JSON-RPC protocol version ("2.0")                                                |
| `id`                           | string          | Request identifier matching the request                                          |
| `result.number`                | string          | Hex-encoded block number                                                         |
| `result.hash`                  | string          | 32-byte block hash                                                               |
| `result.parentHash`            | string          | Hash of the parent block                                                         |
| `result.nonce`                 | string          | 8-byte block nonce (deprecated post-Merge, always `0x0000000000000000`)          |
| `result.sha3Uncles`            | string          | keccak256 of the uncles list (empty post-Merge)                                  |
| `result.logsBloom`             | string          | 256-byte bloom filter over the block's logs                                      |
| `result.transactionsRoot`      | string          | Root of the transactions trie                                                    |
| `result.stateRoot`             | string          | Root of the state trie after processing the block                                |
| `result.receiptsRoot`          | string          | Root of the receipts trie                                                        |
| `result.miner`                 | string          | Address that received the block-level fee (fee recipient / proposer)             |
| `result.difficulty`            | string          | Block difficulty (`0x0` post-Merge)                                              |
| `result.totalDifficulty`       | string          | Cumulative chain difficulty at this block                                        |
| `result.extraData`             | string          | Arbitrary extra data (up to 32 bytes)                                            |
| `result.size`                  | string          | Size of the block in bytes (hex)                                                 |
| `result.gasLimit`              | string          | Maximum gas allowed in the block (hex)                                           |
| `result.gasUsed`               | string          | Actual gas consumed by transactions in the block                                 |
| `result.timestamp`             | string          | Unix timestamp of block production (hex)                                         |
| `result.baseFeePerGas`         | string          | EIP-1559 base fee per gas (wei, hex)                                             |
| `result.blobGasUsed`           | string          | Total blob gas consumed by blob transactions in the block (post-Cancun)          |
| `result.excessBlobGas`         | string          | Excess blob gas carried into next block (post-Cancun)                            |
| `result.withdrawalsRoot`       | string          | Root of the block's withdrawals list (post-Shapella)                             |
| `result.parentBeaconBlockRoot` | string          | Beacon block root of the parent (post-Cancun / EIP-4788)                         |
| `result.requestsHash`          | string          | Hash of the block's execution-layer requests list (post-Pectra / EIP-7685)       |
| `result.mixHash`               | string          | Prev-randao value (post-Merge, formerly PoW mix digest)                          |
| `result.uncles`                | array of string | Uncle block hashes (empty post-Merge)                                            |
| `result.transactions`          | array           | Transaction hashes, or full transaction objects if `fullTransactionObjects=true` |
| `result.withdrawals`           | array of object | Consensus-layer withdrawals credited in the block (post-Shapella)                |

## Use Cases

* **Reorg-Safe Block Lookup**: Look up a block by its hash to disambiguate from potential reorged blocks at the same number
* **Chain Explorer Detail Pages**: Fetch complete block data for an explorer's block detail view
* **Historical Analytics**: Analyze block-level metrics (gas usage, fee revenue, blob activity) by hash-indexed queries
* **MEV Bundle Verification**: Compare submitted MEV bundles against the final canonical block by hash

## Error Handling

| Error Code | Message        | Description                       |
| ---------- | -------------- | --------------------------------- |
| -32602     | Invalid params | Block hash is malformed           |
| -32603     | Internal error | Node failed to retrieve the block |

## Web3 Integration

{% tabs %}
{% tab title="Ethers.js" %}
{% code title="ethers-example.js" %}

```javascript
import { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('https://go.getblock.io/<ACCESS-TOKEN>/');

// getBlock returns a rich block object with typed fields
const block = await provider.getBlock('0x9ec8e2f6b78d8f5f2ac3e5d61b0d38d4d5a8f0e7c8b5a2f9d3e6c1b7a4d0f2e5c');
console.log('Block number:', block.number);
console.log('Timestamp:', new Date(block.timestamp * 1000).toISOString());
console.log('Gas used:', block.gasUsed.toString());
console.log('Base fee (gwei):', ethers.formatUnits(block.baseFeePerGas, 'gwei'));
```

{% endcode %}
{% endtab %}

{% tab title="Viem" %}
{% code title="viem-example.js" %}

```javascript
import { createPublicClient, http, formatGwei } from 'viem';
import { mainnet } from 'viem/chains';

const client = createPublicClient({
    chain: mainnet,
    transport: http('https://go.getblock.io/<ACCESS-TOKEN>/'),
});

const block = await client.getBlock({ blockHash: '0x9ec8e2f6b78d8f5f2ac3e5d61b0d38d4d5a8f0e7c8b5a2f9d3e6c1b7a4d0f2e5c' });
console.log('Block number:', block.number);
console.log('Timestamp:', new Date(Number(block.timestamp) * 1000).toISOString());
console.log('Gas used:', block.gasUsed);
console.log('Base fee (gwei):', formatGwei(block.baseFeePerGas));
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.getblock.io/api-reference/ethereum-eth/eth_getblockbyhash-ethereum.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
