OP Stack
Running a local development environment

Running a local development environment

This guide is currently under active development. If you run into any issues, please open an issue on Github (opens in a new tab).

This tutorial is designed for developers who want to learn about the OP Stack by spinning up a local OP Stack devnet. You'll perform the full deployment process, and you'll end up with your very own OP Stack devnet.

It's useful to understand what each of these components does before you start deploying your chain. To learn about the different components please read the deployment overview page.

You can use this devnet to experiment and perform tests, or you can choose to modify the chain to adapt it to your own needs. The OP Stack is free and open source software licensed entirely under the MIT license. You don't need permission from anyone to modify or deploy the stack in any configuration you want.

⚠️

Modifications to the OP Stack may prevent a chain from being able to benefit from aspects of the Optimism Superchain. Make sure to check out the Superchain Explainer to learn more.

Installing Dependencies

DependencyVersionVersion Check Command
docker (opens in a new tab)^27docker --version
kurtosis (opens in a new tab)^1.3.0kurtosis version
cast (opens in a new tab)^1.0.0cast --version

Notes on Specific Dependencies

docker

We recommend using the latest version of Docker on Linux, or OrbStack (opens in a new tab) (a drop-in replacement for Docker Desktop) on OSX.

kurtosis

Kurtosis is a tool for packaging and deploying containerized services. It's used in this tutorial to automatically deploy your devnet in an isolated environment.

Configure your network

Now that you've installed all the necessary dependencies, you can start configuring your network. The Kurtosis package accepts a YAML file which configures how many network participants there are, what kind of software they're running, and the network's topology. An example YAML file is below:

optimism_package:
  chains: # you can define multiple L2s, which will be deployed against the same L1 as a single Superchain
    - participants: # each participant is a node in the network. here we've defined two, one running op-geth and one running op-reth
          - el_type: op-geth # this node will be the sequencer since it's first in the list
          - el_type: op-reth
      network_params:
        name: rollup-1 # can be anything as long as it is unique
        network_id: 12345 # can be anything as long as it is unique
ethereum_package:
  - participants:
    - el_type: geth
      cl_type: teku

Start your network

Now that you've configured your network, you can start it up using the Kurtosis CLI. Run the command below:

kurtosis run github.com/ethpandaops/optimism-package \
    --args-file https://raw.githubusercontent.com/ethpandaops/optimism-package/main/network_params.yaml \
    --enclave op-devnet

This command will start up your network and deploy the OP Stack based on the ethpandaops configuration. The command will produce a lot of output and will take about five minutes to complete. Once it's done, you'll see a message that looks like the one below:

INFO[2025-02-25T02:10:37Z] =====================================================
INFO[2025-02-25T02:10:37Z] ||          Created enclave: op-devnet             ||
INFO[2025-02-25T02:10:37Z] =====================================================
Name:            op-devnet
UUID:            eb959a72177b
Status:          RUNNING
Creation Time:   Tue, 25 Feb 2025 02:07:56 UTC
Flags:

========================================= Files Artifacts =========================================
UUID           Name
14b79c110784   1-teku-geth-0-63
80829197fe1c   dashboards-0
80e45cc0080f   divine-butterfly
ddae8880a93f   el_cl_genesis_data
271d9f5d46ec   final-genesis-timestamp
df11dac8789a   genesis-el-cl-env-file
ca839becbe40   genesis_validators_root
40da51373335   grafana-config
cb782c178dfd   jwt_file
0fcd752154b6   keymanager_file
e724c1671e85   op-deployer-configs
e880f062cd24   op-deployer-fund-script
bb31dbb7e788   op_jwt_file
d8d4758b14c8   prometheus-config
3eafd3a35757   prysm-password
0fb6d6f67d26   validator-ranges

========================================== User Services ==========================================
UUID           Name                                             Ports                                         Status
976820378d51   cl-1-teku-geth                                   http: 4000/tcp -> http://127.0.0.1:32802      RUNNING
                                                                metrics: 8008/tcp -> http://127.0.0.1:32803
                                                                tcp-discovery: 9000/tcp -> 127.0.0.1:32804
                                                                udp-discovery: 9000/udp -> 127.0.0.1:32775
12ee5b7e5a18   el-1-geth-teku                                   engine-rpc: 8551/tcp -> 127.0.0.1:32799       RUNNING
                                                                metrics: 9001/tcp -> http://127.0.0.1:32800
                                                                rpc: 8545/tcp -> 127.0.0.1:32797
                                                                tcp-discovery: 30303/tcp -> 127.0.0.1:32801
                                                                udp-discovery: 30303/udp -> 127.0.0.1:32774
                                                                ws: 8546/tcp -> 127.0.0.1:32798
