Builders
Node Operators
Tutorials
Building a Node from Source

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:

This tutorial was checked on:

SoftwareVersionInstallation command(s)
Ubuntu20.04 LTS
git, curl, jq, make, and zstdOS defaultsudo apt update,
sudo apt install -y git curl make jq zstd
Go1.20wget 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
Node18.17.1nvm install 18.17.1,
nvm use 18.17.1
pnpm8.6.12sudo npm install -g pnpm
Foundry0.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.