> ## Documentation Index
> Fetch the complete documentation index at: https://primev-24-ckartik-add-bundles-details.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Validator Guide

> Opt into mev-commit with ease. This guide covers everything you need to do to passively interact with the mev-commit protocol as a validator.

## Opting-in as a Validator

L1 validator participation in the mev-commit protocol adds ultimate credibility to commitments and enforces their delivery. This guide walks through the process of opting-in to the mev-commit testnet as a Holesky validator. A restaking version will also be enabled in the future through Eigenlayer.

**Prerequisites:**

1. An operational Holesky validator node.
2. An operational mev-boost sidecar or equivalent.
3. Associated validator key(s).

### Requirements

By opting-in to the mev-commit protocol as a Holesky validator, you agree to the following:

* Your mev-boost client should ONLY connect to mev-commit opted in relays to avoid being slashed by proposing a block that doesn't deliver commitments. The Titan Holesky relay is the only supporting relay at this time as shown in the list below. This list will be updated as more relays support the network.

**Supporting Relays:**

<table>
  <thead>
    <tr>
      <th width="350">Relay Name</th>
      <th width="350">Docs Link</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>Titan</td>
      <td>[https://docs.titanrelay.xyz/](https://docs.titanrelay.xyz/)</td>
    </tr>
  </tbody>
</table>

If you are a relay looking to join mev-commit network please visit our [Relays page](/get-started/relays) to get more information.

* 3 ETH must be staked with the registry contract on the mev-commit chain for the validator account, which you can obtain from our [Testnet Faucet](/get-started/faucet).

## Staking with registry

[Validator Registry Contract](http://explorer.testnet.mev-commit.xyz/address/0xF263483500e849Bd8d452c9A0F075B606ee64087)

The validator registry contract is deployed to the mev-commit chain at address `0xF263483500e849Bd8d452c9A0F075B606ee64087`, with a minimum stake requirement of 3 ETH, and a 7000 block unstaking period. This unstaking period corresponds to 23.3 minutes, assuming a 200ms mev-commit chain block time. This period allows two L1 epochs (L1 finalization period) plus a settlement buffer, to pass between validator unstake initiation and withdrawal.

The registry strictly accepts BLS public keys as the validator opt-in identifier. Any EOA can stake on behalf of a validator pub key, and only that EOA has the ability to withdraw in the future.

To stake with the mev-commit validator registry, first use the [testnet faucet](/get-started/faucet) to fund an account on the mev-commit chain.

To `stake` with the contract, see the following function signature, where ether sent with the transaction is split evenly among the specified validator pub keys:

```solidity
function stake(bytes[] calldata validatorBLSPubKeys) external payable {
    uint256 splitAmount = msg.value / validatorBLSPubKeys.length;
    for (uint256 i = 0; i < validatorBLSPubKeys.length; i++) {
        stakedBalances[validatorBLSPubKeys[i]] += splitAmount;
    }
}
```

Note the `stake` function accepts multiple validator BLS pub keys. There are inherent gas limitations to the number of validators that can be staked in a single transaction, it's recommended to stake in batches of 10-20 pub keys at a time.

### Golang example

We're working on a UI to stake with the validator registry. In the meantime you can programmatically interact with the registry via [golang scripts](https://github.com/primevprotocol/validator-registry).

For example, to stake any number of validator BLS public keys with the registry, use [this example script](https://github.com/primevprotocol/validator-registry/blob/main/cmd/stake/main.go) as described below.

First clone the validator-registry repo:

```bash
git clone https://github.com/primevprotocol/validator-registry.git
```

Then cd into the repo and populate `keys_example.txt` with your validator BLS public keys.

```bash
cd validator-registry
vi keys_example.txt
*Edit file as needed*
```

Then navigate to the `cmd/stake` directory and run the script with the private key that was funded above.

```bash
cd cmd/stake
PRIVATE_KEY="0x..." go run main.go
```

Note this script will attempt to stake 3.1 ETH on behalf of each validator BLS public key in `keys_example.txt`.

## Withdrawing staked ether

If you wish to withdraw your staked ether, you can do so via the previously mentioned validator registry page, or using a golang script similar to what's provided. Note an unstaking period is enforced, meaning you must first submit an `unstake` transaction, wait an appropriate amount of blocks, then submit a `withdraw` transaction, transferring funds to your account.
