> ## Documentation Index
> Fetch the complete documentation index at: https://docs.optimism.io/llms.txt
> Use this file to discover all available pages before exploring further.

# OP Validator

> Learn how to use op-validator to validate chain configurations and deployments.

The `op-validator` is a tool for validating Standard OP Stack chain configurations and deployments to ensure they're in compliance with the [Standard Rollup Charter](/op-stack/protocol/blockspace-charter#the-standard-rollup-charter).
It works by calling into the `StandardValidator` smart contracts.
These then perform a set of checks, and return error codes for any issues found.

These checks include:

* Contract implementations and versions
* Proxy configurations
* System parameters
* Cross-component relationships
* Security settings

## How to use op-validator

<Steps>
  <Step title="Clone the monorepo">
    ```bash theme={null}
      git clone https://github.com/ethereum-optimism/optimism.git
    ```
  </Step>

  <Step title="Build the `op-validator` binary">
    ```bash theme={null}
      cd optimism/op-validator
      just build
    ```
  </Step>

  <Step title="Run the `op-validator` binary">
    ```bash theme={null}
      ./bin/op-validator validate v1.8.0 \
        --l1-rpc-url "https://ethereum-sepolia-rpc.publicnode.com" \
        --absolute-prestate "0x03f89406817db1ed7fd8b31e13300444652cdb0b9c509a674de43483b2f83568" \
        --proxy-admin "0x189aBAAaa82DfC015A588A7dbaD6F13b1D3485Bc" \
        --system-config "0x034edD2A225f7f429A63E0f1D2084B9E0A93b538" \
        --l2-chain-id "11155420" \
        --fail
    ```
  </Step>

  <Step title="Understanding the output">
    In the previous command, we provided a non-standard absolute prestate. The `op-validator` returned the following output to describe the discrepancies between the provided absolute prestate and the expected prestate in the L1 smart contracts:

    ```
    |      ERROR      |          DESCRIPTION           |
    |-----------------|--------------------------------|
    | PDDG-40         | Permissioned dispute game      |
    |                 | absolute prestate mismatch     |
    | PDDG-ANCHORP-40 | Permissioned dispute game      |
    |                 | anchor state registry root     |
    |                 | hash mismatch                  |
    | PLDG-40         | Permissionless dispute game    |
    |                 | absolute prestate mismatch     |
    | PLDG-ANCHORP-40 | Permissionless dispute game    |
    |                 | anchor state registry root     |
    |                 | hash mismatch                  |

    Validation errors found
    ```
  </Step>
</Steps>

## Usage

The validator supports different protocol versions through subcommands:

```bash theme={null}
op-validator validate [version] [flags]
```

Choose a version based on your `op-contracts` version:

* `v1.8.0` - For validating `op-contracts/1.8.0`
* `v2.0.0` - For validating `op-contracts/2.0.0`

### Flags

| Option                | Description                                                                                                                                                     | Required/Optional |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| `--l1-rpc-url`        | L1 RPC URL (can also be set via `L1_RPC_URL` environment variable)                                                                                              | Required          |
| `--absolute-prestate` | Absolute prestate as hex string                                                                                                                                 | Required          |
| `--proxy-admin`       | Proxy admin address as hex string. This should be a specific chain's proxy admin contract on L1. It is not the proxy admin owner or the superchain proxy admin. | Required          |
| `--system-config`     | System config proxy address as hex string                                                                                                                       | Required          |
| `--l2-chain-id`       | L2 chain ID                                                                                                                                                     | Required          |
| `--fail`              | Exit with non-zero code if validation errors are found (defaults to true)                                                                                       | Optional          |

### Example

```bash theme={null}
op-validator validate v2.0.0 \
  --l1-rpc-url "L1_RPC_URL" \
  --absolute-prestate "0x1234..." \
  --proxy-admin "0xabcd..." \
```
