> For the complete documentation index, see [llms.txt](https://docs.dedot.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dedot.dev/typink/hooks-and-providers/useblockinfo.md).

# useBlockInfo

Subscribes to best and finalized block updates in real time. Returns block number and hash for both best and finalized blocks with automatic updates.

#### Props

<table><thead><tr><th width="119.53125">Name</th><th width="203.671875">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>options</code></td><td><code>NetworkOptions?</code></td><td>Optional network selection options (e.g., <code>{ networkId: 'polkadot' }</code>).</td></tr></tbody></table>

#### Return Type

<table><thead><tr><th width="138.27734375">Name</th><th width="224.19921875">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>best</code></td><td><code>BlockInfo | undefined</code></td><td>Latest best block information (<code>{ number: number, hash: string }</code>).</td></tr><tr><td><code>finalized</code></td><td><code>BlockInfo | undefined</code></td><td>Latest finalized block information (<code>{ number: number, hash: string }</code>).</td></tr></tbody></table>

#### Basic Usage

**Display real-time block numbers:**

```tsx
import { useBlockInfo } from 'typink';

function BlockTracker() {
  const { best, finalized } = useBlockInfo();

  return (
    <div>
      <p>Best Block: #{best?.number}</p>
      <p>Finalized Block: #{finalized?.number}</p>
      <p>Best Hash: {best?.hash}</p>
    </div>
  );
}
```

**Multi-network block tracking:**

```tsx
function MultiNetworkBlocks() {
  const polkadotBlocks = useBlockInfo({ networkId: 'polkadot' });
  const kusamaBlocks = useBlockInfo({ networkId: 'kusama' });

  return (
    <div>
      <div>
        <h3>Polkadot</h3>
        <p>Best: #{polkadotBlocks.best?.number}</p>
        <p>Finalized: #{polkadotBlocks.finalized?.number}</p>
      </div>
      <div>
        <h3>Kusama</h3>
        <p>Best: #{kusamaBlocks.best?.number}</p>
        <p>Finalized: #{kusamaBlocks.finalized?.number}</p>
      </div>
    </div>
  );
}
```


---

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

```
GET https://docs.dedot.dev/typink/hooks-and-providers/useblockinfo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
