> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# Get Block Number \[block.getNumber]

Returns the number of the most recent block seen.

## Usage

This example returns the number of the most recent block seen.

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

const blockNumber = await client.block.getNumber()
// @log: 19868020n
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, http, publicActions } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  chain: mainnet,
  transport: http(),
}).extend(publicActions())
```
:::

### Standalone Action

Call `Actions.block.getNumber` directly by passing the Client as the first argument.

:::code-group
```ts twoslash [example.ts]
import { Actions } from 'viem'
import { client } from './viem.config'

const blockNumber = await Actions.block.getNumber(client)
// @log: 19868020n
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, http } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  chain: mainnet,
  transport: http(),
})
```
:::

## Return Value

`bigint`

The number of the most recent block.

## Parameters

### cacheTime

* **Type:** `number`
* **Default:** `client.cacheTime`

Time (in milliseconds) that the cached block number stays fresh before another request is made. Set to `0` to disable caching for this call.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const blockNumber = await Actions.block.getNumber(client, {
  cacheTime: 4_000, // [!code focus]
})
```
