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

# Revert State \[state.revert]

Reverts the state of the blockchain to a previously taken snapshot.

## Usage

This example reverts the state of the blockchain to a previously taken snapshot.

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

await client.state.revert({
  id: '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.revert` directly by passing the Client as the first argument.

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

await Actions.state.revert(client, {
  id: '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

`void`

No value is returned.

## Parameters

### id

* **Type:** `Hex`

The snapshot ID (from `snapshot`) to revert to.

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

const client = Client.create({
  chain: mainnet,
  transport: http(),
})
// ---cut---
await Actions.state.revert(client, {
  id: '0x1', // [!code focus]
})
```
