Skip to main content
Docker images are the easiest way to run an OP Mainnet node, but you can always build your own node from source code. 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. This guide will walk you through the full process of building a node from source.

What you’re going to build

Rollup node

The Rollup Node is responsible for deriving L2 block payloads from L1 data and passing those payloads to the Execution Client. 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. The Rollup Node is largely analogous to a consensus client in Ethereum. In this tutorial you will build the op-node implementation of the Rollup Node as found in the Optimism Monorepo.

Execution client

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. 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. The Execution Client is largely analogous to an execution client in Ethereum.

    Legacy Geth (optional)

    Legacy Geth is an optional component for OP Mainnet archive nodes. Legacy Geth allows you to execute stateful queries like eth_call against blocks and transactions that occurred before the OP Mainnet Bedrock Upgrade. Legacy Geth is only relevant to OP Mainnet archive nodes and is not required for full nodes or OP Sepolia nodes. Currently, l2Geth is the only available implementation of Legacy Geth. In this tutorial you will build the l2geth implementation of Legacy Geth as found in the optimism-legacy repository.

    Software dependencies

    Our build environment is managed through a tool called mise. Mise provides a convenient way to install and manage all necessary dependencies for building and testing the packages in this repository. You can find the mise configuration in the mise.toml in the root of the Optimism Monorepo.

    Build the rollup node

    First you’re going to build the op-node implementation of the Rollup Node as found in the Optimism Monorepo.
    1

    Clone the Optimism Monorepo

    The Optimism Monorepo contains the source code for the op-node.
    git clone https://github.com/ethereum-optimism/optimism.git
    cd optimism
    
    2

    Check out the required release branch

    Release branches are created when new versions of the op-node are created. Read through the Releases page to determine the correct branch to check out.
    git checkout <name of release branch>
    
    Make sure to read the Releases page carefully to determine the correct branch to check out. Some releases may only be required for the OP Sepolia testnet.
    3

    Build `op-node`

    Build the op-node implementation of the Rollup Node.
    cd op-node
    just
    

    Build the execution client

    Next you’re going to build the op-geth implementation of the Execution Client as found in the op-geth repository.
    1

    Clone `op-geth`

    The op-geth repository contains the source code for the op-geth implementation of the Execution Client.
    git clone https://github.com/ethereum-optimism/op-geth.git
    cd op-geth
    
    2

    Check out the required release branch

    Release branches are created when new versions of the op-geth are created. Read through the Releases page to determine the correct branch to check out.
    git checkout <name of release branch>
    
    Make sure to read the Releases page carefully to determine the correct branch to check out. Some releases may only be required for the OP Sepolia testnet.
    3

    Build `op-geth`

    Build the op-geth implementation of the Execution Client.
    make geth
    

    Build legacy Geth (optional)

    Legacy Geth is an optional component for OP Mainnet archive nodes. Legacy Geth allows you to execute stateful queries like eth_call against blocks and transactions that occurred before the OP Mainnet Bedrock Upgrade. Legacy Geth is only relevant to OP Mainnet archive nodes and is not required for full nodes or OP Sepolia nodes.
    1

    Clone the OP Legacy Repository

    The OP Legacy repository contains the source code for the l2geth implementation of Legacy Geth.
    git clone https://github.com/ethereum-optimism/optimism-legacy.git
    cd optimism-legacy
    
    2

    Build l2geth

        cd l2geth
        make
    

    Next steps

    I