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

# Dump State \[state.dump]

Serializes contract code, storage, and account properties into a state data blob.

## Usage

This example serializes the current state (contract code, contract storage, account properties, etc.) into a savable data blob.

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

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

```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.dump` 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.dump(client)
// @log: '0x1f8b08000000000000ff...'
```

```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 serialized state, ready to be passed to `load`.

## Parameters

### mode

* **Type:** `'anvil' | 'hardhat' | 'ganache'`
* **Default:** `'anvil'`

The test node implementation to target.

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

const client = Client.create({
  chain: mainnet,
  transport: http(),
})
// ---cut---
const result = await Actions.state.dump(client, {
  mode: 'hardhat', // [!code focus]
})
```
