Skip to content

Commit ea8cb92

Browse files
feat: update node from source doc
1 parent 254b0f6 commit ea8cb92

File tree

1 file changed

+127
-78
lines changed

1 file changed

+127
-78
lines changed

pages/builders/node-operators/tutorials/node-from-source.mdx

Lines changed: 127 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -8,123 +8,172 @@ import { Callout, Steps } from 'nextra/components'
88

99
# Building a Node from Source
1010

11-
Here are the instructions if you want to build your own node without relying on images from Optimism. These instructions were generated on an Ubuntu 20.04 LTS box, but they should work with other systems too.
11+
Docker images are the easiest way to run an OP Mainnet node, but you can always build your own node from source code.
12+
You might want to do this if you want to run a node on a specific architecture or if you want to inspect the source code of the node you're running.
13+
This guide will walk you through the full process of building a node from source.
1214

13-
## Before You Begin
15+
## What You're Going to Build
1416

15-
### Hardware requirements
17+
### Rollup Node
1618

17-
Nodes need to process and store the transaction history of OP Mainnet or OP Sepolia. They need to be relatively powerful machines (real or virtual). We recommend at least 16 GB RAM. We recommend a 2TB SSD for OP Mainnet, our current archive node usage is \~1TB. We recommend a 256GB SSD for OP Sepolia, or current full node usage is \~1.6GB and archive node usage is \~5.6GB.
19+
The Rollup Node is responsible for deriving L2 block payloads from L1 data and passing those payloads to the Execution Client.
20+
The Rollup Node can also optionally participate in a peer-to-peer network to receive blocks directly from the Sequencer before those blocks are submitted to L1.
21+
The Rollup Node is largely analogous to a [consensus client](https://ethereum.org/en/developers/docs/nodes-and-clients/#what-are-nodes-and-clients) in Ethereum.
1822

19-
### Software requirements
23+
In this tutorial you will build the `op-node` implementation of the Rollup Node as found in the [Optimism Monorepo](https://github.com/ethereum-optimism/optimism).
2024

21-
You'll need the following software installed to follow this tutorial:
25+
### Execution Client
2226

23-
* [Git](https://git-scm.com/)
24-
* [Go](https://go.dev/)
25-
* [nvm](https://github.com/nvm-sh/nvm)
26-
* [Node](https://nodejs.org/en)
27-
* [Pnpm](https://pnpm.io/)
28-
* [Foundry](https://github.com/foundry-rs/foundry#installation)
29-
* [Make](https://linux.die.net/man/1/make)
30-
* [jq](https://github.com/jqlang/jq)
31-
* [direnv](https://direnv.net/)
32-
* [zstd](https://facebook.github.io/zstd/)
27+
The Execution Client is responsible for executing the block payloads it receives from the Rollup Node over JSON-RPC via the standard [Ethereum Engine API](https://github.com/ethereum/execution-apis/blob/main/src/engine/common.md#engine-api----common-definitions).
28+
The Execution Client exposes the standard JSON-RPC API that Ethereum developers are familiar with, and can be used to query blockchain data and submit transactions to the network.
29+
The Execution Client is largely analogous to an [execution client](https://ethereum.org/en/developers/docs/nodes-and-clients/#what-are-nodes-and-clients) in Ethereum.
3330

34-
This tutorial was checked on:
31+
In this tutorial you will build the `op-geth` implementation of the Execution Client as found in the [`op-geth` repository](https://github.com/ethereum-optimism/op-geth).
3532

36-
| Software | Version | Installation command(s) | |
37-
| ----------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
38-
| Ubuntu | 20.04 LTS | | |
39-
| git, curl, jq, make, and zstd | OS default | `sudo apt update`, <br />`sudo apt install -y git curl make jq zstd` | |
40-
| Go | 1.20 | `wget https://go.dev/dl/go1.20.linux-amd64.tar.gz`, <br /> `tar xvzf go1.20.linux-amd64.tar.gz`, <br /> `sudo cp go/bin/go /usr/bin/go`, <br />`sudo mv go /usr/lib`, <br />`echo export GOROOT=/usr/lib/go >> ~/.bashrc` | |
41-
| Node | 18.17.1 | `nvm install 18.17.1`, <br /> `nvm use 18.17.1` | |
42-
| pnpm | 8.6.12 | `sudo npm install -g pnpm` | |
43-
| Foundry | 0.2.0 | \`curl -L [https://foundry.paradigm.xyz](https://foundry.paradigm.xyz) | bash`, <br /> `. \~/.bashrc`, <br /> `foundryup\` |
33+
### Legacy Geth (Optional)
34+
35+
Legacy Geth is an optional component for OP Mainnet archive nodes.
36+
Legacy Geth allows you to execute stateful queries like `eth_call` against blocks and transactions that occurred before the OP Mainnet [Bedrock Upgrade](https://blog.oplabs.co/introducing-optimism-bedrock/).
37+
Legacy Geth is only relevant to OP Mainnet archive nodes and is not required for full nodes or OP Sepolia nodes.
38+
39+
Currently, `l2Geth` is the only available implementation of Legacy Geth.
40+
In this tutorial you will build the `l2geth` implementation of Legacy Geth as found in the [`optimism-legacy` repository](https://github.com/ethereum-optimism/optimism-legacy).
41+
42+
## Software Dependencies
43+
44+
| Dependency | Version | Version Check Command |
45+
| ------------------------------------------------------------- | -------- | --------------------- |
46+
| [git](https://git-scm.com/) | `^2` | `git --version` |
47+
| [go](https://go.dev/) | `^1.21` | `go version` |
48+
| [node](https://nodejs.org/en/) | `^20` | `node --version` |
49+
| [pnpm](https://pnpm.io/installation) | `^8` | `pnpm --version` |
50+
| [foundry](https://github.com/foundry-rs/foundry#installation) | `^0.2.0` | `forge --version` |
51+
| [make](https://linux.die.net/man/1/make) | `^4` | `make --version` |
52+
53+
## Build the Rollup Node
54+
55+
First you're going to build the `op-node` implementation of the Rollup Node as found in the [Optimism Monorepo](https://github.com/ethereum-optimism/optimism).
4456

45-
## Build the Optimism Monorepo
4657

4758
<Steps>
48-
### Navigate to your working directory
4959

50-
### Clone the [Optimism Monorepo](https://github.com/ethereum-optimism/optimism)
60+
{<h3>Clone the Optimism Monorepo</h3>}
61+
62+
The Optimism Monorepo contains the source code for the `op-node`.
63+
64+
```bash
65+
git clone https://github.com/ethereum-optimism/optimism.git
66+
cd optimism
67+
```
68+
69+
{<h3>Check out the required release branch</h3>}
70+
71+
Release branches are created when new versions of the `op-node` are created.
72+
Read through the [Releases page](https://github.com/ethereum-optimism/optimism/releases) to determine the correct branch to check out.
73+
74+
```bash
75+
git checkout <name of release branch>
76+
```
77+
78+
<Callout>
79+
Make sure to read the Releases page carefully to determine the correct branch to check out.
80+
Some releases may only be required for the OP Sepolia testnet.
81+
</Callout>
82+
83+
{<h3>Install Node.js dependencies</h3>}
84+
85+
Install the Node.js dependencies for the Optimism Monorepo.
5186

52-
<Callout type="info">
53-
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).
54-
</Callout>
87+
```bash
88+
pnpm install
89+
```
5590

56-
```bash
57-
git clone https://github.com/ethereum-optimism/optimism.git
58-
```
91+
{<h3>Build Node.js packages</h3>}
5992

60-
### Install required modules
93+
Build the Node.js packages for the Optimism Monorepo.
6194

62-
```bash
63-
cd optimism
64-
pnpm install
65-
```
95+
```bash
96+
pnpm build
97+
```
6698

67-
### Build the various packages inside of the Optimism Monorepo
99+
{<h3>Build op-node</h3>}
68100

69-
```bash
70-
make op-node
71-
pnpm build
72-
```
101+
Build the `op-node` implementation of the Rollup Node.
102+
103+
```bash
104+
make op-node
105+
```
73106

74-
This process will take some time, so you can move onto the next section while the build completes.
75107
</Steps>
76108

77-
## Build op-geth
109+
## Build the Execution Client
110+
111+
Next you're going to build the `op-geth` implementation of the Execution Client as found in the [op-geth repository](https://github.com/ethereum-optimism/op-geth).
78112

79113
<Steps>
80-
### Navigate to your working directory
81114

82-
### Clone [`op-geth`](https://github.com/ethereum-optimism/op-geth)
115+
{<h3>Clone op-geth</h3>}
83116

84-
<Callout type="info">
85-
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).
86-
</Callout>
117+
The [`op-geth` repository](https://github.com/ethereum-optimism/op-geth) contains the source code for the `op-geth` implementation of the Execution Client.
87118

88-
```bash
89-
git clone https://github.com/ethereum-optimism/op-geth.git
90-
```
119+
```bash
120+
git clone https://github.com/ethereum-optimism/op-geth.git
121+
cd op-geth
122+
```
91123

92-
### Build `op-geth`
124+
{<h3>Check out the required release branch</h3>}
93125

94-
```bash
95-
cd op-geth
96-
make geth
97-
```
98-
</Steps>
99126

100-
## (Optional - OP Mainnet Archive Node) Build l2geth
127+
Release branches are created when new versions of the `op-geth` are created.
128+
Read through the [Releases page](https://github.com/ethereum-optimism/op-geth/releases) to determine the correct branch to check out.
129+
130+
```bash
131+
git checkout <name of release branch>
132+
```
101133

102-
<Callout type="info">
103-
OP Mainnet Archive Node
104-
This step is only necessary for OP Mainnet archive nodes. If you're building a OP Testnet archive node, you do not need to do this step.
134+
<Callout>
135+
Make sure to read the Releases page carefully to determine the correct branch to check out.
136+
Some releases may only be required for the OP Sepolia testnet.
105137
</Callout>
106138

139+
{<h3>Build op-geth</h3>}
140+
141+
Build the `op-geth` implementation of the Execution Client.
142+
143+
```bash
144+
make op-geth
145+
```
146+
147+
</Steps>
148+
149+
## Build Legacy Geth (Optional)
150+
151+
Legacy Geth is an optional component for OP Mainnet archive nodes.
152+
Legacy Geth allows you to execute stateful queries like `eth_call` against blocks and transactions that occurred before the OP Mainnet [Bedrock Upgrade](https://blog.oplabs.co/introducing-optimism-bedrock/).
153+
Legacy Geth is only relevant to OP Mainnet archive nodes and is not required for full nodes or OP Sepolia nodes.
154+
107155
<Steps>
108-
### Navigate to your working directory
109156

110-
### Clone [`l2geth`](https://github.com/ethereum-optimism/optimism-legacy)
157+
{<h3>Clone the OP Legacy Repository</h3>}
111158

112-
```bash
113-
git clone https://github.com/ethereum-optimism/optimism-legacy.git
114-
```
159+
The OP Legacy repository contains the source code for the `l2geth` implementation of Legacy Geth.
115160

116-
### Build `l2geth`
161+
```bash
162+
git clone https://github.com/ethereum-optimism/optimism-legacy.git
163+
cd optimism-legacy
164+
```
165+
166+
{<h3>Build l2geth</h3>}
167+
168+
```bash
169+
cd l2geth
170+
make
171+
```
117172

118-
```bash
119-
cd optimism-legacy/l2geth
120-
make
121-
```
122173
</Steps>
123174

124175
## Next Steps
125176

126-
The rest of the steps depend on whether you want to run an OP Mainnet or OP Sepolia node.
127-
128-
* Click here to continue [building on OP Mainnet](mainnet)
129-
* Click here to continue [building on OP Testnet](testnet)
177+
* Click here to [Run an OP Mainnet Node from Source Code](mainnet)
178+
* Click here to [Run an OP Sepolia Node from Source Code](testnet)
130179
* If you run into any problems, please visit the [Node Troubleshooting Guide](../management/troubleshooting) for help.

0 commit comments

Comments
 (0)