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
Quick setup (Recommended)
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
-
Clone and navigate to the code directory:
-
Configure your environment:
-
Run the automated setup:
-
Monitor your rollup:
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
Dependency | Version | Version check command |
---|---|---|
git | ^2 | git --version |
go | ^1.21 | go version |
node | ^20 | node --version |
pnpm | ^8 | pnpm --version |
foundry | ^0.2.0 | forge --version |
make | ^3 | make --version |
jq | ^1.6 | jq --version |
direnv | ^2 | direnv --version |
Docker | ^24 | docker --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
- Sepolia ETH - You’ll need about 2-3 ETH:
- Start with Superchain Faucet (gives 0.05 ETH)
- Get more from:
- L1 RPC URL - An RPC endpoint to connect to the Sepolia network. You can get this from node providers like Alchemy, Infura. This is required so
op-deployer
and other services can read from and send transactions to L1.
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: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?
- Community Support: Join the Optimism Discord
- Development Questions: Visit Developer Support
- Issues: Report bugs on GitHub