Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pages/app-developers/building-apps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To access any Ethereum type network you need an endpoint. [These providers](/app

### Network choice

For development purposes we recommend you use either a local development node or [OP Sepolia](https://sepolia-optimism.etherscan.io).
For development purposes we recommend you use either a local development network or [OP Sepolia](https://sepolia-optimism.etherscan.io).
That way you don't need to spend real money.
If you need ETH on OP Sepolia for testing purposes, [you can use this faucet](https://console.optimism.io/faucet?utm_source=docs).

Expand Down Expand Up @@ -51,7 +51,7 @@ Not only is it faster, but such EVMs often have extra features, such as the [abi

### Debug before deploying

After you are done with that development, debug your decentralized application using either a [development node](/stack/dev-node) or the [Sepolia test network](/superchain/networks).
After you are done with that development, debug your decentralized application using either a [development network](/stack/dev-net) or a [Sepolia test network](/superchain/networks).
This lets you debug parts that are OP Stack chains specific such as calls to bridges to transfer ETH or tokens between layers.

Only when you have a version that works well on a test network should you deploy to the production network, where every transaction has a cost.
Expand Down
2 changes: 2 additions & 0 deletions pages/operators/chain-operators/tutorials.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ This section provides information on adding attributes to the derivation functio

<Card title="Creating your own l2 rollup testnet" href="/operators/chain-operators/tutorials/create-l2-rollup" />

<Card title="Running a Local Development Environment" href="/operators/chain-operators/tutorials/chain-dev-net" />

<Card title="Integrating a new da layer with alt Da" href="/operators/chain-operators/tutorials/integrating-da-layer" />

<Card title="Modifying predeployed contracts" href="/operators/chain-operators/tutorials/modifying-predeploys" />
Expand Down
3 changes: 2 additions & 1 deletion pages/operators/chain-operators/tutorials/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"adding-derivation-attributes": "Adding attributes to the derivation function",
"adding-precompiles": "Adding a precompile",
"modifying-predeploys": "Modifying predeployed contracts",
"integrating-da-layer": "Integrating a new DA layer"
"integrating-da-layer": "Integrating a new DA layer",
"chain-dev-net": "Running a local network environment"
}
187 changes: 187 additions & 0 deletions pages/operators/chain-operators/tutorials/chain-dev-net.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
---
title: Running a Local Network Environment
lang: en-US
description: This tutorial walks you through spinning up an OP Stack devnet chain.
---

import {Callout, Steps} from 'nextra/components'
import {WipCallout} from '@/components/WipCallout'

# Running a Local Development Environment

<Callout type="info">
This guide is currently under active development. If you run into any issues, please open an issue on
[Github](https://github.com/ethereum-optimism/optimism).
</Callout>

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](/operators/chain-operators/deploy/overview).

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.

<Callout type="warning">
Modifications to the OP Stack may prevent a chain from being able to benefit from aspects of the [Optimism
Superchain](/superchain/superchain-explainer). Make sure to check out the [Superchain Explainer](/superchain/superchain-explainer) to learn more.
</Callout>

## Installing Dependencies

| Dependency | Version | Version Check Command |
| ------------------------------------------------- | -------- | --------------------- |
| [docker](https://docs.docker.com/engine/install/) | `^27` | `docker --version` |
| [kurtosis](https://docs.kurtosis.com/install/) | `^1.3.0` | `kurtosis version` |

### Notes on Specific Dependencies

#### `docker`

We recommend using the latest version of Docker on Linux, or [OrbStack](https://orbstack.dev/) (a drop-in replacement
for Docker Desktop) on OSX.

#### `kurtosis`

[Kurtosis](https://github.com/kurtosis-tech/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:

```yaml
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
```
Save the above configuration to a file. For the rest of this tutorial, we'll assume you've saved it to `network-config.yaml`.

## Start your network

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

```bash
kurtosis run github.com/ethpandaops/optimism-package --args-file ./network-config.yaml
```

This command will start up your network and deploy the OP Stack based on the configuration you created. 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[2024-09-23T00:31:29-06:00] ===================================================
INFO[2024-09-23T00:31:29-06:00] || Created enclave: blue-marsh ||
INFO[2024-09-23T00:31:29-06:00] ===================================================
Name: blue-marsh
UUID: 91af529557cb
Status: RUNNING
Creation Time: Mon, 23 Sep 2024 00:29:58 MDT
Flags:
========================================= Files Artifacts =========================================
UUID Name
a5824b041b28 1-lighthouse-geth-0-63-0
f7c0e13e9871 el_cl_genesis_data
bfa022049aea final-genesis-timestamp
0b5c53e3940f genesis-el-cl-env-file
46a78cc34966 genesis_validators_root
038ad1a753ed jwt_file
4fbc4bde03c2 keymanager_file
c36887606978 op-deployer-configs
d638c3222e56 op-deployer-fund-script
b02f20c287ac op_jwt_filerollup-1
655d57862785 prysm-password
28203054f5ec validator-ranges
========================================== User Services ==========================================
UUID Name Ports Status
29643e475cb7 cl-1-lighthouse-geth http: 4000/tcp -> http://127.0.0.1:33639 RUNNING
metrics: 5054/tcp -> http://127.0.0.1:33640
tcp-discovery: 9000/tcp -> 127.0.0.1:33641
udp-discovery: 9000/udp -> 127.0.0.1:32920
e7dfdc2588ae el-1-geth-lighthouse engine-rpc: 8551/tcp -> 127.0.0.1:33636 RUNNING
metrics: 9001/tcp -> http://127.0.0.1:33637
rpc: 8545/tcp -> 127.0.0.1:33634
tcp-discovery: 30303/tcp -> 127.0.0.1:33638
udp-discovery: 30303/udp -> 127.0.0.1:32919
ws: 8546/tcp -> 127.0.0.1:33635
5ff43094ccc3 op-batcher-rollup-1 http: 8548/tcp -> http://127.0.0.1:33650 RUNNING
aa30d376acc9 op-cl-1-op-node-op-geth-rollup-1 http: 8547/tcp -> http://127.0.0.1:33648 RUNNING
tcp-discovery: 9003/tcp -> 127.0.0.1:33649
udp-discovery: 9003/udp -> 127.0.0.1:32922
af4abdbbe939 op-el-1-op-geth-op-node-rollup-1 engine-rpc: 8551/tcp -> 127.0.0.1:33645 RUNNING
metrics: 9001/tcp -> 127.0.0.1:33646
rpc: 8545/tcp -> http://127.0.0.1:33643
tcp-discovery: 30303/tcp -> 127.0.0.1:33647
udp-discovery: 30303/udp -> 127.0.0.1:32921
ws: 8546/tcp -> 127.0.0.1:33644
578ee2b5bfe7 validator-key-generation-cl-validator-keystore <none> RUNNING
aa69f73e96c1 vc-1-geth-lighthouse metrics: 8080/tcp -> http://127.0.0.1:33642 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 <enclave name>`.
Your enclave name is outputted at the end of the `kurtosis run` command above. 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 using the `test test test test test test test test test test test junk`
mnemonic. To get ETH onto your L2, you import one of the private keys from that mnemonic 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
generated by that mnemonic.

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

```bash
cast send --mnemonic 'test test test test test test test test test test test junk' --mnemonic-path "m/44'/60'/0'/0/0" \
--to "<standard bridge address>" --amount "<amount in ETH>eth" --rpc-url "http://127.0.0.1:<rpc port of el-1-geth-lighthouse service>"
```

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

```bash
export ETH_RPC_URL="http://127.0.0.1:<rpc port of el-1-geth-lighthouse service>"
export ADDRESS="0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
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

* Check out the [protocol specs](https://specs.optimism.io/) for more detail about the rollup protocol.
* If you run into any problems, please visit the [Chain Operators Troubleshooting Guide](/operators/chain-operators/management/troubleshooting)
or [file an issue](https://github.com/ethereum-optimism/optimism/issues) for help.
2 changes: 1 addition & 1 deletion pages/stack/dev-node.mdx → pages/stack/dev-net.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: This tutorial walks you through spinning up an OP Stack devnet chai
import {Callout, Steps} from 'nextra/components'
import {WipCallout} from '@/components/WipCallout'

# Running a Local Development Environment
# Running a local development environment

<Callout type="info">
This guide is currently under active development. If you run into any issues, please open an issue on
Expand Down