Step 3 of 5: This tutorial is designed to be followed step-by-step. Each step builds on the previous one.
Automated Setup AvailableFor a complete working setup with all components, check out the automated approach in the code directory.
Understanding the batcher’s role
The batcher (op-batcher
) serves as a crucial component that bridges your L2 chain data to L1. Its primary responsibilities include:
- Batch submission: Collecting L2 transactions and submitting them as batches to L1
- Data availability: Ensuring L2 transaction data is available on L1 for verification
- Cost optimization: Compressing and efficiently packing transaction data to minimize L1 costs
- Channel management: Managing data channels for optimal batch submission timing
BatchInbox
contract on L1.
Prerequisites
Before setting up your batcher, ensure you have: Running infrastructure:- An operational sequencer node
- Access to a L1 RPC endpoint
- Your L2 chain ID and network configuration
- L1 network details (chain ID, RPC endpoints)
BatchInbox
contract address from your deployment
- Use docker
- Build from source
If you prefer containerized deployment, you can use the official Docker images and do the following:Important: Replace ALL placeholder values (Your batcher is now operational and will continuously submit L2 transaction batches to L1!
1
Set up directory structure and copy configuration files
2
Create environment variables file
OP Stack Standard VariablesThe batcher uses OP Stack standard environment variables following the OP Stack conventions. These are prefixed with
OP_BATCHER_
for batcher-specific settings.YOUR_ACTUAL_*
) with your real configuration values.3
Create a docker-compose.yml file
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.4
Start the batcher service
5
Verify batcher is running
6
Final directory structure
Understanding common startup messagesWhen starting your batcher, you might see various log messages:
Added L2 block to local state
: Normal operation, shows the batcher processing blocksSetMaxDASize RPC method unavailable
: Expected if theop-geth
version used doesn’t support this method.context canceled
errors during shutdown: Normal cleanup messagesFailed to query L1 tip
: Can occur during graceful shutdowns
What’s Next?
Excellent! Your batcher is publishing transaction data to L1. The next step is to set up the proposer to submit state root proposals.Spin up proposer →
Next: Configure and start op-proposer to submit L2 state roots to L1 for withdrawal verification.
Need Help?
- Community Support: Join the Optimism Discord
- Batcher Configuration: op-batcher Configuration Reference
- Monitoring Guide: Chain Monitoring