diff --git a/.gitignore b/.gitignore index 50dddcf..5d87723 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ validator_keys/ docker-compose.override.yaml docker-compose.override.yml jwttoken +besu-data/ +nethermind-data/ diff --git a/besu.yml b/besu.yml new file mode 100644 index 0000000..9f6d7a0 --- /dev/null +++ b/besu.yml @@ -0,0 +1,17 @@ +version: "3.0" + +services: + besu: + image: hyperledger/besu:${DC_BESU_VERSION} + volumes: + - ./besu-data:/var/lib/besu + - ./jwttoken:/home/besu/jwttoken:ro + - ./config:/home/besu/config:ro + ports: + - 30303:30303/tcp + - 30303:30303/udp + expose: + - 8551 + env_file: .env + restart: on-failure + stop_grace_period: 3m diff --git a/config/besu_config.toml b/config/besu_config.toml new file mode 100644 index 0000000..1799b78 --- /dev/null +++ b/config/besu_config.toml @@ -0,0 +1,8 @@ +network="mainnet" +sync-mode="X_CHECKPOINT" +data-path="/var/lib/besu" +data-storage-format="BONSAI" +engine-rpc-port=8551 +engine-jwt-secret="/home/besu/jwttoken/jwtsecret.hex" +engine-host-allowlist=["*"] +Xplugin-rocksdb-high-spec-enabled=true diff --git a/dc b/dc new file mode 100755 index 0000000..c33cf41 --- /dev/null +++ b/dc @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# //////////////////////////////////////////////////////////////// +# DC - DOCKER COMPOSE HELPER +# //////////////////////////////////////////////////////////////// +# This script is used as a helper to run docker-compose commands +# directly against one of the preconfigured environments +# For the Lighthouse-Besu environment use: ./dc lb docker_compose_command with args +# For the Lighthouse-Nethermind environment use: ./dc ln docker_compose_command with args +# For the Lighthouse-Geth environment use: ./dc lg docker_compose_command with args +if [ "$1" == "lb" ]; then + shift + exec docker-compose -f lighthouse.yml -f besu.yml "$@" +elif [ "$1" == "lg" ]; then + shift + exec docker-compose -f lighthouse.yml -f geth.yml "$@" + elif [ "$1" == "ln" ]; then + shift + exec docker-compose -f lighthouse.yml -f nethermind.yml "$@" +elif [ "$1" == "--help" ]; then + echo "Usage: This script is used as a helper to run docker-compose commands directly against one of the preconfigured environments (Lighthouse-Geth or Lighthouse-Besu)" + echo "For the Lighthouse-Nethermind environment use: ./dc ln docker_compose_command with args" + echo "For the Lighthouse-Besu environment use: ./dc lb docker_compose_command with args" + echo "For the Lighthouse-Geth environment use: ./dc lg docker_compose_command with args" +else + echo "Unknown command $0" + exit 1 +fi + diff --git a/default.env b/default.env index 5931670..07d8d3d 100644 --- a/default.env +++ b/default.env @@ -1,10 +1,8 @@ -# Docker tags to pull. Can be used to control which Lighthouse and Geth -# versions are deployed. -# +# //////////////////////////////////////////////////////////////// +# LIGHTHOUSE CONFIGURATION +# //////////////////////////////////////////////////////////////// # Search for a valid Docker tag on https://hub.docker.com/r/sigp/lighthouse/tags LIGHTHOUSE_VERSION=latest -# Search for a valid Docker tag on https://hub.docker.com/r/ethereum/client-go/tags -GETH_VERSION=stable # The logging level. # @@ -13,7 +11,7 @@ DEBUG_LEVEL=info # To specify a specific network (Lighthouse defaults to mainnet) set this value. # Allowed values are: mainnet and pyrmont (others may work, but are deprecated) -NETWORK= +NETWORK=mainnet # Add an arbitrary string to the proposing block GRAFFITI= @@ -43,16 +41,6 @@ LAUNCHPAD_KEYSTORE_PASSWD= # that should be created on first boot. VALIDATOR_COUNT=1 -# Set to anything other than empty to initiate pruning of the Geth state -# NOTE: must be unset after successful prune to return to normal operations -PRUNE_GETH= - -# Set to anything other than empty to start a geth instance. -# -# Only required if `VALIDATOR_COUNT` is greater than zero or `VOTING_ETH1_NODE` -# is not set to some external geth node. -START_GETH= - # These are the beacon nodes the validator client will attempt to contact to # perform duties. To specify fallback nodes add them comma separated. VOTING_ETH2_NODES=http://beacon_node:5052 @@ -92,9 +80,69 @@ START_SLASHER= # this folder only contains old information and does not necessarily have to be on a fast SSD GETH_ANCIENT_CHAINDATA_DIR=./geth-ancient-data -# This specifies to url to the local Geth node. In the vast majority of cases this -# should not be changed -EXECUTION_ENDPOINT=http://geth:8551 - # Set to your ETH address to define a fee recipient SUGGESTED_FEE_RECIPIENT= + + +# //////////////////////////////////////////////////////////////// +# EXECUTION ENDPOINT +# //////////////////////////////////////////////////////////////// + +# This should specify the excution client that you want to use. +# Uncomment the line for either geth or besu below +# EXECUTION_ENDPOINT=http://geth:8551 +# EXECUTION_ENDPOINT=http://besu:8551 +# EXECUTION_ENDPOINT=http://nethermind:8551 + + +# //////////////////////////////////////////////////////////////// +# GETH CONFIGURATION +# //////////////////////////////////////////////////////////////// + +# Search for a valid Docker tag on https://hub.docker.com/r/ethereum/client-go/tags +GETH_VERSION=stable + +# Set to anything other than empty to start a geth instance. +# +# Only required if `VALIDATOR_COUNT` is greater than zero or `VOTING_ETH1_NODE` +# is not set to some external geth node. +START_GETH= + +# Set to anything other than empty to initiate pruning of the Geth state +# NOTE: must be unset after successful prune to return to normal operations +PRUNE_GETH= + + +# //////////////////////////////////////////////////////////////// +# BESU CONFIGURATION +# //////////////////////////////////////////////////////////////// + +# Besu version to use https://hub.docker.com/r/hyperledger/besu/tags +DC_BESU_VERSION=latest +# See config/besu_config.toml for Besu related configuration +BESU_CONFIG_FILE=/home/besu/config/besu_config.toml +# Allow Besu to use up to 8GB of memory, lower this you have less than 16GB of RAM +# minimum recommended is 3GB +JAVA_OPTS=-Xmx8g + + +# //////////////////////////////////////////////////////////////// +# NETHERMIND +# //////////////////////////////////////////////////////////////*/ + +# Nethermind version to use https://hub.docker.com/r/nethermind/nethermind/tags +DC_NETHERMIND_VERSION=latest +NETHERMIND_PRUNINGCONFIG_MODE=Full +NETHERMIND_PRUNINGCONFIG_FULLPRUNINGTRIGGER=VolumeFreeSpace +NETHERMIND_PRUNINGCONFIG_FULLPRUNINGMINIMUMDELAYHOURS=240 +NETHERMIND_PRUNINGCONFIG_FULLPRUNINGMAXDEGREEOFPARALLELISM=0 +NETHERMIND_PRUNINGCONFIG_CACHEMB=2048 +NETHERMIND_PRUNINGCONFIG_FULLPRUNINGTHRESHOLDMB=100000 + + +# //////////////////////////////////////////////////////////////// +# MEV-BOOST +# //////////////////////////////////////////////////////////////// + +# A comma separated list of MEV-Boost compatible relayer urls +MEV_RELAYS=https://0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae@boost-relay.flashbots.net,https://0xad0a8bb54565c2211cee576363f3a347089d2f07cf72679d16911d740262694cadb62d7fd7483f27afd714ca0f1b9118@bloxroute.ethical.blxrbdn.com diff --git a/geth.yml b/geth.yml new file mode 100644 index 0000000..d024f6b --- /dev/null +++ b/geth.yml @@ -0,0 +1,20 @@ +version: "3.0" + +services: + geth: + image: ethereum/client-go:${GETH_VERSION} + entrypoint: /bin/sh + volumes: + - ./geth-data:/root/.ethereum + - ${GETH_ANCIENT_CHAINDATA_DIR}:/root/ancient-data + - ./scripts:/root/scripts:ro + - ./jwttoken:/root/jwttoken:ro + ports: + - 30303:30303/tcp + - 30303:30303/udp + expose: + - 8551 + env_file: .env + command: /root/scripts/start-geth.sh + restart: on-failure + stop_grace_period: 3m diff --git a/docker-compose.yml b/lighthouse.yml similarity index 70% rename from docker-compose.yml rename to lighthouse.yml index dba64eb..98d8902 100644 --- a/docker-compose.yml +++ b/lighthouse.yml @@ -31,21 +31,10 @@ services: command: sh /root/scripts/start-validator-client.sh restart: on-failure stop_grace_period: 3m - geth: - image: ethereum/client-go:${GETH_VERSION} - entrypoint: /bin/sh - volumes: - - ./geth-data:/root/.ethereum - - ${GETH_ANCIENT_CHAINDATA_DIR}:/root/ancient-data - - ./scripts:/root/scripts:ro - - ./jwttoken:/root/jwttoken:ro - ports: - - 30303:30303/tcp - - 30303:30303/udp + mev_boost: + image: flashbots/mev-boost:latest expose: - - 8551 + - 18550 + command: -addr 0.0.0.0:18550 -mainnet -relay-check -relays ${MEV_RELAYS} env_file: .env - command: /root/scripts/start-geth.sh restart: on-failure - stop_grace_period: 3m - diff --git a/nethermind.yml b/nethermind.yml new file mode 100644 index 0000000..216cb2d --- /dev/null +++ b/nethermind.yml @@ -0,0 +1,24 @@ +version: "3.0" + +services: + nethermind: + image: nethermind/nethermind:${DC_NETHERMIND_VERSION} + volumes: + - ./nethermind-data:/nethermind/data + - ./jwttoken:/jwttoken:ro + ports: + - 30303:30303/tcp + - 30303:30303/udp + expose: + - 8551 + env_file: .env + restart: on-failure + stop_grace_period: 3m + command: > + --config mainnet + --JsonRpc.Enabled true + --JsonRpc.JwtSecretFile=/jwttoken/jwtsecret.hex + --datadir /nethermind/data + --JsonRpc.EngineHost=0.0.0.0 + --JsonRpc.EnginePort=8551 + --Sync.SnapSync=true diff --git a/scripts/start-beacon-node.sh b/scripts/start-beacon-node.sh index 523df80..7da0e91 100755 --- a/scripts/start-beacon-node.sh +++ b/scripts/start-beacon-node.sh @@ -56,6 +56,10 @@ if [ "$SUGGESTED_FEE_RECIPIENT" != "" ]; then FEE_RECIPIENT="--suggested-fee-recipient $SUGGESTED_FEE_RECIPIENT" fi +EXECUTION_JWT="/root/jwttoken/jwtsecret.hex" + +BUILDER_PARAM="--builder http://mev_boost:18550" + exec lighthouse \ --debug-level $DEBUG_LEVEL \ --network $NETWORK \ @@ -63,7 +67,7 @@ exec lighthouse \ --http \ --http-address 0.0.0.0 \ --execution-endpoint $EXECUTION_ENDPOINT \ - --execution-jwt /root/jwttoken/jwtsecret.hex \ + --execution-jwt $EXECUTION_JWT \ $METRICS_PARAMS \ $GRAFFITI_PARAM \ $ETH1_FLAG \ @@ -75,4 +79,5 @@ exec lighthouse \ $ENABLE_FULL_NETWORK_VIEW_PARAMS \ $MONITORING_SERVICE_PARAMS \ $CHECKPOINT_SYNC_URL_PARAM \ - $FEE_RECIPIENT + $FEE_RECIPIENT \ + $BUILDER_PARAM diff --git a/scripts/start-validator-client.sh b/scripts/start-validator-client.sh index e62f661..29ba167 100755 --- a/scripts/start-validator-client.sh +++ b/scripts/start-validator-client.sh @@ -25,6 +25,8 @@ DATADIR=/root/.lighthouse/$NETWORK WALLET_NAME=validators WALLET_PASSFILE=$DATADIR/secrets/$WALLET_NAME.pass +BUILDER_PARAM="--builder-proposals" + if [ "$START_VALIDATOR" != "" ]; then if [ "$IMPORT_LAUNCHPAD_KEYSTORES" != "" ]; then @@ -75,5 +77,6 @@ if [ "$START_VALIDATOR" != "" ]; then $MONITORING_SERVICE_PARAMS \ --beacon-nodes $VOTING_ETH2_NODES \ $DOPPELGANGER_PROTECTION \ - $FEE_RECIPIENT + $FEE_RECIPIENT \ + $BUILDER_PARAM fi