Skip to main content

Run Beacon Node: Lodestar

Version check

This page's content is up-to-date for Lodestar v1.5.1.

Prerequisites

The Beacon Node requires an Execution client in order to operate. See Step 2: Run Execution Client for more information.

Overview

Download Lodestar

Visit Lodestar's docs on how to download Lodestar.

https://chainsafe.github.io/lodestar/

tip

Gnosis' maintains a repo with sample Lodestar Dockerfiles and configs

https://github.com/gnosischain/lodestar-client

ContentLink
Release Pagehttps://github.com/ChainSafe/lodestar/releases/
Docker Imageshttps://hub.docker.com/r/chainsafe/lodestar/tags
General Docshttps://chainsafe.github.io/lodestar/
CLI Referencehttps://chainsafe.github.io/lodestar/reference/cli/

Checkpoint Sync

We recommend the use of Checkpoint sync to sync your Beacon Node quickly, and avoid long range attacks.

Gnosis provides a checkpoint sync server at https://checkpoint.gnosischain.com/.

# Usage
$ lodestar beacon
--checkpointSyncUrl https://checkpoint.gnosischain.com/
More about Checkpoint Sync

Option 1: Run as a System Process

Refer to Guide

Option 2: Run using Docker

Images are referenced under the following pattern chainsafe/lodestar:{image-tag} with the image-tag referring to the image available on Docker Hub.

1. Folder Structure

Create new folders:

mkdir -p /home/$USER/gnosis/consensus/data

Including the folders from your Execution client, your folder structure should now look like:

/home/$USER/gnosis/
├── jwtsecret/
├── execution/
└── consensus/
└── data/

2. Docker Compose

Modify your docker-compose file with your favorite text editor and add the consensus container. The file should now look like:

/home/$USER/gnosis/docker-compose.yml
version: "3"
services:

execution:
# From Step 2
# ...

consensus:
container_name: consensus
image: chainsafe/lodestar:latest
restart: always
networks:
- gnosis_net
ports:
- 9000:9000/tcp # p2p
- 9000:9000/udp # p2p
- 5054:5054/tcp # metrics
expose:
- 4000
volumes:
- /home/$USER/gnosis/consensus/data:/data
- /home/$USER/gnosis/jwtsecret/jwt.hex:/jwt.hex
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
- NODE_OPTIONS=--max-old-space-size=6144
command: |
beacon
--network=gnosis
--dataDir=/data
--preset=gnosis
--eth1=true
--execution.urls=http://execution:8551
--jwt-secret=/jwt.hex
--logFile=/data/logs/beacon.log
--logFileLevel=info
--port=9000
--rest=true
--rest.address=0.0.0.0
--rest.port=4000
--rest.cors=*
--discv5=true
--targetPeers=50
--metrics=true
--metrics.port=5054
--checkpointSyncUrl=https://checkpoint.gnosischain.com/
logging:
driver: "local"
networks:
gnosis_net:
name: gnosis_net

3. Start Containers

Start the consensus layer client listed in the compose file:

cd /home/$USER/gnosis
docker-compose up -d

4. Monitor Logs

Check your logs for each service (execution and consensus) with:

docker logs -f --tail 500 execution

5. Updating your Node

To update, just pull the new images, then stop and restart your docker-compose file:

cd /home/$USER/gnosis
docker-compose pull
docker-compose stop
docker-compose up -d