---
description: This page will provide how to set OPinit bots for your minitia
---

# OPinit Bots

Initia Optimistic Rollup Bots.

* **Batch Submitter**: Submit batch to L1 node
* **Output Submitter**: Submit output to L1 node
* **Challenger**: Challenge invalid output
* **Bridge Executor**: Execute bridge transaction

## Installation

```bash
git clone https://github.com/initia-labs/OPinit.git
cd OPinit/bots
npm install
```

## How to use

### Create Bridge

Before running rollup bots, you should create bridge between L1 and L2. If you use `initia.js`, you can create bridge using `MsgCreateBridge` message as follows.

```typescript
import { MsgCreateBridge, BridgeConfig, Duration } from '@initia/initia.js';

const bridgeConfig = new BridgeConfig(
    challenger.key.accAddress,
    outputSubmitter.key.accAddress,
    Duration.fromString(submissionInterval.toString()),
    Duration.fromString(finalizedTime.toString()),
    new Date(),
    this.metadata
);

const msg = new MsgCreateBridge(executor.key.accAddress, bridgeConfig);
```

### Configuration

<table><thead><tr><th width="205">Name</th><th width="249.33333333333331">Description</th><th>Default</th></tr></thead><tbody><tr><td>L1_LCD_URI</td><td>L1 node LCD URI</td><td>http://127.0.0.1:1317</td></tr><tr><td>L1_RPC_URI</td><td>L1 node RPC URI</td><td>http://127.0.0.1:26657</td></tr><tr><td>L2_LCD_URI</td><td>L2 node LCD URI</td><td>http://127.0.0.1:1317</td></tr><tr><td>L2_RPC_URI</td><td>L2 node RPC URI</td><td>http://127.0.0.1:26657</td></tr><tr><td>BRIDGE_ID</td><td>Bridge ID</td><td>""</td></tr><tr><td>EXECUTOR_PORT</td><td>Executor port</td><td>3000</td></tr><tr><td>BATCH_PORT</td><td>Batch submitter port</td><td>3001</td></tr><tr><td>EXECUTOR_MNEMONIC</td><td>Mnemonic seed for executor</td><td>""</td></tr><tr><td>BATCH_SUBMITTER_MNEMONIC</td><td>Mnemonic seed for submitter</td><td>""</td></tr><tr><td>OUTPUT_SUBMITTER_MNEMONIC</td><td>Mnemonic seed for output submitter</td><td>""</td></tr><tr><td>CHALLENGER_MNEMONIC</td><td>Mnemonic seed for challenger</td><td>""</td></tr><tr><td>L2_DENOM</td><td>L2 fee denom</td><td>umin</td></tr><tr><td>SLACK_WEB_HOOK</td><td>Slack web hook url for notification</td><td>""</td></tr><tr><td>DELETE_OUTPUT_PROPOSAL</td><td>Whether to allow challenger to automatically delete output proposals</td><td>false</td></tr></tbody></table>



> In OPinit bots, we use [dotenv](https://github.com/motdotla/dotenv) for managing environment variable for development.&#x20;

### Bridge Executor

Bridge executor is a bot that monitor L1, L2 node and execute bridge transaction. It will execute following steps.

1.  Set bridge executor mnemonic on `.env.executor`.

    ```bash
    export EXECUTOR_MNEMONIC="..."
    ```
2.  Run executor bot

    ```bash
    npm run executor
    ```

### Batch Submitter

Batch submitter is a background process that submits transaction batches to the BatchInbox module of L1.

1.  Set batch submitter mnemonic on `.env.batch`.

    ```bash
    export BATCH_SUBMITTER_MNEMONIC="..."
    ```
2.  Run batch submitter bot

    ```bash
    npm run batch
    ```

### Output Submitter

Output submitter is the component to store the L2 output root for block finalization. Output submitter will get the L2 output results from executor and submit it to L1.

1.  Set output submitter mnemonic on `.env.output`.

    ```bash
    export OUTPUT_SUBMITTER_MNEMONIC="..."
    ```
2.  Run output submitter bot

    ```bash
    npm run output
    ```

### Challenger

Challenger is an entity capable of deleting invalid output proposals from the output oracle.

1.  Set challenger mnemonic on `.env.challenger`.

    ```bash
    export CHALLENGER_MNEMONIC="..."
    ```
2.  Run challenger bot

    ```bash
    npm run challenger
    ```
