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

# Snapshot State \[state.snapshot]

Snapshots the state of the blockchain at the current block.

## Usage

This example snapshots the state of the blockchain at the current block.

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

const result = await client.state.snapshot()
// @log: '0x1'
```

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

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

### Standalone Action

Call `Actions.state.snapshot` 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 result = await Actions.state.snapshot(client)
// @log: '0x1'
```

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

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

## Return Value

`Hex`

The snapshot ID, which can be passed to `revert`.
