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

# `l1.estimateProveWithdrawalGas`

Estimates the gas required to prove an OP Stack withdrawal on L1.

## Usage

Estimate proof submission gas with the output claim and withdrawal storage proof.

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

const address = '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'
const hash =
  '0x0000000000000000000000000000000000000000000000000000000000000000'

const gas = await client.withdrawal.estimateProveWithdrawalGas({ // [!code focus]
  l2OutputIndex: 0n,
  outputRootProof: {
    latestBlockhash: hash,
    messagePasserStorageRoot: hash,
    stateRoot: hash,
    version: hash,
  },
  targetChain: optimism,
  withdrawal: {
    data: '0x',
    gasLimit: 21_000n,
    nonce: 0n,
    sender: address,
    target: address,
    value: Value.fromEther('1'),
  },
  withdrawalProof: [hash],
}) // [!code focus]
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/op-stack/l1.config.ts:setup]
```
:::

### Standalone Action

Call `Actions.l1.estimateProveWithdrawalGas` directly by passing the [Client](/docs/clients) as the first argument.

:::code-group
```ts twoslash [example.ts]
import { optimism } from 'viem/chains'
import { Actions } from 'viem/op-stack'
import { Value } from 'viem/utils'
import { client } from './viem.config'

const address = '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'
const hash =
  '0x0000000000000000000000000000000000000000000000000000000000000000'

const gas = await Actions.l1.estimateProveWithdrawalGas(client, { // [!code focus]
  l2OutputIndex: 0n,
  outputRootProof: {
    latestBlockhash: hash,
    messagePasserStorageRoot: hash,
    stateRoot: hash,
    version: hash,
  },
  targetChain: optimism,
  withdrawal: {
    data: '0x',
    gasLimit: 21_000n,
    nonce: 0n,
    sender: address,
    target: address,
    value: Value.fromEther('1'),
  },
  withdrawalProof: [hash],
}) // [!code focus]
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/op-stack/l1.config.ts:setup]
```
:::

## Return Value

`bigint`

The estimated L1 gas.

## Parameters

### account

* **Type:** `Account | Address`

The [Account](/docs/accounts) used for gas estimation.

### chain

* **Type:** `Chain`
* **Default:** `client.chain`

The L1 chain used for gas estimation.

### gas

* **Type:** `bigint`

The gas limit included in the estimate request.

### l2OutputIndex

* **Type:** `bigint`

The L2 output or dispute-game index.

### maxFeePerGas

* **Type:** `bigint`

The maximum total fee per gas, in wei.

### maxPriorityFeePerGas

* **Type:** `bigint`

The maximum priority fee per gas, in wei.

### nonce

* **Type:** `number`

The transaction nonce included in the estimate request.

### outputRootProof

* **Type:** `OutputRootProof`

The output-root proof for the withdrawal block. It contains `latestBlockhash`, `messagePasserStorageRoot`, `stateRoot`, and `version` hex values.

### portalAddress

* **Type:** `Address`

An explicit Optimism Portal address. When supplied, `targetChain` is optional.

### targetChain

* **Type:** `Chain`

The OP Stack L2 [Chain](/docs/chains) whose portal contract is used.

### withdrawal

* **Type:** `Withdrawal`

The withdrawal tuple containing `data`, `gasLimit`, `nonce`, `sender`, `target`, and `value`.

### withdrawalProof

* **Type:** `readonly Hex[]`

The Merkle proof for the withdrawal storage slot.
