> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ralphstudio.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Blocks

> Query block data and chain activity from the Alephium indexer.

The indexer block endpoints give you structured block data with full transaction counts, timestamps, and chain metadata. Unlike the raw node, the indexer stores historical block data in a queryable format making it easy to browse the chain by height or time range.

## Get block by hash

Returns full details of a block including its transactions.

```bash theme={null}
curl "https://rpc.ralphstudio.xyz/{slug}/indexer/blocks/{block-hash}" \
  -H "Authorization: Bearer API_KEY"
```

```json theme={null}
{
  "hash": "00000000ab3c...",
  "timestamp": 1748476800000,
  "chainFrom": 0,
  "chainTo": 0,
  "height": 12900,
  "txNumber": 3,
  "mainChain": true,
  "hashRate": "6333680720 MH/s"
}
```

`mainChain: true` means this block is part of the canonical chain. Orphaned blocks return `mainChain: false`.

## Get blocks in a time range

Returns all blocks produced within a timestamp range across all chain shards. Timestamps are in milliseconds.

```bash theme={null}
curl "https://rpc.ralphstudio.xyz/{slug}/indexer/blocks?fromTs=1748476800000&toTs=1748480400000" \
  -H "Authorization: Bearer API_KEY"
```

```json theme={null}
{
  "blocks": [
    [
      {
        "hash": "00000000ab3c...",
        "timestamp": 1748476800000,
        "chainFrom": 0,
        "chainTo": 0,
        "height": 12900,
        "txNumber": 3,
        "mainChain": true,
        "hashRate": "6333680720 MH/s"
      }
    ]
  ]
}
```

The response is a nested array, the outer array represents chain shards and the inner arrays contain the blocks for each shard.

## Get block at height

Returns the canonical block at a specific height for a chain shard.

```bash theme={null}
curl "https://rpc.ralphstudio.xyz/{slug}/indexer/blocks/heights/{height}?chainFrom=0&chainTo=0" \
  -H "Authorization: Bearer API_KEY"
```

```json theme={null}
{
  "hash": "00000000ab3c...",
  "timestamp": 1748476800000,
  "chainFrom": 0,
  "chainTo": 0,
  "height": 12900,
  "txNumber": 3,
  "mainChain": true,
  "hashRate": "6333680720 MH/s"
}
```

## Get latest blocks

Returns the most recently produced blocks across all chain shards.

```bash theme={null}
curl "https://rpc.ralphstudio.xyz/{slug}/indexer/blocks/latest?limit=10" \
  -H "Authorization: Bearer API_KEY"
```

```json theme={null}
[
  {
    "hash": "00000000ab3c...",
    "timestamp": 1748476800000,
    "chainFrom": 0,
    "chainTo": 0,
    "height": 12973,
    "txNumber": 2,
    "mainChain": true,
    "hashRate": "6333680720 MH/s"
  }
]
```

## Get transactions in a block

Returns all transactions included in a block.

```bash theme={null}
curl "https://rpc.ralphstudio.xyz/{slug}/indexer/blocks/{block-hash}/transactions?page=1&limit=20" \
  -H "Authorization: Bearer API_KEY"
```

```json theme={null}
[
  {
    "hash": "503a2c...",
    "blockHash": "00000000ab3c...",
    "timestamp": 1748476800000,
    "inputs": [...],
    "outputs": [...],
    "gasAmount": 20000,
    "gasPrice": "100000000000",
    "scriptExecutionOk": true,
    "coinbase": false
  }
]
```

## Understanding Alephium's block structure

Alephium is a sharded chain. At any given height there are multiple blocks produced in parallel, one per chain shard. Each shard is identified by a `chainFrom` and `chainTo` pair, both between 0 and 3. That means at each height there are up to 16 blocks (4 groups × 4 groups).

When browsing blocks, keep in mind:

* Block height alone does not uniquely identify a block, you need height + fromGroup + toGroup
* A block hash uniquely identifies a block across all shards
* The `txNumber` field tells you how many transactions are in the block without fetching them all

## Parameters reference

| Parameter  | Type    | Description                                    |
| ---------- | ------- | ---------------------------------------------- |
| block-hash | string  | Hex-encoded block hash                         |
| height     | integer | Block height                                   |
| chainFrom  | integer | Source shard group (0–3)                       |
| chainTo    | integer | Destination shard group (0–3)                  |
| fromTs     | integer | Start timestamp in milliseconds                |
| toTs       | integer | End timestamp in milliseconds                  |
| limit      | integer | Number of results to return (max: 100)         |
| page       | integer | Page number for paginated results (default: 1) |