e3e534981b75   grafana                                          http: 3000/tcp -> http://127.0.0.1:32821      RUNNING
aa9a19bf1413   op-batcher-rollup-1                              http: 8548/tcp -> http://127.0.0.1:32815      RUNNING
                                                                metrics: 9001/tcp -> 127.0.0.1:32816
d63d3aeaa06b   op-challenger-rollup-1                           metrics: 9001/tcp -> 127.0.0.1:32819          RUNNING
632c061ac1b7   op-cl-1-op-node-op-geth-rollup-1                 http: 8547/tcp -> http://127.0.0.1:32812      RUNNING
                                                                metrics: 9001/tcp -> 127.0.0.1:32813
                                                                tcp-discovery: 9003/tcp -> 127.0.0.1:32814
                                                                udp-discovery: 9003/udp -> 127.0.0.1:32777
0e0d1e6c2269   op-el-1-op-geth-op-node-rollup-1                 engine-rpc: 8551/tcp                          RUNNING
                                                                metrics: 9001/tcp
                                                                rpc: 8545/tcp
                                                                tcp-discovery: 30303/tcp
                                                                udp-discovery: 30303/udp
                                                                ws: 8546/tcp
544b3f952009   op-proposer-rollup-1                             http: 8560/tcp -> http://127.0.0.1:32817      RUNNING
                                                                metrics: 9001/tcp -> 127.0.0.1:32818
5b8cc317a573   prometheus                                       http: 9090/tcp -> http://127.0.0.1:32820      RUNNING
61ba4bff3ab8   validator-key-generation-cl-validator-keystore   <none>                                        RUNNING

Also take note of the last log line above this message, which contains the address of the standard bridge. You'll need this address to deposit funds on your L2.

This might look complicated, but it's just a list of the services that were started up by Kurtosis. For each service, you can see:

  • The enclave name, which identifies the services you just deployed within Kurtosis. The enclave is an isolated environment that runs your devnet.
  • The service's name, which you can use with the Kurtosis CLI to view its logs and interact with it.
  • The service's ports and addresses, which you can use to connect to the service.

At this point your chain is up and running. Let's move on to the next section to learn how to interact with it.

Interact with your network

You now have a fully functioning OP Stack Rollup. You can connect your wallet to this chain the same way you'd connect your wallet to any other EVM chain. You can find your node's RPC URL by running kurtosis enclave inspect op-devnet. The RPC url is the rpc port name in any of the execution client services identified by op-el.

Depositing funds onto your network

Your network was configured to pre-fund development addresses, you can find the full list of available pre-fund accounts from here (opens in a new tab). To get ETH onto your L2, you import one of the private keys from that list into your favorite wallet or use a CLI tool like cast. For the purposes of this tutorial, we'll use cast and assume you want to use the first address 0x8943545177806ED17B9F23F0a21ee5948eCaa776 (opens in a new tab).

To move ETH onto your L2, run the following command. Make sure to replace the values in angle brackets with real values:

cast send "<standard bridge address>" --private-key bcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31 \
    --value "<amount in ETH>ether" --rpc-url "http://127.0.0.1:<rpc port of el-1-geth-teku service>"

The output should look like below:

blockHash            0xf6c18d85ba89b4b1e6060ddf744d8d9084dbb3720e2a2a854627a1b1b7a294ba
blockNumber          388
contractAddress
cumulativeGasUsed    21000
effectiveGasPrice    1000000007
from                 0x8943545177806ED17B9F23F0a21ee5948eCaa776
gasUsed              21000
logs                 []
logsBloom            0x000000000000000000000000000000000... # truncated
root
status               1 (success)
transactionHash      0x268f98f883efe9c8f9ecc7542a9c8af51869118cfce06e775683f5b4aec2681d
transactionIndex     0
type                 2
blobGasPrice
blobGasUsed
authorizationList
to                   <standard bridge address>

Wait ~30 seconds, then check your balance on L2 by running the following command:

export ETH_RPC_URL="http://127.0.0.1:<rpc port of el-1-geth-teku service>"
export ADDRESS="0x8943545177806ED17B9F23F0a21ee5948eCaa776"
cast balance "$ADDRESS"

Your balance should match the amount you sent.

See Your Rollup in Action

You can interact with your Rollup the same way you'd interact with any other EVM chain. Send some transactions, deploy some contracts, and see what happens!

Next Steps