Building a Node from Source
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.
Before You Begin
Hardware requirements
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.
Software requirements
You’ll need the following software installed to follow this tutorial:
- Git (opens in a new tab)
- Go (opens in a new tab)
- nvm (opens in a new tab)
- Node (opens in a new tab)
- Pnpm (opens in a new tab)
- Foundry (opens in a new tab)
- Make (opens in a new tab)
- jq (opens in a new tab)
- direnv (opens in a new tab)
- zstd (opens in a new tab)
This tutorial was checked on:
Software | Version | Installation command(s) |
---|---|---|
Ubuntu | 20.04 LTS | |
git, curl, jq, make, and zstd | OS default | sudo apt update , sudo apt install -y git curl make jq zstd |
Go | 1.20 | wget https://go.dev/dl/go1.20.linux-amd64.tar.gz , tar xvzf go1.20.linux-amd64.tar.gz , sudo cp go/bin/go /usr/bin/go , sudo mv go /usr/lib , echo export GOROOT=/usr/lib/go >> ~/.bashrc |
Node | 18.17.1 | nvm install 18.17.1 , nvm use 18.17.1 |
pnpm | 8.6.12 | sudo npm install -g pnpm |
Foundry | 0.2.0 | `curl -L https://foundry.paradigm.xyz (opens in a new tab) |
Build the Optimism Monorepo
Navigate to your working directory
Clone the Optimism Monorepo (opens in a new tab)
If you want to run the same version we're using in production, you can checkout our latest release commit (opens in a new tab).
git clone https://github.com/ethereum-optimism/optimism.git
Install required modules
cd optimism
pnpm install
Build the various packages inside of the Optimism Monorepo
make op-node
pnpm build
This process will take some time, so you can move onto the next section while the build completes.
Build op-geth
Navigate to your working directory
Clone op-geth
(opens in a new tab)
If you want to run the same version we're using in production, you can checkout our latest release commit (opens in a new tab).
git clone https://github.com/ethereum-optimism/op-geth.git
Build op-geth
cd op-geth
make geth
(Optional - OP Mainnet Archive Node) Build l2geth
OP Mainnet Archive Node 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.
Navigate to your working directory
Clone l2geth
(opens in a new tab)
git clone https://github.com/ethereum-optimism/optimism-legacy.git
Build l2geth
cd optimism-legacy/l2geth
make
Next Steps
The rest of the steps depend on whether you want to run an OP Mainnet or OP Sepolia node.
- Click here to continue building on OP Mainnet
- Click here to continue building on OP Testnet
- If you run into any problems, please visit the Node Troubleshooting Guide for help.