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

# Manual Node Setup

Below, you'll find a guide tailored for those who prefer a more customized installation approach.

<Steps titleSize="h3">
  <Step title="Install cast">
    We use the [cast](https://book.getfoundry.sh/cast/) CLI tool for making Ethereum RPC calls.
    If it's not already installed on your system, you can set up the entire Foundry toolchain, including `cast`, with the following command:

    ```bash ❯_ terminal theme={null}
    curl -L https://foundry.paradigm.xyz | bash
    ```

    After installation, execute `foundryup` to update to the latest versions of Foundry's suite of tools:
    `forge`, `cast`, `anvil`, and `chisel`:

    ```bash ❯_ terminal theme={null}
    foundryup
    ```

    For detailed guidance, refer to the official [Foundry Book](https://book.getfoundry.sh/getting-started/installation) installation instructions.
  </Step>

  <Step title="Check your CPU architecture">
    Run the following command which will identify your OS, and chip architecture:

    ```bash ❯_ terminal theme={null}
    uname -sm
    ```

    This command will output something like `Linux x86_64` or `Darwin arm64`, depending on your system.
  </Step>

  <Step title="Get the mev-commit binary">
    Navigate to the [mev-commit repo](https://github.com/primev/mev-commit/releases/latest)
    and select the mev-commit binary tailored to your system.
    For example, if `uname -sm` yields `Linux x86_64`, opt for `mev-commit_Linux_x86_64.tar.gz`.
    Download, then extract the binary into your preferred root directory to continue with setup.

    You can use the following command which automatically downloads and extracts the appropriate
    mev-commit binary for your system into your home directory:

    ```bash ❯_ terminal theme={null}
    FILENAME="mev-commit_1.1.0_$(uname -s)_$(uname -m).tar.gz"
    curl -L \
    "https://github.com/primev/mev-commit/releases/download/v1.1.0/$FILENAME" \
    | tar -xz -C $HOME
    ```

    <Accordion title="🕵️‍♂️ Recommended: Verify the checksum">
      Before executing any code downloaded from the internet, it's recommended to verify the checksum,
      a practice that ensures the file's integrity and authenticity. Checksums, provided with each release on GitHub,
      serve as a safeguard, allowing you to confirm that the downloaded binary has not been compromised or altered,
      thus protecting your system from potential security risks.

      To verify the checksum of the mev-commit binary, you can follow these simplified steps (assumes binary is the home directory):

      <Steps>
        <Step title="Grab the checksum">
          Set the binary's name based on your system and retrieve the corresponding checksum:

          ```bash ❯_ terminal theme={null}
          FILENAME="mev-commit_$(uname -s)_$(uname -m).tar.gz"
          CHECKSUM=$(curl -L \
          "https://github.com/primev/mev-commit/releases/download/v1.1.0/mev-commit_v1.1.0_checksums.txt" \
          | awk "/$FILENAME/ {print \$1}")
          ```
        </Step>

        <Step title="Verify">
          Verify the binary's checksum by running the following:

          <CodeGroup>
            ```bash linux theme={null}
            echo "$CHECKSUM $HOME/$FILENAME" | sha256sum -c -
            ```

            ```bash macOs (Darwin) theme={null}
            echo "$CHECKSUM $HOME/$FILENAME" | shasum -a 256 -c -
            ```
          </CodeGroup>

          ✅ **Success**

          If the output resembles the following, you may confidently proceed to the next steps:

          ```bash ❯_ bidder theme={null}
          filename.tar.gz: OK
          ```

          ❌ **Failure**

          Should the output indicate a failure, as shown below, re-download the file and attempt verification once more.

          ```bash theme={null}
          filename.tar.gz: FAILED
          shasum: WARNING: 1 computed checksum did NOT match
          ```

          If checksum verification continues to fail after multiple attempts, reach out to Primev for support.
        </Step>
      </Steps>
    </Accordion>
  </Step>
</Steps>

## Starting up your Node

Execute the script to initiate your node, selecting either a bidder or provider configuration based on your role in the network.

### Mainnet

```bash ❯_ provider theme={null}
mev-commit \
	--peer-type provider \
	--keystore-path ~/.mev-commit \
	--keystore-password <PASSWORD> \
	--bootnodes /dnsaddr/bootnode.mev-commit.xyz \
	--settlement-ws-rpc-endpoint wss://chainrpc-wss.mev-commit.xyz
```

```bash ❯_ bidder theme={null}
mev-commit \
	--keystore-path ~/.mev-commit \
	--keystore-password <PASSWORD> \
	--bootnodes /dnsaddr/bootnode.mev-commit.xyz \
	--settlement-ws-rpc-endpoint wss://chainrpc-wss.mev-commit.xyz
```

### Testnet

<CodeGroup>
  ```bash ❯_ provider theme={null}
  mev-commit \
  	--peer-type provider \
  	--keystore-path ~/.mev-commit \
  	--keystore-password <PASSWORD> \
  	--bootnodes /dnsaddr/bootnode.testnet.mev-commit.xyz \
  	--settlement-ws-rpc-endpoint wss://chainrpc-wss.testnet.mev-commit.xyz
  ```

  ```bash ❯_ bidder theme={null}
  mev-commit \
  	--keystore-path ~/.mev-commit \
  	--keystore-password <PASSWORD> \
  	--bootnodes /dnsaddr/bootnode.testnet.mev-commit.xyz \
  	--settlement-ws-rpc-endpoint wss://chainrpc-wss.testnet.mev-commit.xyz
  ```
</CodeGroup>

<CardGroup cols={2}>
  <div className="inline-card-header">
    <Card title="Bidders" icon="user-bounty-hunter">
      <br />

      <br />

      Once the node is started you can go through the [funding
      process](/v1.1.0/developers/bidder-deposit) to start sending bids.
    </Card>
  </div>

  <div className="inline-card-header">
    <Card title="Providers" icon="network-wired">
      <br />

      <br />

      In order to register as a provider please go through the [registration
      process](/v1.1.0/get-started/providers/registering-a-provider).
    </Card>
  </div>
</CardGroup>

* `--bootnodes` This should point to the bootnode for the Primev testnet network.
* `--settlement-rpc-endpoint` This should point to the Primev Settlement Chain RPC endpoint. At present this is managed by the Primev team.

❗ The `--peer-type` flag can be used to run a `provider` or `bidder` node.

❗ The default contract addresses point to the Primev testnet at the moment. All the options can be provided using a YAML config file or environment variables as described in the above help output.

❗ The mev-commit node, when started for the first time will create a private key for the node at `~/.mev-commit/key`. This is a plain-text key. In order to store encrypted keys, users need to use the keystore. This can be configured using the `--keystore-path` and `--keystore-password`.

❗ In order to run a provider node, the machine needs to be publicly accessible. Also, the mev-commit node will have to be configured with the public IP of the node using the `nat-addr` parameter.

## CLI Reference

```shell theme={null}
NAME:
   mev-commit - Start mev-commit node

USAGE:
   mev-commit [global options] command [command options]

VERSION:
   v1.1.0

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

   API options

   --http-addr value               Address to bind for http connections [$MEV_COMMIT_HTTP_ADDR]
   --http-port value               Port to listen for http connections (default: 13523) [$MEV_COMMIT_HTTP_PORT]
   --rpc-addr value                Address to bind for RPC connections [$MEV_COMMIT_RPC_ADDR]
   --rpc-port value                Port to listen for rpc connections (default: 13524) [$MEV_COMMIT_RPC_PORT]
   --server-tls-certificate value  Path to the server TLS certificate [$MEV_COMMIT_SERVER_TLS_CERTIFICATE]
   --server-tls-private-key value  Path to the server TLS private key [$MEV_COMMIT_SERVER_TLS_PRIVATE_KEY]

   Bidder options

   --autodeposit-amount value                                 Amount to auto deposit in each window in wei [$MEV_COMMIT_AUTODEPOSIT_AMOUNT]
   --autodeposit-enabled                                      Enable auto deposit (default: false) [$MEV_COMMIT_AUTODEPOSIT_ENABLED]
   --bidder-bid-timeout value                                 Timeout to use on bidder node to wait for preconfirmations after submitting bids (default: 30s) [$MEV_COMMIT_BIDDER_BID_TIMEOUT]
   --provider-whitelist value [ --provider-whitelist value ]  List of provider addresses to whitelist for bids [$MEV_COMMIT_PROVIDER_WHITELIST]

   Contracts

   --bidder-registry-contract value    Address of the bidder registry contract (default: "0x401B3287364f95694c43ACA3252831cAc02e5C41") [$MEV_COMMIT_BIDDER_REGISTRY_ADDR]
   --block-tracker-contract value      Address of the block tracker contract (default: "0x7538F3AaA07dA1990486De21A0B438F55e9639e4") [$MEV_COMMIT_BLOCK_TRACKER_ADDR]
   --preconf-contract value            Address of the preconfirmation commitment store contract (default: "0x9433bCD9e89F923ce587f7FA7E39e120E93eb84D") [$MEV_COMMIT_PRECONF_ADDR]
   --provider-registry-contract value  Address of the provider registry contract (default: "0xf4F10e18244d836311508917A3B04694D88999Dd") [$MEV_COMMIT_PROVIDER_REGISTRY_ADDR]
   --validator-router-contract value   Address of the validator router contract (default: "0x251Fbc993f58cBfDA8Ad7b0278084F915aCE7fc3") [$MEV_COMMIT_VALIDATOR_ROUTER_ADDR]

   Debug options

   --log-fmt value                      Log format to use, options are 'text' or 'json' (default: "text") [$MEV_COMMIT_LOG_FMT]
   --log-level value                    Log level to use, options are 'debug', 'info', 'warn', 'error' (default: "info") [$MEV_COMMIT_LOG_LEVEL]
   --log-tags value                     Log tags is a comma-separated list of <name:value> pairs that will be inserted into each log line [$MEV_COMMIT_LOG_TAGS]
   --otel-collector-endpoint-url value  URL for OpenTelemetry collector endpoint [$MEV_COMMIT_OTEL_COLLECTOR_ENDPOINT_URL]

   Ethereum RPC options

   --beacon-api-url value              URL of the beacon chain API (default: "https://ethereum-hoodi-beacon-api.publicnode.com") [$MEV_COMMIT_BEACON_API_URL]
   --l1-rpc-url value                  URL for L1 RPC (default: "https://ethereum-hoodi-rpc.publicnode.com") [$MEV_COMMIT_L1_RPC_URL]
   --settlement-rpc-endpoint value     RPC endpoint of the settlement layer (default: "http://localhost:8545") [$MEV_COMMIT_SETTLEMENT_RPC_ENDPOINT]
   --settlement-ws-rpc-endpoint value  WebSocket RPC endpoint of the settlement layer [$MEV_COMMIT_SETTLEMENT_WS_RPC_ENDPOINT]

   Global options

   --config value             Path to configuration file [$MEV_COMMIT_CONFIG]
   --data-dir value           Path to data directory (default: "~/.mev-commit/db") [$MEV_COMMIT_DATA_DIR]
   --gas-fee-cap value        Use predefined gas fee cap for transactions (default: "2000000000") [$MEV_COMMIT_GAS_FEE_CAP]
   --gas-limit value          Use predefined gas limit for transactions (default: 2000000) [$MEV_COMMIT_GAS_LIMIT]
   --gas-tip-cap value        Use predefined gas tip cap for transactions (default: "1000000000") [$MEV_COMMIT_GAS_TIP_CAP]
   --keystore-password value  Password to use to access keystore [$MEV_COMMIT_KEYSTORE_PASSWORD]
   --keystore-path value      Path to keystore location (default: "~/.mev-commit/keystore") [$MEV_COMMIT_KEYSTORE_PATH]
   --peer-type value          Peer type to use, options are 'bidder', 'provider' or 'bootnode' (default: "bidder") [$MEV_COMMIT_PEER_TYPE]
   --priv-key-file value      Path to private key file (default: "~/.mev-commit/key") [$MEV_COMMIT_PRIVKEY_FILE]

   P2P options

   --bootnodes value [ --bootnodes value ]  List of bootnodes to connect to [$MEV_COMMIT_BOOTNODES]
   --nat-addr value                         External address of the node to advertise to other peers [$MEV_COMMIT_NAT_ADDR]
   --nat-port value                         Externally mapped port for the node (default: 13522) [$MEV_COMMIT_NAT_PORT]
   --p2p-addr value                         Address to bind for p2p connections (default: "0.0.0.0") [$MEV_COMMIT_P2P_ADDR]
   --p2p-port value                         Port to listen for p2p connections (default: 13522) [$MEV_COMMIT_P2P_PORT]
   --secret value                           Secret to use for authenticating node in the p2p network (default: "secret") [$MEV_COMMIT_SECRET]

   Provider options

   --provider-decision-timeout value  Timeout to use on provider node to allow for preconfirmation decision logic after receiving bids (default: 30s) [$MEV_COMMIT_PROVIDER_DECISION_TIMEOUT]
```
