> ## 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.

# Blockflow

> Query blocks, chain info, and hashes on Alephium.

Alephium uses a sharding algorithm called BlockFlow. The chain is split into groups, and blocks are produced per group pair. Most blockflow endpoints require `fromGroup` and `toGroup` parameters, both can be `0`, `1`, `2`, or `3`.

## Get chain info

Returns the current height of a specific chain shard.

```bash theme={null}
curl "https://rpc.ralphstudio.xyz/{slug}/blockflow/chain-info?fromGroup=0&toGroup=0" \
  -H "Authorization: Bearer API_KEY"
```

```json theme={null}
{
  "currentHeight": 12973
}
```

## Get block hashes at height

Returns all block hashes at a given height for a chain shard.

```bash theme={null}
curl "https://rpc.ralphstudio.xyz/{slug}/blockflow/hashes?fromGroup=0&toGroup=0&height=12900" \
  -H "Authorization: Bearer API_KEY"
```

```json theme={null}
{
  "headers": ["00000000ab3c..."]
}
```

## Get a block by hash

Returns full block data including transactions.

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

```json theme={null}
{
  "hash": "00000000ab3c...",
  "timestamp": 1748476800000,
  "chainFrom": 0,
  "chainTo": 0,
  "height": 12900,
  "deps": [...],
  "transactions": [...],
  "nonce": "...",
  "version": 0,
  "depStateHash": "...",
  "txsHash": "...",
  "target": "..."
}
```

## Get blocks in a time range

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

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

## Get the main chain block at height

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

```bash theme={null}
curl "https://rpc.ralphstudio.xyz/{slug}/blockflow/main-chain-block-by-height?fromGroup=0&toGroup=0&height=12900" \
  -H "Authorization: Bearer API_KEY"
```

## Get blocks with events

Returns blocks along with the contract events emitted in those blocks. Useful for indexing contract activity.

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

## Is a block in the main chain

Checks whether a given block hash is part of the canonical chain.

```bash theme={null}
curl "https://rpc.ralphstudio.xyz/{slug}/blockflow/is-block-in-main-chain?blockHash={block-hash}" \
  -H "Authorization: Bearer API_KEY"
```

```json theme={null}
{
  "isInMainChain": true
}
```

## Parameters reference

| Parameter | Type    | Description                     |
| --------- | ------- | ------------------------------- |
| fromGroup | integer | Source shard group (0–3)        |
| toGroup   | integer | Destination shard group (0–3)   |
| height    | integer | Block height                    |
| fromTs    | integer | Start timestamp in milliseconds |
| toTs      | integer | End timestamp in milliseconds   |
| blockHash | string  | Hex-encoded block hash          |
