Skip to content

Commit

Permalink
Merge pull request #175 from ethereum-optimism/simplifying-node-tutorial
Browse files Browse the repository at this point in the history
simplifying the node tutorial
  • Loading branch information
cpengilly authored Nov 17, 2023
2 parents 97e1db9 + 729caf3 commit cbde721
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 172 deletions.
8 changes: 8 additions & 0 deletions pages/node-operators/building-node/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ This tutorial was checked on:

### Clone the [Optimism Monorepo](https://github.com/ethereum-optimism/optimism)

<Callout type="info">
If you want to run the same version we're using in production, you can checkout our latest [release commit](https://github.com/ethereum-optimism/optimism/releases).
</Callout>

```bash
git clone https://github.com/ethereum-optimism/optimism.git
```
Expand Down Expand Up @@ -85,6 +89,10 @@ This tutorial was checked on:

### Clone [`op-geth`](https://github.com/ethereum-optimism/op-geth)

<Callout type="info">
If you want to run the same version we're using in production, you can checkout our latest [release commit](https://github.com/ethereum-optimism/op-geth/releases).
</Callout>
```bash
git clone https://github.com/ethereum-optimism/op-geth.git
```
Expand Down
138 changes: 33 additions & 105 deletions pages/node-operators/building-node/mainnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ You will need 500+ GB for this part alone.
c17067b7bc39a6daa14f71d448c6fa0477834c3e68a25e96f26fe849c12a09bffe510e96f7eacdef19e93e3167d15250f807d252dd6f6f9053d0e4457c73d5fb mainnet-bedrock.tar.zst
```

### Create the data directory in `op-geth` and fill it
### Create the `op-geth` data directory and fill it

This will take time.

Navigate into your `op-geth` directory and run these commands:
Navigate to location you want to put your `op-geth` directory and unpack the compressed data directory

```sh
mkdir datadir
cd datadir
mkdir op-geth-datadir
cd op-geth-datadir
tar xvf <<PATH_TO_DATA_DIR>>
```
</Steps>
Expand Down Expand Up @@ -90,109 +90,69 @@ You will need 500+ GB for this part alone.
This will take time.
Navigate into your `l2geth` directory and run these commands:
Navigate to location you want to put your `l2geth` directory and run these commands:
```sh
mkdir datadir
cd datadir
mkdir l2geth-datadir
cd l2geth-datadir
tar xvf <<PATH_TO_DATA_DIR>>
```
</Steps>
## Create a shared secret between `op-geth` and `op-node`
<Steps>
### Navigate into your `op-geth` directory and run these commands:
### Navigate into your `op-geth` directory
### Create a random number
This will be the shared secret for `op-geth` and `op-node` to communicate over the engine API authrpc.
```sh
openssl rand -hex 32 > jwt.txt
cp jwt.txt ../optimism/op-node
```
### Create a new directory `scripts`
Place in the root of your working directory. These scripts will be used to start the different components.
</Steps>
## (Optional - Archive Node) `l2geth`
## (Optional - Archive Node) Start `l2geth`
<Steps>
### Navigate into your `scripts` directory:
### Create a new file:
```sh
touch run-l2geth.sh
```
### Make it executable:
```sh
chmod +x run-l2geth.sh
```
### Navigate into your `l2geth` directory
### Insert this snippet of code into `run-l2geth.sh` and modify the path to the `l2geth` directory
### Start `l2geth` with the following command
```sh
#!/usr/bin/bash
cd ../optimism-legacy/l2geth
USING_OVM=true \
ETH1_SYNC_SERVICE_ENABLE=false \
RPC_API=eth,rollup,net,web3,debug \
RPC_ENABLE=true \
RPC_PORT=8546 \ # need to rebind port because op-geth uses the same default port
./build/bin/geth --datadir ./datadir
```
### Run the following command to start `l2geth`:
```sh
./run-l2geth.sh
./build/bin/geth --datadir << /path/to/l2geth-datadir>>
```
</Steps>
## `op-geth`
## Start `op-geth`
<Steps>
### Navigate into your `scripts` directory:
### Create a new file:
```sh
touch run-op-geth.sh
```
### Make it executable:
### Navigate into your `op-geth` directory
```sh
chmod +x run-op-geth.sh
```
### Start `op-geth` with the following command
### Insert this snippet of code into `run-op-geth.sh` and modify the path to the `op-geth` directory.
* Make sure you update your path to your data directory
```sh
#! /usr/bin/bash
SEQUENCER_URL=https://mainnet-sequencer.optimism.io/
NET=op-mainnet
cd <<Path to op-geth directory>>
./build/bin/geth \
--datadir=./datadir \
--datadir=<</path/to/op-geth-datadir>> \
--http \
--http.port=8545 \
--http.addr=0.0.0.0 \
--authrpc.addr=localhost \
--authrpc.jwtsecret=./jwt.txt \
--verbosity=3 \
--rollup.sequencerhttp=$SEQUENCER_URL \
--rollup.sequencerhttp=https://mainnet-sequencer.optimism.io/ \
--nodiscover \
--syncmode=full \
--maxpeers=0 \
--op-network=$NET
--op-network=op-mainnet
```
<Callout type="info">
Expand All @@ -201,61 +161,29 @@ You will need 500+ GB for this part alone.
You will also need to add `--gcmode archive`.
</Callout>
### Run the following command to start `op-geth`:
```bash
./run-op-geth.sh
```
</Steps>
## `op-node`
## Start `op-node`
<Steps>
### Navigate to the `scripts` directory you created
### Create a new file:
```sh
touch run-op-node.sh
```
### Navigate to the `op-node` directory
### Make it executable:
```sh
chmod +x run-op-node.sh
```
### Start `op-node` with the following command
### Insert this snippet of code into `run-op-node.sh`:
* Change `L1 RPC URL` to your local L1 node or a service provider's URL for the L1 node (L1 Ethereum). E.g. for Infura, `https://mainnet.infura.io/v3/API_KEY`.
* Set `L1 RPC KIND` to the network provider you are using (options: alchemy, quicknode, infura, parity, nethermind, debug\_geth, erigon, basic, any).
* Set the `/path/to/op-geth/jwt.txt` to the path of the shared secret you generated in a previous step
```sh
#!/usr/bin/bash
L1URL=<< L1 RPC URL >>
L1KIND=basic
NET=op-mainnet
cd <<Path to op-node directory>>
./bin/op-node \
--l1=$L1URL \
--l1.rpckind=$L1KIND \
--l1=<< L1 RPC URL >> \
--l1.rpckind=<< L1 RPC KIND >> \
--l2=ws://localhost:8551 \
--l2.jwt-secret=./jwt.txt \
--network=$NET \
--l2.jwt-secret=<< /path/to/op-geth/jwt.txt >> \
--network=op-mainnet \
--rpc.addr=0.0.0.0 \
--rpc.port=8547
```
* Change `<< L1 RPC URL >>` to your local L1 node or a service provider's URL for the L1 node (L1 Ethereum). E.g. for Infura, `https://mainnet.infura.io/v3/API_KEY`.
* Set `L1KIND` to the network provider you are using (options: alchemy, quicknode, infura, parity, nethermind, debug\_geth, erigon, basic, any).
### Run the following command to start `op-node`:
```bash
./run-op-node.sh
```
</Steps>
## The initial synchronization
Expand Down
88 changes: 21 additions & 67 deletions pages/node-operators/building-node/testnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Callout, Steps } from 'nextra/components'
You need to know some prerequisite information on migrated vs. non-migrated networks shared in this section.

