Building a Node from Source


Here are the instructions if you want to build you own node without relying on our images. These instructions were generated on an Ubuntu 20.04 LTS box, but they should work with other systems too.

# Prerequisites

# 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:

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 | bash,
. ~/.bashrc,
foundryup

# Building the software

# Build the Optimism Monorepo

  1. Navigate to your working directory.

  2. Clone the Optimism Monorepo (opens new window).

    git clone https://github.com/ethereum-optimism/optimism.git
    
    1
  3. Install required modules.

    cd optimism
    pnpm install
    
    1
    2
  4. Build the various packages inside of the Optimism Monorepo.

    make op-node
    pnpm build
    
    1
    2

This process will take some time, so you can move onto the next section while the build completes.

# Build op-geth

  1. Navigate to your working directory.

  2. Clone op-geth (opens new window):

    git clone https://github.com/ethereum-optimism/op-geth.git
    
    1
  3. Build op-geth:

    cd op-geth    
    make geth
    
    1
    2

# (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.

  1. Navigate to your working directory

  2. Clone l2geth (opens new window)

    git clone https://github.com/ethereum-optimism/optimism-legacy.git
    
    1
  3. Build l2geth:

    cd optimism-legacy/l2geth
    make
    
    1
    2

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