Skip to main content
Welcome to the complete guide for deploying your own OP Stack L2 rollup testnet. This multi-part tutorial will walk you through each component step-by-step, from initial setup to a fully functioning rollup.
This tutorial requires intermediate-level experience working with EVM chains. You should be comfortable with concepts like smart contracts, private keys, RPC endpoints, gas fees, and command-line operations. Basic familiarity with Docker is also recommended.

What you’ll build

By the end of this tutorial, you’ll have a complete OP Stack testnet with:
  • L1 Smart Contracts deployed on Sepolia testnet
  • Execution Client (op-geth) processing transactions
  • Consensus Client (op-node) managing rollup consensus
  • Batcher (op-batcher) publishing transaction data to L1
  • Proposer (op-proposer) submitting state root proposals
  • Challenger (op-challenger) monitoring for disputes
If you want to get started quickly, you can use the complete working implementation provided in this repository. This automated setup handles all the configuration and deployment steps for you.
Complete working exampleA complete, working implementation is available in the create-l2-rollup-example/ directory. This includes all necessary scripts, Docker Compose configuration, and example environment files.

Automated setup steps

  1. Clone and navigate to the code directory:
    git clone https://github.com/ethereum-optimism/docs.git
    cd docs/create-l2-rollup-example
    
  2. Configure your environment:
    cp .example.env .env
    # Edit .env with your L1_RPC_URL, PRIVATE_KEY, and other settings
    
  3. Run the automated setup:
    make init    # Download op-deployer
    make setup   # Deploy contracts and generate configs
    make up      # Start all services
    make test-l1 # Verify L1 connectivity
    make test-l2 # Verify L2 functionality
    
  4. Monitor your rollup:
    make logs     # View all service logs
    make status   # Check service health
    
The automated setup uses the standard OP Stack environment variable conventions (prefixed with OP_*) and handles all the complex configuration automatically.

Manual setup (Step-by-Step)

If you prefer to understand each component in detail or need custom configurations, follow the step-by-step guide below.

Before you start

Software dependencies

DependencyVersionVersion check command
git^2git --version
go^1.21go version
node^20node --version
pnpm^8pnpm --version
foundry^0.2.0forge --version
make^3make --version
jq^1.6jq --version
direnv^2direnv --version
Docker^24docker --version

Notes on specific dependencies

Expand each dependency below for details

Get access to a sepolia node

Since you’re deploying your OP Stack chain to Sepolia, you’ll need to have access to a Sepolia node. You can either use a node provider like Alchemy (easier) or run your own Sepolia node (harder).

Required resources

Testnet Only: This guide is for testnet deployment only.
Follow in Order: Each step builds on the previous one. Start with spinning up op-deployer and complete them sequentially for the best experience.

Directory structure

To keep your rollup deployment organized, we’ll create a dedicated directory structure. All components will be set up within this structure:
rollup/
├── deployer/        # op-deployer files and contracts
├── sequencer/  # op-geth and op-node
├── batcher/    # op-batcher configuration
├── proposer/   # op-proposer setup
└── challenger/ # op-challenger files
Each component’s documentation will show you how the directory structure evolves as you add files and configurations.
Throughout this tutorial, all file paths will be relative to this rollup directory structure. Make sure to adjust any commands if you use different directory names.

Manual Tutorial Overview

If you’re following the manual setup path, this tutorial is organized into sequential steps that build upon each other:
1

Spin up op-deployer

Install op-deployer, deploy L1 contracts, and prepare your environmentGo to op-deployer setup →
2

Spin up sequencer

Set up and run op-geth and op-node (the execution and consensus layers)Go to sequencer setup →
3

Spin up batcher

Configure and start op-batcher for L1 data publishingGo to batcher setup →
4

Spin up proposer

Set up op-proposer for state root submissionsGo to proposer setup →
5

Spin up challenger

Configure op-challenger for dispute resolution monitoringGo to challenger setup →

Ready to Start?

Now that you understand what you’ll be building, let’s begin with the first step!

Spin up op-deployer

Already have your dependencies? Get started and spin up op-deployer

Need Help?