### Flashblocks Configuration Example Source: https://github.com/base/node/blob/main/_autodocs/03-execution-client-reference.md Example of setting the Flashblocks websocket endpoint environment variable. ```bash RETH_FB_WEBSOCKET_URL=wss://mainnet.flashblocks.base.org/ws ``` -------------------------------- ### Start Base Node (Mainnet) Source: https://github.com/base/node/blob/main/README.md Build and run the Base node for the mainnet using Docker Compose. This command starts the node with default mainnet configurations. ```bash docker compose up --build ``` -------------------------------- ### Start Node with Docker Compose Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Commands to launch the node using different network configurations and data storage settings. ```bash # Using default mainnet configuration docker compose up --build ``` ```bash # Using Sepolia testnet configuration NETWORK_ENV=.env.sepolia docker compose up --build ``` ```bash # Store blockchain data in /mnt/nvme instead of ./reth-data HOST_DATA_DIR=/mnt/nvme docker compose up --build ``` ```bash # Run services in background (detached mode) docker compose up -d --build ``` -------------------------------- ### Pruning Configuration Example Source: https://github.com/base/node/blob/main/_autodocs/03-execution-client-reference.md Example of defining multiple pruning distance arguments via the RETH_PRUNING_ARGS variable. ```bash RETH_PRUNING_ARGS="--prune.senderrecovery.distance=50000 --prune.transactionlookup.distance=50000" ``` -------------------------------- ### Start Node for Sync Detection Source: https://github.com/base/node/blob/main/_autodocs/09-bash-scripts-reference.md Starts the Reth node in the background to prepare for sync verification. ```bash "$BINARY" node \ -$LOG_LEVEL \ --datadir="$RETH_DATA_DIR" \ --log.stdout.format json \ --http \ --http.addr=127.0.0.1 \ --http.port="$RPC_PORT" \ --http.api=eth \ --chain "$RETH_CHAIN" & PID=$! MAX_WAIT=$((60 * 60 * 6)) # 6 hours ``` -------------------------------- ### Interact with RPC using web3.py Source: https://github.com/base/node/blob/main/_autodocs/06-rpc-endpoints.md Standard provider setup for web3.py. Note that balance returns values in Wei. ```python from web3 import Web3 w3 = Web3(Web3.HTTPProvider('http://localhost:8545')) # Get block number block_num = w3.eth.block_number # Get balance (returns Wei) balance = w3.eth.get_balance('0x...') # Call function call_result = w3.eth.call({ 'to': contract_address, 'data': function_signature }) ``` -------------------------------- ### Deploy Multiple Nodes Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Commands to initialize and start separate mainnet and testnet node instances using Docker Compose. ```bash # Create separate directories mkdir -p node-mainnet node-sepolia # Run mainnet node cd node-mainnet cp ../docker-compose.yml ../execution-entrypoint ../consensus-entrypoint . docker compose up -d # Run testnet node (different ports) cd ../node-sepolia cp ../docker-compose.yml ../execution-entrypoint ../consensus-entrypoint . NETWORK_ENV=.env.sepolia \ HOST_DATA_DIR=./reth-data-sepolia \ COMPOSE_PROJECT_NAME=base-sepolia \ docker compose up -d ``` -------------------------------- ### Start Base Node (Testnet) Source: https://github.com/base/node/blob/main/README.md Build and run the Base node for the Sepolia testnet using Docker Compose. Specify the testnet environment file to use the correct network settings. ```bash NETWORK_ENV=.env.sepolia docker compose up --build ``` -------------------------------- ### Pull and Run from Registry Source: https://github.com/base/node/blob/main/_autodocs/08-dockerfile-and-build.md Configures Docker Compose to use prebuilt images from a registry and starts the services. ```yaml # docker-compose.prod.yml services: execution: image: myregistry.com/base-node:v1.0.0 # Use prebuilt image # No build section node: image: myregistry.com/base-node:v1.0.0 ``` ```bash # Start using prebuilt image docker compose -f docker-compose.prod.yml up ``` -------------------------------- ### Execute Docker Compose Build Source: https://github.com/base/node/blob/main/_autodocs/08-dockerfile-and-build.md Standard command to build and start services using Docker Compose. ```bash # Build command docker compose up --build # Steps: # 1. Read Dockerfile # 2. Compile image layers # 3. Tag as project_execution and project_node # 4. Create execution service container # 5. Create consensus service container # 6. Start both services ``` -------------------------------- ### Mount NVMe Storage Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Starts the node using a specific host directory for high-performance storage. ```bash # Mount NVMe RAID 0 array HOST_DATA_DIR=/mnt/nvme0_raid docker compose up # Verify mount df -h /mnt/nvme0_raid # Expected: High IOPS, low latency ``` -------------------------------- ### Configure L1 Endpoints Source: https://github.com/base/node/blob/main/README.md Set your Ethereum L1 full node RPC and beacon endpoints in the .env file. This is a required step before starting the node. ```bash BASE_NODE_L1_ETH_RPC= BASE_NODE_L1_BEACON= ``` -------------------------------- ### Launch Reth Node Command Source: https://github.com/base/node/blob/main/_autodocs/03-execution-client-reference.md Use this command structure to start the Reth execution client with configured RPC, WebSocket, and P2P settings. ```bash $BINARY node \ -$LOG_LEVEL \ --datadir="$RETH_DATA_DIR" \ --log.stdout.format json \ --ws \ --ws.origins="*" \ --ws.addr=0.0.0.0 \ --ws.port="$WS_PORT" \ --ws.api=web3,debug,eth,net,txpool \ --http \ --http.corsdomain="*" \ --http.addr=0.0.0.0 \ --http.port="$RPC_PORT" \ --http.api=web3,debug,eth,net,txpool,miner \ --ipcpath="$IPC_PATH" \ --authrpc.addr=0.0.0.0 \ --authrpc.port="$AUTHRPC_PORT" \ --authrpc.jwtsecret="$BASE_NODE_L2_ENGINE_AUTH" \ --metrics=0.0.0.0:"$METRICS_PORT" \ --max-outbound-peers=100 \ --chain "$RETH_CHAIN" \ --rollup.sequencer-http="$RETH_SEQUENCER_HTTP" \ --rollup.disable-tx-pool-gossip \ --discovery.port="$DISCOVERY_PORT" \ --discovery.v5.port="$V5_DISCOVERY_PORT" \ --port="$P2P_PORT" \ $ADDITIONAL_ARGS ``` -------------------------------- ### Execute Consensus Client in Follow Mode Source: https://github.com/base/node/blob/main/_autodocs/04-consensus-client-reference.md Starts the consensus client in follow mode, which utilizes state sync from an external RPC and requires fewer resources. ```bash ./base-consensus follow ``` -------------------------------- ### Get Client Version via web3_clientVersion Source: https://github.com/base/node/blob/main/_autodocs/06-rpc-endpoints.md Returns the client version string of the node. ```bash curl -X POST http://localhost:8545 \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "method": "web3_clientVersion", "params": [], "id": 1 }' # Response: # {"jsonrpc":"2.0","result":"Reth/1.0.0/linux-x64","id":1} ``` -------------------------------- ### Interact with RPC using web3.js Source: https://github.com/base/node/blob/main/_autodocs/06-rpc-endpoints.md Standard provider setup for web3.js. Use for block queries, balance checks, and transaction counts. ```javascript const Web3 = require('web3'); const web3 = new Web3('http://localhost:8545'); // Get block number const blockNumber = await web3.eth.getBlockNumber(); // Get balance const balance = await web3.eth.getBalance('0x...'); // Get account nonce const nonce = await web3.eth.getTransactionCount('0x...'); ``` -------------------------------- ### L1 Beacon Chain Endpoint Examples Source: https://github.com/base/node/blob/main/_autodocs/07-network-reference.md Examples of beacon node REST API endpoints for consensus layer state retrieval. ```bash # Beacon node with REST API https://eth-beacon.alchemyapi.io https://beacon-mainnet.infura.io https://your-beacon-node.internal:3500 ``` -------------------------------- ### L1 RPC Endpoint Examples Source: https://github.com/base/node/blob/main/_autodocs/07-network-reference.md Commonly used L1 RPC endpoints for public providers and private operators. ```bash # Public free tier https://eth-mainnet.alchemyapi.io/v2/YOUR-KEY https://mainnet.infura.io/v3/YOUR-KEY # Private operators https://your-eth-node.internal:8545 ``` -------------------------------- ### Execute Consensus Client in Node Mode Source: https://github.com/base/node/blob/main/_autodocs/04-consensus-client-reference.md Starts the consensus client in standard node mode with full block validation and P2P participation enabled. ```bash ./base-consensus node ``` -------------------------------- ### Structured Log Format Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Example of the JSON log format used for compatibility with log aggregation tools. ```json { "timestamp": "2026-07-15T10:32:00.000Z", "level": "INFO", "message": "Block imported", "block_number": "19150000", "block_hash": "0x...", "source": "execution" } ``` -------------------------------- ### Interact with RPC using ethers.js Source: https://github.com/base/node/blob/main/_autodocs/06-rpc-endpoints.md Standard provider setup for ethers.js. Use for block queries, balance checks, and contract calls. ```javascript const ethers = require('ethers'); const provider = new ethers.providers.JsonRpcProvider( 'http://localhost:8545' ); // Get block number const blockNumber = await provider.getBlockNumber(); // Get balance const balance = await provider.getBalance('0x...'); // Call contract const result = await provider.call({ to: contractAddress, data: contractInterface.encodeFunctionData('balanceOf', [account]) }); ``` -------------------------------- ### Find documentation by problem Source: https://github.com/base/node/blob/main/_autodocs/README.md Recommended reading sequence for troubleshooting node startup or crash issues. ```text Node won't start / Node crashed → Read: 10-troubleshooting-guide.md reference other docs as needed ``` -------------------------------- ### Find documentation by task Source: https://github.com/base/node/blob/main/_autodocs/README.md Recommended reading sequence for users looking to deploy a node. ```text I want to deploy a node → Read: INDEX.md (Quick Reference: By Task) then 05-deployment-guide.md then 02-environment-configuration.md for variables ``` -------------------------------- ### Execute Proofs Initialization Source: https://github.com/base/node/blob/main/_autodocs/09-bash-scripts-reference.md Runs the proofs initialization command after configuring the necessary arguments. ```bash ADDITIONAL_ARGS="$ADDITIONAL_ARGS --proofs-history --proofs-history.storage-path=$RETH_HISTORICAL_PROOFS_STORAGE_PATH" "$BINARY" proofs init \ -$LOG_LEVEL \ --log.stdout.format json \ --chain "$RETH_CHAIN" \ --datadir="$RETH_DATA_DIR" \ --proofs-history.storage-path=$RETH_HISTORICAL_PROOFS_STORAGE_PATH ``` -------------------------------- ### Execution Client Startup Output Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Expected log output during the initial 30-60 seconds of the execution client startup. ```text Starting reth with additional args: ... Initialized genesis with hash: 0x... Engine API listening on 0.0.0.0:8551 HTTP API listening on 0.0.0.0:8545 WebSocket API listening on 0.0.0.0:8546 Metrics listening on 0.0.0.0:6060 ``` -------------------------------- ### Select Environment Configuration Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Demonstrates how to use the NETWORK_ENV variable to point to specific environment files. ```bash # Default (mainnet) docker compose up # Reads: .env.mainnet # Override (testnet) NETWORK_ENV=.env.sepolia docker compose up # Reads: .env.sepolia # Custom NETWORK_ENV=/path/to/custom.env docker compose up # Reads: /path/to/custom.env ``` -------------------------------- ### GET /metrics Source: https://github.com/base/node/blob/main/_autodocs/03-execution-client-reference.md Retrieves node metrics, such as the execution chain height. ```APIDOC ## GET http://localhost:6060/metrics ### Description Retrieves node metrics. Can be filtered to view specific metrics like reth_execution_chain_height. ### Method GET ### Endpoint http://localhost:6060/metrics ``` -------------------------------- ### Download and Use Snapshots Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Downloads a pre-synced snapshot to accelerate initial node synchronization. ```bash # Download snapshot curl -L https://snapshot.example.com/base-mainnet.tar.gz \ -o base-snapshot.tar.gz # Extract to data directory mkdir -p ./reth-data tar -xzf base-snapshot.tar.gz -C ./reth-data/ # Start node (will resume from snapshot) docker compose up -d ``` -------------------------------- ### Consensus Client Startup Sequence Source: https://github.com/base/node/blob/main/_autodocs/04-consensus-client-reference.md The sequential steps performed by the process during initialization, including environment validation and health checks. ```text 1. Load environment variables from docker-compose env_file 2. Source BASE_NODE_NETWORK validation 3. Validate BASE_NODE_L2_ENGINE_RPC 4. Validate BASE_NODE_L2_ENGINE_AUTH 5. Validate BASE_NODE_L2_ENGINE_AUTH_RAW 6. Poll execution client health (HTTP 401 on engine endpoint) 7. Detect public IP via external services 8. Write JWT secret to file 9. Check for BASE_NODE_SOURCE_L2_RPC 10. Execute base-consensus with appropriate mode (node or follow) ``` -------------------------------- ### Find documentation by component Source: https://github.com/base/node/blob/main/_autodocs/README.md Recommended reading sequence for users researching the consensus client. ```text I need to understand the consensus client → Read: 04-consensus-client-reference.md with 02-environment-configuration.md for variables with 09-bash-scripts-reference.md (consensus-entrypoint section) ``` -------------------------------- ### Consensus Client Startup Output Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Expected log output for the consensus client after the execution client is ready. ```text Running base-consensus in node mode (or follow mode) Fetched public IP is: 203.0.113.42 Connecting to Engine API: ws://execution:8551 Connected to L1 endpoint: https://... P2P server listening on 0.0.0.0:9222 Starting peer discovery with bootnodes... Found peer: {enr}... Syncing headers from peers... ``` -------------------------------- ### Advertised P2P Information ENR Record Source: https://github.com/base/node/blob/main/_autodocs/04-consensus-client-reference.md Example structure of the ENR record generated using P2P configuration variables. ```json { "ip": "BASE_NODE_P2P_ADVERTISE_IP", "tcp": BASE_NODE_P2P_ADVERTISE_TCP_PORT, "udp": BASE_NODE_P2P_ADVERTISE_UDP_PORT } ``` -------------------------------- ### Specify environment file for startup Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Run Docker Compose with a specific environment file to ensure variables are loaded. ```bash NETWORK_ENV=.env.mainnet docker compose up ``` -------------------------------- ### Define network environment variables Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Add the appropriate network configuration to your environment file. ```bash # .env.mainnet or .env.sepolia BASE_NODE_NETWORK=base # For mainnet BASE_NODE_NETWORK=base-sepolia # For testnet ``` -------------------------------- ### View Detailed Build Logs Source: https://github.com/base/node/blob/main/_autodocs/08-dockerfile-and-build.md Executes a build with plain progress output to see detailed logs. ```bash # View build output with details docker build --progress=plain -t base-node:latest . ``` -------------------------------- ### Enable Flashblocks Support via Environment Variable Source: https://github.com/base/node/blob/main/_autodocs/03-execution-client-reference.md Conditional logic to append the websocket URL to startup arguments if the environment variable is set. ```bash if [[ -n "${RETH_FB_WEBSOCKET_URL:-}" ]]; then ADDITIONAL_ARGS="$ADDITIONAL_ARGS --websocket-url=$RETH_FB_WEBSOCKET_URL" echo "Enabling Flashblocks support with endpoint: $RETH_FB_WEBSOCKET_URL" else echo "Running in vanilla node mode (no Flashblocks URL provided)" fi ``` -------------------------------- ### Validate Required Environment Variables Source: https://github.com/base/node/blob/main/_autodocs/04-consensus-client-reference.md Ensures essential configuration variables are present before the consensus client starts. Fails with an error message if any required variable is unset. ```bash # BASE_NODE_NETWORK must be set if [[ -z "${BASE_NODE_NETWORK:-}" ]]; then echo "expected BASE_NODE_NETWORK to be set" 1>&2 exit 1 fi # BASE_NODE_L2_ENGINE_RPC must be set if [[ -z "${BASE_NODE_L2_ENGINE_RPC:-}" ]]; then echo "expected BASE_NODE_L2_ENGINE_RPC to be set" 1>&2 exit 1 fi # BASE_NODE_L2_ENGINE_AUTH must be set if [[ -z "${BASE_NODE_L2_ENGINE_AUTH:-}" ]]; then echo "expected BASE_NODE_L2_ENGINE_AUTH to be set" 1>&2 exit 1 fi # BASE_NODE_L2_ENGINE_AUTH_RAW must be set if [[ -z "${BASE_NODE_L2_ENGINE_AUTH_RAW:-}" ]]; then echo "expected BASE_NODE_L2_ENGINE_AUTH_RAW to be set" 1>&2 exit 1 fi ``` -------------------------------- ### Visualize Service Dependency Graph Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Represents the startup sequence and dependency flow between the execution and consensus services. ```text docker-compose up ↓ Execution Service ├─ Builds Docker image ├─ Starts reth execution client ├─ Waits for initialization └─ Ready when Engine API responds (HTTP 401) ↓ Consensus Service ├─ Depends on: execution service health ├─ Polls execution client readiness ├─ Starts base-consensus ├─ Connects to Engine API ├─ Discovers peers via bootstrap nodes └─ Begins synchronization ``` -------------------------------- ### Execute Reth Node Process Source: https://github.com/base/node/blob/main/_autodocs/09-bash-scripts-reference.md Starts the Reth node using the exec command to replace the current shell process, ensuring the node receives container signals directly. ```bash exec "$BINARY" node \ -$LOG_LEVEL \ --datadir="$RETH_DATA_DIR" \ --log.stdout.format json \ --ws \ --ws.origins="*" \ --ws.addr=0.0.0.0 \ --ws.port="$WS_PORT" \ --ws.api=web3,debug,eth,net,txpool \ --http \ --http.corsdomain="*" \ --http.addr=0.0.0.0 \ --http.port="$RPC_PORT" \ --http.api=web3,debug,eth,net,txpool,miner \ --ipcpath="$IPC_PATH" \ --authrpc.addr=0.0.0.0 \ --authrpc.port="$AUTHRPC_PORT" \ --authrpc.jwtsecret="$BASE_NODE_L2_ENGINE_AUTH" \ --metrics=0.0.0.0:"$METRICS_PORT" \ --max-outbound-peers=100 \ --chain "$RETH_CHAIN" \ --rollup.sequencer-http="$RETH_SEQUENCER_HTTP" \ --rollup.disable-tx-pool-gossip \ --discovery.port="$DISCOVERY_PORT" \ --discovery.v5.port="$V5_DISCOVERY_PORT" \ --port="$P2P_PORT" \ $ADDITIONAL_ARGS ``` -------------------------------- ### Select Minimal Base Images Source: https://github.com/base/node/blob/main/_autodocs/08-dockerfile-and-build.md Use minimal base images to reduce attack surface and improve build performance. ```dockerfile # Alpine Linux (minimal, faster build/pull) FROM alpine:latest # Distroless (security-focused, production-grade) FROM gcr.io/distroless/base-debian11 ``` -------------------------------- ### Configure Base Mainnet Source: https://github.com/base/node/blob/main/_autodocs/03-execution-client-reference.md Configuration parameters for connecting to the Base mainnet. ```text --chain base RETH_CHAIN=base RETH_SEQUENCER_HTTP=https://mainnet-sequencer.base.org ``` -------------------------------- ### Run Interactive Container Build Source: https://github.com/base/node/blob/main/_autodocs/08-dockerfile-and-build.md Builds an image and opens an interactive bash shell inside the container. ```bash # Build and jump into container at specific step docker build -t base-node:debug . docker run -it base-node:debug bash ``` -------------------------------- ### Initialize Historical Proofs Source: https://github.com/base/node/blob/main/_autodocs/09-bash-scripts-reference.md Conditional block for triggering the historical proofs initialization sequence. ```bash if [[ "$RETH_HISTORICAL_PROOFS" == "true" && -n "$RETH_HISTORICAL_PROOFS_STORAGE_PATH" ]]; then # Multi-step initialization sequence... fi ``` -------------------------------- ### Use Snapshots for Sync Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Download and extract a pre-synced snapshot to bypass initial synchronization time. ```bash # Download pre-synced snapshot curl -L https://snapshot.example.com/base-latest.tar.gz -O # Stop node docker compose stop # Extract snapshot rm -rf ./reth-data tar -xzf base-latest.tar.gz # Restart docker compose up -d ``` -------------------------------- ### Monitor Service Logs Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Use these commands to inspect logs for the entire stack or specific services to troubleshoot startup issues. ```bash # View all service logs docker compose logs -f # View execution client logs only docker compose logs -f execution # View consensus client logs only docker compose logs -f node # View last 100 lines docker compose logs --tail=100 ``` -------------------------------- ### Configure Base Network Environment Variables Source: https://github.com/base/node/blob/main/_autodocs/04-consensus-client-reference.md Environment variables required to connect a node to the Base network. Use the appropriate RPC and sequencer endpoints for the target network. ```bash BASE_NODE_NETWORK=base BASE_NODE_L1_ETH_RPC=https://eth-mainnet.example.com BASE_NODE_L1_BEACON=https://beacon.example.com RETH_SEQUENCER_HTTP=https://mainnet-sequencer.base.org ``` ```bash BASE_NODE_NETWORK=base-sepolia BASE_NODE_L1_ETH_RPC=https://sepolia.example.com BASE_NODE_L1_BEACON=https://sepolia-beacon.example.com RETH_SEQUENCER_HTTP=https://sepolia-sequencer.base.org ``` -------------------------------- ### Manage Node Backups and Archives Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Commands to create, list, and archive node data backups to ensure data safety. ```bash # Create backup docker compose stop tar -czf reth-backup-$(date +%Y%m%d-%H%M%S).tar.gz ./reth-data docker compose up -d # List backups ls -lh reth-backup-*.tar.gz # Archive old backups tar -czf reth-backups-archive-2026-Q2.tar.gz reth-backup-202604*.tar.gz rm reth-backup-202604*.tar.gz ``` -------------------------------- ### Configure Firewall Ports Source: https://github.com/base/node/blob/main/_autodocs/07-network-reference.md Opens necessary TCP and UDP ports for P2P communication using ufw. ```bash # Open ports sudo ufw allow 30303/tcp sudo ufw allow 30303/udp sudo ufw allow 9222/tcp sudo ufw allow 9222/udp ``` -------------------------------- ### Migrate to NVMe Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Move the data directory to faster storage to improve I/O performance. ```bash # Copy to faster storage sudo cp -r ./reth-data /mnt/nvme/ # Restart with new location HOST_DATA_DIR=/mnt/nvme/reth-data docker compose up ``` -------------------------------- ### Manage Background and Foreground Processes Source: https://github.com/base/node/blob/main/_autodocs/09-bash-scripts-reference.md Demonstrates the difference between running commands in the background using the ampersand operator and running them in the foreground. ```bash command & # Background — script continues immediately # PID captured in $! command # Foreground — script waits for completion # Script can check exit status ``` -------------------------------- ### Container Entrypoint Commands Source: https://github.com/base/node/blob/main/_autodocs/08-dockerfile-and-build.md Commands to define the entrypoint scripts for execution and consensus services. ```bash command: ["bash", "./execution-entrypoint"] ``` ```bash command: ["bash", "./consensus-entrypoint"] ``` -------------------------------- ### Manual Docker Build Commands Source: https://github.com/base/node/blob/main/_autodocs/08-dockerfile-and-build.md Commands for building images manually with custom tags or without cache. ```bash # Build from repository root docker build -t base-node:latest . docker build -t base-node:v1.0.0 . # Build with custom tag docker build -t myregistry.com/base-node:latest . # Build without caching docker build --no-cache -t base-node:latest . ``` -------------------------------- ### Base Node Repository File Structure Source: https://github.com/base/node/blob/main/_autodocs/INDEX.md A visual representation of the project directory layout, including configuration files, entrypoint scripts, and documentation references. ```text Base Node Repository ├── README.md # Project overview (marketing-focused) ├── docker-compose.yml # Service orchestration ├── Dockerfile # Container image definition ├── execution-entrypoint # Execution client startup script ├── consensus-entrypoint # Consensus client startup script ├── .env.mainnet # Mainnet configuration ├── .env.sepolia # Testnet configuration ├── supervisord.conf # Process supervision (optional) └── versions.env # Version constants Technical Reference Documentation (/workspace/home/output) ├── INDEX.md # This file ├── 01-project-overview.md # Project identity and architecture ├── 02-environment-configuration.md # Environment variables and config ├── 03-execution-client-reference.md # Reth execution client documentation ├── 04-consensus-client-reference.md # Base-consensus documentation ├── 05-deployment-guide.md # Operations and deployment procedures ├── 06-rpc-endpoints.md # JSON-RPC API reference ├── 07-network-reference.md # Networking and P2P documentation ├── 08-dockerfile-and-build.md # Docker image and container docs ├── 09-bash-scripts-reference.md # Entrypoint script analysis └── 10-troubleshooting-guide.md # Troubleshooting and recovery ``` -------------------------------- ### Monitor System Resources Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Check memory usage and disk I/O performance to identify hardware bottlenecks. ```bash # Check memory usage docker stats base_node_execution # If > 30GB, node needs more RAM # Check disk I/O iostat -x 1 # If I/O utilization high (>90%), upgrade to faster NVMe ``` -------------------------------- ### Verify BASE_NODE_NETWORK configuration Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Check the current configuration for the network setting. ```bash docker compose config | grep BASE_NODE_NETWORK ``` -------------------------------- ### Initialize Data Directory and JWT Secret Source: https://github.com/base/node/blob/main/_autodocs/09-bash-scripts-reference.md Creates the required data directory and writes the Engine API JWT secret from an environment variable to a file. ```bash mkdir -p "$RETH_DATA_DIR" echo "Starting reth with additional args: $ADDITIONAL_ARGS" echo "$BASE_NODE_L2_ENGINE_AUTH_RAW" > "$BASE_NODE_L2_ENGINE_AUTH" ``` -------------------------------- ### Verify Port Connectivity Source: https://github.com/base/node/blob/main/_autodocs/07-network-reference.md Use netcat or telnet to verify that the execution and consensus P2P ports are reachable. ```bash # Check if execution P2P port is reachable nc -zv -w 5 your-node-ip 30303 nc -zu -w 5 your-node-ip 30303 # Check if consensus P2P port is reachable nc -zv -w 5 your-node-ip 9222 nc -zu -w 5 your-node-ip 9222 # Use telnet for TCP telnet your-node-ip 30303 ``` -------------------------------- ### Inspect execution client logs Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Review the last 50 lines of the execution client logs for errors. ```bash docker compose logs execution | tail -50 # Look for error messages or port binding issues ``` -------------------------------- ### Configure follow mode RPC endpoint Source: https://github.com/base/node/blob/main/_autodocs/04-consensus-client-reference.md Sets the required environment variable to point the consensus client to an external L2 RPC source. ```bash BASE_NODE_SOURCE_L2_RPC=https://mainnet.base.org # Or another Base RPC endpoint ``` -------------------------------- ### Push Image to Registry Source: https://github.com/base/node/blob/main/_autodocs/08-dockerfile-and-build.md Tags and pushes a local image to a remote registry, and demonstrates using Docker Compose with overrides. ```bash # Tag image for registry docker tag base-node:latest myregistry.com/base-node:latest # Push to registry docker push myregistry.com/base-node:latest # Docker Compose with custom registry # Edit docker-compose.yml or use compose override: docker-compose -f docker-compose.yml \ -f docker-compose.prod.yml up ``` -------------------------------- ### Check Port Binding Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Verify that the node is actively listening on the required P2P ports. ```bash # Is port bound? netstat -tlnp | grep 30303 netstat -tlnp | grep 9222 # Expected output should show process listening ``` -------------------------------- ### Configure static public IP Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Manually set the public IP in the environment file. ```bash BASE_NODE_P2P_ADVERTISE_IP=203.0.113.42 # Your public IP ``` -------------------------------- ### Optimize Build Context Source: https://github.com/base/node/blob/main/_autodocs/08-dockerfile-and-build.md Excludes unnecessary files from the build context to improve performance and reduce transfer size. ```text # Create .dockerignore to exclude files .git node_modules *.log old-backups/ ``` -------------------------------- ### Check Execution Client Readiness Source: https://github.com/base/node/blob/main/_autodocs/04-consensus-client-reference.md Polls the execution client's Engine API until it returns an HTTP 401 status, indicating the service is reachable and ready for authentication. ```bash until [ "$(curl -s --max-time 10 --connect-timeout 5 -w '%{http_code}' -o /dev/null \ "${BASE_NODE_L2_ENGINE_RPC/ws/http}")" -eq 401 ]; do echo "waiting for execution client to be ready" sleep 5 done ``` -------------------------------- ### Implement Multi-Stage Builds Source: https://github.com/base/node/blob/main/_autodocs/08-dockerfile-and-build.md Separates build dependencies from the final runtime image to minimize image size. ```dockerfile # Build stage FROM ubuntu:22.04 as builder RUN apt-get update && apt-get install -y build-essential COPY . /src RUN cd /src && make # Final stage FROM ubuntu:22.04 COPY --from=builder /src/binaries / ``` -------------------------------- ### Benchmark Disk Speed Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Run a random read benchmark to test disk performance. ```bash fio --name=random-read --ioengine=libaio --iodepth=32 \ --rw=randread --bs=4k --direct=1 --size=1G \ --filename=./reth-data/test ``` -------------------------------- ### Verify Bootstrap Nodes Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Check the environment configuration for valid bootstrap node entries. ```bash # Check bootstrap nodes are correct grep BOOTNODE .env.mainnet | head -1 # Should start with "enr:-J24Q..." ``` -------------------------------- ### Verify Docker Image Contents Source: https://github.com/base/node/blob/main/_autodocs/08-dockerfile-and-build.md Commands to inspect files, verify binary existence, and check versions within the built image. ```bash # List files in image docker run --rm base-node:latest ls -la / # Check if binary exists docker run --rm base-node:latest which base-reth-node docker run --rm base-node:latest which base-consensus # Check executable version docker run --rm base-node:latest ./base-reth-node --version docker run --rm base-node:latest ./base-consensus --version ``` -------------------------------- ### Verify Engine API Readiness Source: https://github.com/base/node/blob/main/_autodocs/03-execution-client-reference.md Validates that the Engine API is accepting connections by expecting an HTTP 401 response. ```bash # Expect HTTP 401 (Unauthorized) - validates Engine API is accepting connections curl -w '%{http_code}' -o /dev/null \ "${BASE_NODE_L2_ENGINE_RPC/ws/http}" ``` -------------------------------- ### Enable Pruning Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Configure pruning arguments to reduce memory or disk usage. ```bash RETH_PRUNING_ARGS="--prune.senderrecovery.distance=50000" \ docker compose up ``` -------------------------------- ### Edit environment files Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Open the environment file for editing. ```bash # For mainnet nano .env.mainnet # For testnet nano .env.sepolia ``` -------------------------------- ### Standard Ethereum Methods Source: https://github.com/base/node/blob/main/_autodocs/03-execution-client-reference.md Methods for interacting with chain state, account data, transactions, and logs. ```APIDOC ## Standard Ethereum Methods (eth_) ### Description These methods provide access to core blockchain data including block information, account balances, and transaction submission. ### Available Methods - **Reading chain state**: eth_blockNumber, eth_getBlockByNumber, eth_getBlock, eth_call - **Account data**: eth_getBalance, eth_getCode, eth_getStorageAt - **Transactions**: eth_sendRawTransaction, eth_getTransaction, eth_getTransactionReceipt - **Logs**: eth_getLogs, eth_getFilterChanges ``` -------------------------------- ### Configure Base Sepolia Source: https://github.com/base/node/blob/main/_autodocs/03-execution-client-reference.md Configuration parameters for connecting to the Base Sepolia testnet. ```text --chain base-sepolia RETH_CHAIN=base-sepolia RETH_SEQUENCER_HTTP=https://sepolia-sequencer.base.org ``` -------------------------------- ### Configure L1 RPC Provider Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Update the environment variable to use a faster L1 RPC provider. ```bash # Edit environment file BASE_NODE_L1_ETH_RPC=https://eth-mainnet-fast.alchemyapi.io/v2/YOUR-KEY ``` -------------------------------- ### Initialize Bash Script Interpreter and Error Handling Source: https://github.com/base/node/blob/main/_autodocs/09-bash-scripts-reference.md Sets the interpreter to bash and configures the script to exit immediately on errors or undefined variables. ```bash #!/bin/bash set -eu ``` -------------------------------- ### Configure Data Directory Source: https://github.com/base/node/blob/main/_autodocs/03-execution-client-reference.md Sets the absolute path for blockchain data storage, typically volume-mounted from the host. ```bash RETH_DATA_DIR=/data ``` -------------------------------- ### Verify Engine RPC URL Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Check the configured Engine RPC URL in the environment file. ```bash grep BASE_NODE_L2_ENGINE_RPC .env.mainnet # Should be: BASE_NODE_L2_ENGINE_RPC=ws://execution:8551 ``` -------------------------------- ### Visualize Container Networking Source: https://github.com/base/node/blob/main/_autodocs/08-dockerfile-and-build.md Diagram showing communication flow between execution and node containers. ```text execution (container) ↓ (via docker bridge network) 127.0.0.1:8551 → ws://execution:8551 ↓ node (container) ``` -------------------------------- ### Test IP detection providers Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Manually verify reachability of public IP detection services. ```bash curl -s http://ifconfig.me # Provider 1 curl -s http://api.ipify.org # Provider 2 curl -s http://ipecho.net/plain # Provider 3 curl -s http://v4.ident.me # Provider 4 ``` -------------------------------- ### Debug P2P Peer Discovery Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Validate bootnode configuration and check for network or firewall blocks on port 9222. ```bash # Check bootnodes format grep BOOTNODE .env.mainnet | head -1 # Verify outbound UDP 9222 not blocked docker exec base_node_node bash -c \ "nc -u -z 8.8.8.8 53" # Check firewall rules sudo iptables -L | grep 9222 ``` -------------------------------- ### Execute Commands in Running Container Source: https://github.com/base/node/blob/main/_autodocs/08-dockerfile-and-build.md Utility commands to interact with or monitor a running container instance. ```bash # Execute command in running container docker exec -it base_node_execution bash # View running processes docker exec base_node_execution ps aux # Check disk usage docker exec base_node_execution df -h ``` -------------------------------- ### Peer Connection Flow Diagram Source: https://github.com/base/node/blob/main/_autodocs/07-network-reference.md Visual representation of the node connection lifecycle from bootstrap to synchronization. ```text 1. Bootstrap Phase ├─ Read BOOTNODES list ├─ Decode ENR records └─ Connect to initial peers 2. Handshake ├─ Send HELLO frame with protocol version ├─ Exchange node capabilities └─ Negotiate features (snapshots, witness, etc.) 3. Discovery ├─ Query bootstrap peers for neighbors ├─ Send FIND_NODE to discover DHT neighbors ├─ Collect responses with peer information └─ Add new peers to connection pool 4. Connection Management ├─ Maintain max_outbound_peers (100) ├─ Close inactive connections ├─ Prefer high-quality peers └─ Avoid eclipse attacks 5. Synchronization ├─ Request headers from peers ├─ Verify against chain state ├─ Download blocks in parallel └─ Update canonical chain ``` -------------------------------- ### Execution Client Process Hierarchy Source: https://github.com/base/node/blob/main/_autodocs/03-execution-client-reference.md Visual representation of the process tree within the container, showing the entrypoint and the reth node process. ```text PID 1: /bin/bash execution-entrypoint └─ PID N: ./base-reth-node node [FLAGS] └─ Worker threads (network, consensus, RPC, etc.) ``` -------------------------------- ### Inspect Image Layers and Details Source: https://github.com/base/node/blob/main/_autodocs/08-dockerfile-and-build.md Commands to view the history of image layers and inspect metadata. ```bash # Show image layer history docker history base-node:latest # Inspect image details docker inspect base-node:latest ``` -------------------------------- ### Restart Docker services Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Apply changes by rebuilding and restarting the containers. ```bash docker compose down docker compose up --build ``` -------------------------------- ### Test Engine API connectivity Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Verify that the execution client is listening on the Engine API port. ```bash docker exec base_node_execution curl -v http://localhost:8551 # Should show connection attempt (may fail with auth error, that's OK) ``` ```bash curl -v http://127.0.0.1:8551 # If connection refused, port may be wrong or execution not listening ``` -------------------------------- ### Set Engine RPC URL Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Add the Engine RPC URL to the environment file. ```bash BASE_NODE_L2_ENGINE_RPC=ws://execution:8551 ``` -------------------------------- ### Configure Custom Bootstrap Nodes Source: https://github.com/base/node/blob/main/_autodocs/07-network-reference.md Environment variable configuration for defining custom bootstrap nodes in the .env file. ```bash # .env.mainnet or .env.sepolia BASE_NODE_P2P_BOOTNODES="enr:-J24Q... enr:-J24Q..." ``` -------------------------------- ### Test Flashblocks RPC Method Source: https://github.com/base/node/blob/main/_autodocs/02-environment-configuration.md Verify Flashblocks integration by querying the block status via cURL. ```bash curl -X POST \ --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["pending", false],"id":1}' \ http://localhost:8545 ``` -------------------------------- ### Verify Environment Variables Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Check if RETH_CHAIN is correctly set in the environment or specify the network file explicitly. ```bash # Check RETH_CHAIN is set docker compose config | grep RETH_CHAIN # If not set, verify NETWORK_ENV variable echo $NETWORK_ENV # If empty, specify explicitly NETWORK_ENV=.env.mainnet docker compose up ``` -------------------------------- ### Stream Live Logs Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Follows service logs in real-time with options for specific services or timestamps. ```bash # Follow all logs in real-time docker compose logs -f # Follow specific service docker compose logs -f execution # With timestamps docker compose logs -f --timestamps ``` -------------------------------- ### Edit Environment Files Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Commands to open environment configuration files for editing. ```bash # Edit mainnet config nano .env.mainnet # Edit testnet config nano .env.sepolia ``` -------------------------------- ### Recover from Database Corruption Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Procedures for soft recovery, full resync, or restoring from backups. ```bash # Stop node docker compose stop # Node will attempt recovery on next start docker compose up ``` ```bash # Stop node docker compose stop # Delete database (WARNING: will resync from scratch) rm -rf ./reth-data # Restart docker compose up ``` ```bash # Stop node docker compose stop # Remove corrupted data rm -rf ./reth-data # Restore backup tar -xzf reth-data-backup-*.tar.gz # Restart docker compose up ``` -------------------------------- ### Gather Diagnostic Information Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Collect system, node, and configuration details into a file for troubleshooting. Ensure sensitive information is removed before sharing. ```bash # Collect system information uname -a > diagnostics.txt df -h >> diagnostics.txt docker --version >> diagnostics.txt docker compose --version >> diagnostics.txt # Collect node information echo "=== Node Status ===" >> diagnostics.txt docker compose ps >> diagnostics.txt # Collect recent logs echo "=== Recent Logs ===" >> diagnostics.txt docker compose logs --tail=100 >> diagnostics.txt # Collect metrics echo "=== Metrics ===" >> diagnostics.txt curl -s http://localhost:6060/metrics >> diagnostics.txt # Collect configuration (mask secrets) echo "=== Configuration ===" >> diagnostics.txt docker compose config | grep -v "JWT\|PASSWORD\|KEY" >> diagnostics.txt # Share the file # (Remove sensitive data before sharing) cat diagnostics.txt ``` -------------------------------- ### Check execution container status Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Verify that the execution client container is running. ```bash docker compose ps execution # Should show: "Up" status ``` -------------------------------- ### Check Execution Client Status Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Verify the execution client container is running and correctly mapped. ```bash docker compose ps execution ``` -------------------------------- ### Correct environment variable syntax Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Ensure the environment variable name is formatted correctly without typos. ```bash # Wrong (missing underscore) RETHCHAIN=base # Correct RETH_CHAIN=base ``` -------------------------------- ### Configure Flashblocks Support Source: https://github.com/base/node/blob/main/_autodocs/09-bash-scripts-reference.md Conditionally appends a websocket URL flag to ADDITIONAL_ARGS if the RETH_FB_WEBSOCKET_URL variable is provided. ```bash if [[ -n "${RETH_FB_WEBSOCKET_URL:-}" ]]; then ADDITIONAL_ARGS="$ADDITIONAL_ARGS --websocket-url=$RETH_FB_WEBSOCKET_URL" echo "Enabling Flashblocks support with endpoint: $RETH_FB_WEBSOCKET_URL" else echo "Running in vanilla node mode (no Flashblocks URL provided)" fi ``` ```bash RETH_FB_WEBSOCKET_URL=wss://mainnet.flashblocks.base.org/ws # Results in: ADDITIONAL_ARGS="--websocket-url=wss://mainnet.flashblocks.base.org/ws" ``` -------------------------------- ### Resync from Snapshot Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Perform a full resync by removing the data directory and restarting the node. ```bash docker compose stop rm -rf ./reth-data # Download and extract latest snapshot docker compose up -d ``` -------------------------------- ### Configure Reth Execution and Logging Variables Source: https://github.com/base/node/blob/main/_autodocs/09-bash-scripts-reference.md Sets operational variables for the Reth binary, historical proofs, and logging verbosity. ```bash ADDITIONAL_ARGS="" BINARY="./base-reth-node" RETH_HISTORICAL_PROOFS="${RETH_HISTORICAL_PROOFS:-false}" RETH_HISTORICAL_PROOFS_STORAGE_PATH="${RETH_HISTORICAL_PROOFS_STORAGE_PATH:-}" LOG_LEVEL="${LOG_LEVEL:-info}" ``` -------------------------------- ### Verify Port Mapping Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Check the Docker port mapping configuration for the JSON-RPC port. ```bash docker compose ps | grep 8545 # Should show 0.0.0.0:8545->8545/tcp ``` -------------------------------- ### Verify internet connectivity Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Test network connectivity from within the node container. ```bash docker exec base_node_node ping 8.8.8.8 # Should respond with bytes received ``` -------------------------------- ### Configure Nginx for SSL/TLS Termination Source: https://github.com/base/node/blob/main/_autodocs/06-rpc-endpoints.md Reverse proxy configuration to enable HTTPS/WSS for production environments. ```nginx server { listen 443 ssl http2; server_name node.example.com; ssl_certificate /path/to/cert.pem; ssl_certificate_key /path/to/key.pem; location / { proxy_pass http://localhost:8545; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } ``` -------------------------------- ### Open Firewall Ports Source: https://github.com/base/node/blob/main/_autodocs/10-troubleshooting-guide.md Configure firewall rules to allow P2P traffic on ports 30303 and 9222. ```bash # Ubuntu/Debian with UFW sudo ufw allow 30303/tcp sudo ufw allow 30303/udp sudo ufw allow 9222/tcp sudo ufw allow 9222/udp # CentOS/RHEL with firewalld sudo firewall-cmd --permanent --add-port=30303/tcp sudo firewall-cmd --permanent --add-port=30303/udp sudo firewall-cmd --permanent --add-port=9222/tcp sudo firewall-cmd --permanent --add-port=9222/udp sudo firewall-cmd --reload # iptables (direct) sudo iptables -A INPUT -p tcp --dport 30303 -j ACCEPT sudo iptables -A INPUT -p udp --dport 30303 -j ACCEPT ``` -------------------------------- ### Configure Resource Limits Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Defines memory and CPU constraints for execution and node services in docker-compose.yml. ```yaml # docker-compose.yml with resource limits services: execution: mem_limit: '32g' memswap_limit: '32g' cpus: '8.0' node: mem_limit: '8g' memswap_limit: '8g' cpus: '4.0' ``` -------------------------------- ### Perform Manual Recovery Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Commands to restart services or perform a full stop and restart cycle for maintenance. ```bash # Restart specific service docker compose restart execution # Restart all services docker compose restart # Stop, check logs, then restart docker compose stop docker compose logs -f docker compose up -d ``` -------------------------------- ### Access Prometheus Metrics Endpoints Source: https://github.com/base/node/blob/main/_autodocs/05-deployment-guide.md Use these commands to verify that metrics are being served by the execution and consensus clients. ```bash curl http://localhost:6060/metrics ``` ```bash curl http://localhost:7300/metrics ```