Learn how to set up and configure an OP Stack batcher to submit L2 transaction batches to L1.
After you have spun up your sequencer, you need to configure a batcher to submit L2 transaction batches to L1. The batcher is a critical component that ensures L2 transaction data is available on L1 for data availability and enables users to reconstruct the L2 state.This guide assumes you already have a functioning sequencer and the necessary L1 contracts deployed using op-deployer. If you haven’t set up your sequencer yet, please refer to the sequencer guide first.
To ensure you’re using the latest compatible versions of OP Stack components, always check the official releases page.Look for the latest op-batcher/v* release that’s compatible with your sequencer setup.
This guide uses op-batcher/v1.13.1 which is compatible with op-node/v1.13.3 and op-geth/v1.101511.0 from the sequencer setup.
Always check the release notes for compatibility information.
# If you don't already have the optimism repository from the sequencer setupgit clone https://github.com/ethereum-optimism/optimism.gitcd optimism# Checkout the latest release taggit checkout op-batcher/v1.13.1# Build op-batchercd op-batcherjust# Binary will be available at ./bin/op-batcher
If you choose the Docker approach, you’ll need to:
Set up directory structure and copy configuration files:
Report incorrect code
Copy
Ask AI
# Create your batcher working directorymkdir ~/batcher-nodecd ~/batcher-node# Copy configuration files from op-deployer output# Note: Adjust the path if your .deployer directory is located elsewherecp ~/.deployer/state.json .# Extract the BatchInbox addressBATCH_INBOX_ADDRESS=$(cat state.json | jq -r '.opChainDeployments[0].SystemConfigProxy')echo "BatchInbox Address: $BATCH_INBOX_ADDRESS"
Create environment variables file:
Report incorrect code
Copy
Ask AI
# Create .env file with your actual valuescat > .env << 'EOF'# L1 Configuration - Replace with your actual RPC URLsL1_RPC_URL=https://sepolia.infura.io/v3/YOUR_ACTUAL_INFURA_KEY# L2 Configuration - Should match your sequencer setupL2_RPC_URL=http://op-geth:8545ROLLUP_RPC_URL=http://op-node:8547# Contract addresses - Extract from your op-deployer outputBATCH_INBOX_ADDRESS=YOUR_ACTUAL_BATCH_INBOX_ADDRESS# Private key - Replace with your actual private keyBATCHER_PRIVATE_KEY=YOUR_ACTUAL_PRIVATE_KEY# Batcher configurationPOLL_INTERVAL=1sSUB_SAFETY_MARGIN=6NUM_CONFIRMATIONS=1SAFE_ABORT_NONCE_TOO_LOW_COUNT=3RESUBMISSION_TIMEOUT=30sMAX_CHANNEL_DURATION=25# RPC configurationBATCHER_RPC_PORT=8548EOF
Important: Replace ALL placeholder values (YOUR_ACTUAL_*) with your real configuration values.
Create docker-compose.yml:
This configuration assumes your sequencer is running in a Docker container named sequencer-node on the same op-stack network.
Make sure your sequencer is running before starting the batcher.