* Migrated Networks, *OP Mainnet* and *OP Goerli*, were running before the Bedrock upgrade.
* Non-Migrated Networks, *OP Sepolia*, have only existed in a post Bedrock world. The way transaction execution is handled is funadmentally different pre- vs post-bedrock.
* Non-Migrated Networks, *OP Sepolia*, have only existed in a post Bedrock world. The way transaction execution is handled is fundamentally different pre- vs post-bedrock.
* Migrated networks are required to initialize their nodes with a data directory and non-migrated networks can simply initialize from a genesis file.

## OP Sepolia Initialization
Expand All @@ -35,113 +35,67 @@ geth init \
## Create a shared secret between `op-geth` and `op-node`

<Steps>
### Navigate into your `op-geth` directory and run these commands:
### Navigate into your `op-geth` directory

### Create a random number

This will be the shared secret for `op-geth` and `op-node` to communicate over the engine API authrpc.

```sh
openssl rand -hex 32 > jwt.txt
cp jwt.txt ../optimism/op-node
```

### Create a new directory: `scripts`

Place it in the root of your working directory. These scripts will be used to start the different components.
</Steps>

## `op-geth`
## Start `op-geth`

<Steps>
### Create a new file:

```sh
touch run-op-geth.sh
```

### Make it executable:
### Navigate into your `op-geth` directory

