# blockchain - TAC

> Example code for the blockchain JSON-RPC method. Complete guide on how to use blockchain JSON-RPC in GetBlock Web3 documentation.

Returns block metadata (headers) for a range of heights, newest first. The range is capped at 20 blocks per call.

## Method

```
blockchain
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| minHeight | string | Lowest block height in the range |
| maxHeight | string | Highest block height in the range |

## Example

```bash
export TAC_TM=https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/

# JSON-RPC over HTTP (POST)
curl -X POST "${TAC_TM}" -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": "getblock.io", "method": "blockchain", "params": {"minHeight": "5123400", "maxHeight": "5123420"}}'

# URI over HTTP (GET)
curl "${TAC_TM}blockchain?minHeight=5123400&maxHeight=5123420"
```

## Response

```json
{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "last_height": "5123456",
        "block_metas": [
            {
                "block_id": {
                    "hash": "A1B2..."
                },
                "header": {
                    "height": "5123420",
                    "time": "2026-06-01T10:31:22Z"
                },
                "num_txs": "3"
            }
        ]
    }
}
```

## Response Fields

| Field | Type | Description |
| --- | --- | --- |
| last_height | string | Current chain tip height |
| block_metas | array | Block headers in the requested range, newest first |

## Use Cases

* **Range scan**: Pull a window of recent block headers
* **Lightweight sync**: Read headers without full block bodies

## Error Handling

| Error | Message | Description |
| --- | --- | --- |
| -32600 / Invalid request | Invalid request | The JSON-RPC envelope was malformed |
| -32602 / Invalid params | Invalid params | A parameter was missing or of the wrong type |
| 403 / RBAC: access denied | Access denied | The GetBlock access token is missing or incorrect |
