Base Node Documentation

repository·main·Indexed 13 days ago

https://github.com/base/node

Guide for deploying and configuring a Base node, an Ethereum L2 built on the OP Stack. Includes instructions for Docker-based deployment using base-reth-node for execution and base-consensus for consensus, hardware requirements, and environment configuration for mainnet and Sepolia testnet.

Tokens
1.3K
Snippets
5
Records
7
Agent score
50%

What's inside Base

  1. Hardware Requirements for Base Node

    main

    Minimum Requirements

    • CPU: Modern multicore CPU
    • RAM: 32GB (64GB recommended)
    • Storage: NVMe SSD
    • Storage Capacity: (2 * [current chain size] + [snapshot size] + 20% buffer)
    • Software: Docker and Docker Compose
    • Instance Type: AWS i7i.12xlarge
    • Storage Configuration: RAID 0 of all local NVMe drives (/dev/nvme*)
    • Filesystem: ext4
  2. Quick Start: Running a Base Node

    main

    To run a Base node using Docker Compose, follow these steps:

    1. Prepare L1 Endpoints: Ensure you have an Ethereum L1 full node RPC and a beacon endpoint available.
    2. Select Network Environment:
      • For mainnet, use the .env.mainnet file.
      • For testnet (Sepolia), use the .env.sepolia file.
    3. Configure L1 Endpoints: Edit your chosen .env file to include your L1 RPC and beacon endpoints:
      BASE_NODE_L1_ETH_RPC=<your-preferred-l1-rpc>
      BASE_NODE_L1_BEACON=<your-preferred-l1-beacon>
    4. Launch the Node:
      • Mainnet: Run docker compose up --build.
      • Testnet: Run NETWORK_ENV=.env.sepolia docker compose up --build.
    # For mainnet (default):
    docker compose up --build
    
    # For testnet:
    NETWORK_ENV=.env.sepolia docker compose up --build
  3. Configure Base Node Environment Variables

    main

    The Base node requires specific environment variables for operation. These should be set in your .env file.

    Required Settings

    • BASE_NODE_L1_ETH_RPC: Your Ethereum L1 node RPC endpoint.
    • BASE_NODE_L1_BEACON: Your L1 beacon node endpoint.
    • BASE_NODE_NETWORK: Set to base for mainnet or base-sepolia for testnet.
    • RETH_CHAIN: Set to base for mainnet or base-sepolia for testnet.

    Network-Specific Values

    NetworkRETH_CHAINBASE_NODE_NETWORKSequencer URL
    Mainnetbasebasehttps://mainnet-sequencer.base.org
    Sepoliabase-sepoliabase-sepoliahttps://sepolia-sequencer.base.org

    Optional Features

    • Flashblocks: Set RETH_FB_WEBSOCKET_URL to enable Flashblocks mode in the execution client. If unset, it runs in vanilla mode.
    • Follow mode: Set BASE_NODE_SOURCE_L2_RPC.
    • Pruning: Set RETH_PRUNING_ARGS.
  4. Use Flashblocks RPC to query pending blocks

    main

    When the node is running in Flashblocks mode (by setting RETH_FB_WEBSOCKET_URL), you can query a pending block using the eth_getBlockByNumber RPC method with the pending parameter.

    curl -X POST \
      --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["pending", false],"id":1}' \
      http://localhost:8545
  5. Configure the Node (Consensus) Service

    main

    The node service handles the consensus layer and depends on the execution service being running. It exposes RPC, P2P, metrics, and pprof ports. Network-specific configurations are loaded from the file specified by NETWORK_ENV (defaults to .env.mainnet).

    services:
      node:
        depends_on:
          - execution
        ports:
          - "7545:8545" # RPC
          - "9222:9222" # P2P TCP
          - "9222:9222/udp" # P2P UDP
          - "7300:7300" # metrics
          - "6060:6060" # pprof
        env_file:
          - ${NETWORK_ENV:-.env.mainnet}
  6. Configure the Execution Service

    main

    The execution service handles the execution layer of the node. It exposes RPC, websocket, metrics, and P2P ports. Data is persisted via a volume mapped to the host directory defined by HOST_DATA_DIR (defaults to ./reth-data). Network-specific configurations are loaded from the file specified by NETWORK_ENV (defaults to .env.mainnet).

    services:
      execution:
        ports:
          - "8545:8545" # RPC
          - "8546:8546" # websocket
          - "7301:6060" # metrics
          - "30303:30303" # P2P TCP
          - "30303:30303/udp" # P2P UDP
        volumes:
          - ${HOST_DATA_DIR:-./reth-data}:/data
        env_file:
          - ${NETWORK_ENV:-.env.mainnet}
  7. Set environment variables for network and data

    main

    The deployment uses two primary environment variables to control the node behavior via docker-compose:

    • HOST_DATA_DIR: Specifies the directory on the host machine where execution data is stored. Defaults to ./reth-data.
    • NETWORK_ENV: Specifies the environment file to use for network settings. Defaults to .env.mainnet. For testnets (e.g., Sepolia), set this to .env.sepolia.
    # Example: Running with a custom data directory and testnet configuration
    HOST_DATA_DIR=/path/to/custom/data NETWORK_ENV=.env.sepolia docker-compose up