ethlambda
Minimalist, fast and modular implementation of a Beacon Chain and Lean Chain client written in Rust.
๐ Visit our website at ethlambda.xyz to learn more about the project.
Quickstart
Beacon Chain follower
Follows Ethereum mainnet from a checkpoint-synced anchor and serves the
standard Beacon API on port 5052, paired with an
ethrex execution client that validates
each block's execution payload. The two talk over the Engine API, authenticated
with a shared JWT secret. Both ship release binaries for Linux (x86_64,
aarch64) and macOS (Apple silicon): ethlambda's are listed under
Releases below and ethrex's on
its releases page.
To run both from pre-built Docker images instead, see
Running with Docker below.
Warning: this uses a lot of disk. ethrex needs at least 500 GB for
mainnet (1 TB recommended; see its
hardware requirements).
# Pick the assets for your platform: linux-x86_64, linux-aarch64 or macos-aarch64
curl -LO https://github.com/lambdaclass/ethlambda/releases/latest/download/ethlambda-linux-x86_64
curl -LO https://github.com/lambdaclass/ethrex/releases/latest/download/ethrex-linux-x86_64
chmod +x ethlambda-linux-x86_64 ethrex-linux-x86_64
mv ethlambda-linux-x86_64 ethlambda && mv ethrex-linux-x86_64 ethrex
./ethlambda --version && ./ethrex --version
mkdir -p beacon-data ethrex-data
# The secret both clients authenticate the Engine API with
openssl rand -hex 32 > jwt.hex
# In one terminal: ethrex, serving the Engine API on 127.0.0.1:8551
./ethrex \
--network mainnet \
--datadir ethrex-data \
--authrpc.jwtsecret jwt.hex
# In another: the beacon node, pointed at ethrex
./ethlambda beacon \
--network mainnet \
--checkpoint-sync-url https://beaconstate.ethstaker.cc \
--data-dir beacon-data/db \
--discovery.advertise-ip "$(curl -s https://ifconfig.me)" \
--execution-endpoint http://127.0.0.1:8551 \
--execution-jwt-secret jwt.hex
--discovery.advertise-ip is the address published in the node's ENR. Without
it the node advertises 0.0.0.0 and logs a warning. It still dials out and
follows the chain, but peers cannot reach it until discovery learns the address
from their replies. The Beacon API binds 127.0.0.1:5052 by default, so
--http-address is only needed to reach it from another host. Stop the node
with Ctrl+C. v1.0.0 shuts down gracefully on SIGINT only, so a systemd unit
running it needs KillSignal=SIGINT; later versions handle SIGTERM, systemd's
default, too.
ethlambda-linux-x86_64 targets x86-64-v3, so it needs a CPU with AVX2
(Haswell or later), and glibc 2.35 or newer.
- The macOS binaries are not notarized. A browser download is quarantined, which
xattr -d com.apple.quarantine <file> lifts; a curl download is not.
RELEASE.md shows how to verify an
ethlambda binary's provenance attestation.
- A release binary is the tested release candidate's build, so
--version
names that candidate (vX.Y.Z-rc.N-<sha>), while the same release's Docker
image reports vX.Y.Z-stable-<sha>. Both run the same code; see
RELEASE.md.
To skip payload validation, run the node without ethrex: drop it, the JWT
secret and the two --execution-* flags. The node then follows the chain and
serves the Beacon API without validating execution payloads, but it cannot
serve a validator client, since it answers attestation data, aggregation and
block production requests with 503.
The first start downloads the finalized state (several hundred MB) and logs
Beacon checkpoint sync complete, then a few minutes of
Block parent missing, storing as pending before Block imported successfully
lines start. Later starts resume from beacon-data/db.
ethrex logs No messages from the consensus layer until the beacon node's
first fork choice update, then starts snap sync. Until that finishes, which
takes hours on mainnet, ethrex answers each payload SYNCING and the beacon
node imports blocks optimistically.
Check progress from another terminal:
curl -s localhost:5052/eth/v1/node/syncing
The node has caught up once sync_distance (the chain's current slot minus
head_slot) is near 0. Don't rely on is_syncing or /eth/v1/node/health
yet: during catch-up is_syncing can read false or switch back and forth,
and the health endpoint can answer 200 rather than 206.
For Sepolia or Hoodi, change --network mainnet to --network sepolia or
--network hoodi in both the ethrex and the beacon node arguments, and point
--checkpoint-sync-url at that network's provider. See
ethlambda beacon below for
the remaining flags.
--network plataberget (the Glamsterdam testnet) is built in as well. It has
run Gloas since its GLOAS_FORK_EPOCH, which the node follows: a Gloas
checkpoint anchor is accepted, payload envelopes are fetched and imported, and
the validator-client endpoints serve Gloas duties, the payload envelope and the
payload timeliness vote included.
The same binary runs ethlambda node
and ethlambda validator; their
flags are below.
Running with Docker
The same two nodes from pre-built images (ghcr.io/lambdaclass/ethlambda:latest
and ghcr.io/lambdaclass/ethrex), so only
Docker is needed. Follow the logs with
docker logs -f ethlambda-beacon and docker logs -f ethrex. For another
network, change --network mainnet in both containers' arguments, not Docker's
own --network ethereum.
docker pull ghcr.io/lambdaclass/ethlambda:latest
docker pull ghcr.io/lambdaclass/ethrex
mkdir -p beacon-data ethrex-data
# The secret both clients authenticate the Engine API with
openssl rand -hex 32 > jwt.hex
# This host's public address, published in the node's ENR (see above)
PUBLIC_IP=$(curl -s https://ifconfig.me)
# A private network, so the beacon node reaches ethrex's Engine API by name
# without publishing it on the host
docker network create ethereum
docker run -d --name ethrex --network ethereum \
-p 30303:30303 -p 30303:30303/udp \
-v "$PWD/ethrex-data:/data" \
-v "$PWD/jwt.hex:/jwt.hex:ro" \
ghcr.io/lambdaclass/ethrex \
--network mainnet \
--datadir /data \
--authrpc.addr 0.0.0.0 \
--authrpc.jwtsecret /jwt.hex
# v1.0.0 shuts down gracefully on SIGINT only (later versions handle SIGTERM too), so
# `--stop-signal` makes `docker stop` send SIGINT rather than SIGTERM.
# Flushing its state can outlast Docker's default 10 s, after which Docker kills it and the
# unflushed state is lost, so `--stop-timeout` gives it a minute.
docker run -d --name ethlambda-beacon --network ethereum --stop-signal SIGINT --stop-timeout 60 \
-p 9000:9000/udp -p 9001:9001/udp -p 9001:9001/tcp \
-p 127.0.0.1:5052:5052 \
-v "$PWD/beacon-data:/data" \
-v "$PWD/jwt.hex:/jwt.hex:ro" \
ghcr.io/lambdaclass/ethlambda:latest beacon \
--network mainnet \
--checkpoint-sync-url https://beaconstate.ethstaker.cc \
--data-dir /data/db \
--http-address 0.0.0.0 \
--discovery.advertise-ip "$PUBLIC_IP" \
--execution-endpoint http://ethrex:8551 \
--execution-jwt-secret /jwt.hex
Running without an execution client
The node without ethrex, as described above: no shared network, no JWT secret
and no --execution-* flags.
docker pull ghcr.io/lambdaclass/ethlambda:latest
mkdir -p beacon-data
# This host's public address, published in the node's ENR (see above)
PUBLIC_IP=$(curl -s https://ifconfig.me)
# v1.0.0 shuts down gracefully on SIGINT only (later versions handle SIGTERM too), so
# `--stop-signal` makes `docker stop` send SIGINT rather than SIGTERM.
# Flushing its state can outlast Docker's default 10 s, after which Docker kills it and the
# unflushed state is lost, so `--stop-timeout` gives it a minute.
docker run -d --name ethlambda-beacon --stop-signal SIGINT --stop-timeout 60 \
-p 9000:9000/udp -p 9001:9001/udp -p 9001:9001/tcp \
-p 127.0.0.1:5052:5052 \
-v "$PWD/beacon-data:/data" \
ghcr.io/lambdaclass/ethlambda:latest beacon \
--network mainnet \
--checkpoint-sync-url https://beaconstate.ethstaker.cc \
--data-dir /data/db \
--http-address 0.0.0.0 \
--discovery.advertise-ip "$PUBLIC_IP"
Lean consensus devnet
To run a local lean devnet with ethlambda, follow the instructions on the
devnet5-ethlambda-keygen branch of lambdaclass/lean-quickstart.
Building from source
Prerequisites
Building and testing
We use cargo as our build system, but prefer make as a convenient wrapper for common tasks. These are some common targets:
# Formats all code
make fmt
# Checks and lints the code
make lint
# Runs all tests
make test
# Builds a docker image tagged as "ghcr.io/lambdaclass/ethlambda:local"
make docker-build DOCKER_TAG=local
Run make help or take a look at our Makefile for other useful commands.
Running the node
The binary carries both chains and the validator client as sub-commands:
cargo build --release
./target/release/ethlambda <node|beacon|validator> [flags]
docs/cli.md is the full flag reference for every sub-command,
benchmark, replay-era and slashing-protection included. The
quickstart runs a release binary with the same arguments.
ethlambda node โ the Lean consensus chain
The devnet section below runs this sub-command, and it
is the default: a bare flag list with no sub-command still runs the node, so existing scripts and
Docker entrypoints keep working unchanged.
It needs a genesis config, a validator registry, a bootnode list and this
node's own keys, all of which a devnet generates for you:
./target/release/ethlambda node \
--genesis config/config.yaml \
--validators config/annotated_validators.yaml \
--bootnodes config/nodes.yaml \
--validator-config config/validator-config.yaml \
--hash-sig-keys-dir config/hash-sig-keys \
--node-key config/ethlambda_0.key \
--node-id ethlambda_0 \
--data-dir ./data \
--is-aggregator
--node-id picks this node's entry out of annotated_validators.yaml, so it
is what decides which validators this process runs.
The easiest way to get those files is make run-devnet, which generates them
under lean-quickstart/local-devnet/genesis/. See
Running in a devnet below.
Important: at least one node on the network must run with
--is-aggregator, or attestations are never aggregated into blocks and the
chain produces blocks but never finalizes.
ethlambda beacon โ the Ethereum Beacon Chain
A beacon node. It anchors at a finalized checkpoint fetched from a Beacon API,
then follows the chain to its tip: blocks arriving over gossip and range sync
are imported through fork choice, and it custodies its slice of the fulu data
column matrix. What it stores it serves back, to peers over
beacon_blocks_by_{range,root}