From 54178dea8c656d956cfa234e41b967769f21d12c Mon Sep 17 00:00:00 2001 From: Bradley Camacho <42678939+bradleycamacho@users.noreply.github.com> Date: Tue, 18 Feb 2025 09:00:58 -0800 Subject: [PATCH 1/5] Fix dev-node --- pages/app-developers/building-apps.mdx | 4 +- .../chain-operators/tutorials/_meta.json | 3 +- .../tutorials/chain-dev-net.mdx | 188 ++++++++++++++++++ pages/stack/{dev-node.mdx => dev-net.mdx} | 0 4 files changed, 192 insertions(+), 3 deletions(-) create mode 100644 pages/operators/chain-operators/tutorials/chain-dev-net.mdx rename pages/stack/{dev-node.mdx => dev-net.mdx} (100%) diff --git a/pages/app-developers/building-apps.mdx b/pages/app-developers/building-apps.mdx index b8b686253..b8a0c412b 100644 --- a/pages/app-developers/building-apps.mdx +++ b/pages/app-developers/building-apps.mdx @@ -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 net 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). @@ -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 net](/stack/dev-net) or the [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. diff --git a/pages/operators/chain-operators/tutorials/_meta.json b/pages/operators/chain-operators/tutorials/_meta.json index c1122f8cc..e783934ab 100644 --- a/pages/operators/chain-operators/tutorials/_meta.json +++ b/pages/operators/chain-operators/tutorials/_meta.json @@ -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" } \ No newline at end of file diff --git a/pages/operators/chain-operators/tutorials/chain-dev-net.mdx b/pages/operators/chain-operators/tutorials/chain-dev-net.mdx new file mode 100644 index 000000000..79a922905 --- /dev/null +++ b/pages/operators/chain-operators/tutorials/chain-dev-net.mdx @@ -0,0 +1,188 @@ +--- +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 + + + 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). + + +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](/builders/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. + + + Modifications to the OP Stack may prevent a chain from being able to benefit from aspects of the [Optimism + Superchain](/stack/explainer). Make sure to check out the [Superchain Explainer](/stack/explainer) to learn more. + + +## 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 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 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 `. +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 "" --amount "eth" --rpc-url "http://127.0.0.1:" +``` + +Wait \~30 seconds, then check your balance on L2 by running the following command: + +```bash +export ETH_RPC_URL="http://127.0.0.1:" +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 + +* You can [modify the blockchain in various ways](../hacks/overview). +* 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](../management/troubleshooting) + or [file an issue](https://github.com/ethereum-optimism/optimism/issues) for help. diff --git a/pages/stack/dev-node.mdx b/pages/stack/dev-net.mdx similarity index 100% rename from pages/stack/dev-node.mdx rename to pages/stack/dev-net.mdx From 6fc6ad89631ce42048877abd97e0b538826df823 Mon Sep 17 00:00:00 2001 From: Blessing Krofegha Date: Sat, 1 Mar 2025 01:30:17 +0100 Subject: [PATCH 2/5] fix lint issues --- .../operators/chain-operators/tutorials/chain-dev-net.mdx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pages/operators/chain-operators/tutorials/chain-dev-net.mdx b/pages/operators/chain-operators/tutorials/chain-dev-net.mdx index 79a922905..279381f65 100644 --- a/pages/operators/chain-operators/tutorials/chain-dev-net.mdx +++ b/pages/operators/chain-operators/tutorials/chain-dev-net.mdx @@ -19,7 +19,7 @@ You'll perform the full deployment process, and **you'll end up with your very o 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](/builders/chain-operators/deploy/overview). +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 @@ -27,7 +27,7 @@ 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](/stack/explainer). Make sure to check out the [Superchain Explainer](/stack/explainer) to learn more. + Superchain](/superchain/superchain-explainer). Make sure to check out the [Superchain Explainer](/superchain/superchain-explainer) to learn more. ## Installing Dependencies @@ -182,7 +182,6 @@ Send some transactions, deploy some contracts, and see what happens! ## Next Steps -* You can [modify the blockchain in various ways](../hacks/overview). * 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](../management/troubleshooting) +* 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. From cdd3b50c6fcdd4087a16e62601743b1eff22e1a8 Mon Sep 17 00:00:00 2001 From: Blessing Krofegha Date: Sat, 1 Mar 2025 01:38:20 +0100 Subject: [PATCH 3/5] Update pages/app-developers/building-apps.mdx Co-authored-by: soyboy <85043086+sbvegan@users.noreply.github.com> --- pages/app-developers/building-apps.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/app-developers/building-apps.mdx b/pages/app-developers/building-apps.mdx index b8a0c412b..9660dfef1 100644 --- a/pages/app-developers/building-apps.mdx +++ b/pages/app-developers/building-apps.mdx @@ -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 net](/stack/dev-net) 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. From 25b279263c52ebdd670a546aec1a8a8f6647fa44 Mon Sep 17 00:00:00 2001 From: Blessing Krofegha Date: Sat, 1 Mar 2025 01:38:28 +0100 Subject: [PATCH 4/5] Update pages/app-developers/building-apps.mdx Co-authored-by: soyboy <85043086+sbvegan@users.noreply.github.com> --- pages/app-developers/building-apps.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/app-developers/building-apps.mdx b/pages/app-developers/building-apps.mdx index 9660dfef1..ce6b01878 100644 --- a/pages/app-developers/building-apps.mdx +++ b/pages/app-developers/building-apps.mdx @@ -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 net 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). From c4a7a31a45f928ffa9e3999bb31b45599fe15570 Mon Sep 17 00:00:00 2001 From: Blessing Krofegha Date: Sat, 1 Mar 2025 01:55:21 +0100 Subject: [PATCH 5/5] fix suggestions --- pages/operators/chain-operators/tutorials/_meta.json | 2 +- pages/operators/chain-operators/tutorials/chain-dev-net.mdx | 2 +- pages/stack/dev-net.mdx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/operators/chain-operators/tutorials/_meta.json b/pages/operators/chain-operators/tutorials/_meta.json index e783934ab..b09812685 100644 --- a/pages/operators/chain-operators/tutorials/_meta.json +++ b/pages/operators/chain-operators/tutorials/_meta.json @@ -4,5 +4,5 @@ "adding-precompiles": "Adding a precompile", "modifying-predeploys": "Modifying predeployed contracts", "integrating-da-layer": "Integrating a new DA layer", - "chain-dev-net": "Running a Local Network Environment" + "chain-dev-net": "Running a local network environment" } \ No newline at end of file diff --git a/pages/operators/chain-operators/tutorials/chain-dev-net.mdx b/pages/operators/chain-operators/tutorials/chain-dev-net.mdx index 279381f65..236a87e87 100644 --- a/pages/operators/chain-operators/tutorials/chain-dev-net.mdx +++ b/pages/operators/chain-operators/tutorials/chain-dev-net.mdx @@ -46,7 +46,7 @@ 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 +[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 diff --git a/pages/stack/dev-net.mdx b/pages/stack/dev-net.mdx index 78fac35be..a7e1c3bef 100644 --- a/pages/stack/dev-net.mdx +++ b/pages/stack/dev-net.mdx @@ -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 This guide is currently under active development. If you run into any issues, please open an issue on