```sh
chmod +x run-op-geth.sh
```
### Start `op-geth` with the following command

### Insert this snippet of code into `run-op-geth.sh` and modify the path to the `op-geth` directory.
* Make sure you update your path to your data directory

```sh
#! /usr/bin/bash
SEQUENCER_URL=https://sepolia-sequencer.optimism.io/
cd <<Path to op-geth directory>>
./build/bin/geth \
--datadir=./datadir \
--datadir=<</path/to/op-geth-datadir>> \
--http \
--http.port=8545 \
--http.addr=0.0.0.0 \
--authrpc.addr=localhost \
--authrpc.jwtsecret=./jwt.txt \
--verbosity=3 \
--rollup.sequencerhttp=$SEQUENCER_URL \
--rollup.sequencerhttp=https://sepolia-sequencer.optimism.io/ \
--nodiscover \
--syncmode=full \
--maxpeers=0 \
--op-network=op-sepolia
```
Other Sequencer URLs can be found here: [Networks, Public RPC Endpoints, & APIs](/tools/rpc-providers).
### Run the following command to start `op-geth`:
```bash
./run-op-geth.sh
```
</Steps>
## `op-node`
## Start `op-node`
<Steps>
### Navigate to the `scripts` directory you created
### Navigate to the `op-node` directory
### Create a new file:
```sh
touch run-op-node.sh
```
### Make it executable:
```sh
chmod +x run-op-node.sh
```
### Start `op-node` with the following command
### Insert this snippet of code into `run-op-node.sh`:
* Change `L1 RPC URL` to your local L1 node or a service provider's URL for the L1 node (L1 Ethereum). E.g. for Infura, `https://mainnet.infura.io/v3/API_KEY`.
* Set `L1 RPC KIND` to the network provider you are using (options: alchemy, quicknode, infura, parity, nethermind, debug\_geth, erigon, basic, any).
* Set the `/path/to/op-geth/jwt.txt` to the path of the shared secret you generated in a previous step
```sh
#!/usr/bin/bash
L1URL=<< L1 RPC URL >>
L1KIND=basic
cd <<Path to op-node directory>>
./bin/op-node \
--l1=$L1URL \
--l1.rpckind=$L1KIND \
--l1=<< L1 RPC URL >> \
--l1.rpckind=<< L1 RPC KIND >> \
--l2=ws://localhost:8551 \
--l2.jwt-secret=./jwt.txt \
--l2.jwt-secret=<< /path/to/op-geth/jwt.txt >> \
--rpc.addr=0.0.0.0 \
--rpc.port=8547 \
--network=op-sepolia \
--rollup.load-protocol-versions=true
```
* Change `<< L1 RPC URL >>` to your local L1 node or a service provider's URL for the L1 node (L1 Ethereum). E.g. for Infura, `https://sepolia.infura.io/v3/API_KEY`.
* Set `L1KIND` to the network provider you are using (options: alchemy, quicknode, infura, parity, nethermind, debug\_geth, erigon, basic, any).
### Run the following command to start `op-node`:
```bash
./run-op-node.sh
```
</Steps>
## The initial synchronization
Expand Down

0 comments on commit cbde721

Please sign in to comment.