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

# Chain

> Inspect canonical chain heads, blocks, ancestry, and hash canonicality.

The chain commands read a running node through standard Ethereum JSON-RPC methods such as `eth_getBlockByNumber` and `eth_getBlockByHash`.

Use these commands when you want a compact view of canonical chain state without switching to a general-purpose RPC client.

<CardGroup cols={2}>
  <Card title="Head" icon="circle-dot" href="/docs/chain/head">
    Show latest, safe, and finalized block heads.
  </Card>

  <Card title="Block" icon="box" href="/docs/chain/block">
    Inspect one block by number, hash, or tag.
  </Card>

  <Card title="Ancestry" icon="git-branch" href="/docs/chain/ancestry">
    Walk parent hashes from a starting block.
  </Card>

  <Card title="Canonical" icon="badge-check" href="/docs/chain/canonical">
    Check whether a block hash is canonical at its number.
  </Card>
</CardGroup>

## Prerequisites

Start a Reth node with the `eth` RPC namespace:

```sh theme={null}
reth node \
  --dev \
  --http \
  --http.api eth,net,web3 \
  --datadir ./alice
```

Rex connects to the local execution RPC endpoint at
`http://127.0.0.1:8545` (`localhost:8545`) by default:

```sh theme={null}
rex chain head
```

Use the global `--rpc <URL>` flag to target a different endpoint.

## Block Selectors

Commands that accept `--block` support:

* decimal block numbers such as `12345`
* 0x-prefixed block numbers such as `0x3039`
* 32-byte block hashes
* tags: `latest`, `safe`, `finalized`, and `earliest`

The `canonical` command accepts a block hash because it compares that hash with the canonical hash at the same block number.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.