💾Installation
Lighthouse client installation guide.
Create Aliases
echo "alias lighthouse-version-current='/usr/local/bin/lighthouse --version'" >> ~/.bashrc
echo "alias lighthouse-build='~/lighthouse-build.sh'" >> ~/.bashrc
echo "alias lighthouse-version-new='~/.cargo/bin/lighthouse --version'" >> ~/.bashrc
echo "alias lighthouse-deploy='~/lighthouse-deploy.sh'" >> ~/.bashrc
echo "alias lighthouse-beacon-log='journalctl -f -u lighthousebeacon.service -o cat | ccze -A'" >> ~/.bashrc
echo "alias lighthouse-beacon-start='sudo systemctl start lighthousebeacon.service'" >> ~/.bashrc
echo "alias lighthouse-beacon-stop='sudo systemctl stop lighthousebeacon.service'" >> ~/.bashrc
echo "alias lighthouse-beacon-restart='sudo systemctl restart lighthousebeacon.service'" >> ~/.bashrc
echo "alias lighthouse-beacon-status='sudo systemctl status lighthousebeacon.service'" >> ~/.bashrc
echo "alias lighthouse-beacon-config='sudo vim /etc/systemd/system/lighthousebeacon.service'" >> ~/.bashrc
echo "alias lighthouse-beacon-enable='sudo systemctl enable lighthousebeacon.service'" >> ~/.bashrc
echo "alias lighthouse-beacon-disable='sudo systemctl disable lighthousebeacon.service'" >> ~/.bashrc
echo "alias lighthouse-beacon-delete-data='sudo rm -rf /var/lib/lighthouse/beacon; sudo mkdir -p /var/lib/lighthouse/beacon; sudo chown -R lighthousebeacon:lighthousebeacon /var/lib/lighthouse/beacon'" >> ~/.bashrc
source ~/.bashrc
Dependency - Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
<1>
<ENTER>
source $HOME/.cargo/env
Make sure protoc
is installed otherwise the build will fail.
sudo apt-get install -y protobuf-compiler
protoc --version
Lighthouse - Install
Build the latest version of Lighthouse
.
LIGHTHOUSE_VERSION_COMMIT_HASH= # e.g.441fc16
cd ~
git clone https://github.com/sigp/lighthouse.git
cd ~/lighthouse
git checkout ${LIGHTHOUSE_VERSION_COMMIT_HASH}
make
Move the compiled Lighthouse
build to a new directory.
sudo cp ~/.cargo/bin/lighthouse /usr/local/bin
Check version.
/usr/local/bin/lighthouse --version
Create Lighthouse
directory.
sudo mkdir -p /var/lib/lighthouse
Firewall Configuration
Configure the firewall using generic Beacon client UFW settings: UFW Config
Lighthouse BN - Configure Service
Create lighthousebeacon
user and set permissions.
sudo useradd --no-create-home --shell /bin/false lighthousebeacon
sudo mkdir -p /var/lib/lighthouse/beacon
sudo chown -R lighthousebeacon:lighthousebeacon /var/lib/lighthouse/beacon
Configure Beacon Service Environment Variables.
Configure lighthousebeacon
service using the command line flags.
sudo vim /etc/systemd/system/lighthousebeacon.service
[Unit]
Description=Lighthouse Ethereum Client - Beacon Node
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=lighthousebeacon
Group=lighthousebeacon
Restart=always
RestartSec=5
EnvironmentFile=/etc/default/beacon-variables.env
ExecStart=/usr/local/bin/lighthouse bn \
--network ${NETWORK} \
--datadir /var/lib/lighthouse \
--jwt-secrets="/var/lib/jwtsecret" \
--execution-endpoints ${BEACON_EXECUTION_ENDPOINTS} \
--port ${BEACON_P2P_PORT} \
\
--http \
--http-address=${BEACON_HTTP_ADDRESS} \
--http-port=${BEACON_HTTP_PORT} \
--http-allow-origin "*" \
\
--metrics \
--metrics-address ${BEACON_METRICS_ADDR} \
--metrics-port ${BEACON_METRICS_PORT} \
--metrics-allow-origin "*" \
--validator-monitor-auto \
\
--suggested-fee-recipient ${BEACON_SUGGESTED_FEE_RECIPIENT} \
--checkpoint-sync-url ${BEACON_CHECKPOINT_SYNC_URL} \
--builder ${BEACON_BUILDER} \
--reconstruct-historic-states
[Install]
WantedBy=multi-user.target
/usr/local/bin/lighthouse bn
Starts the Beacon
node.
--network
Name of the chain Lighthouse will sync and follow (e.g. mainnet
or goerli
).
--datadir
Used to specify a custom root data directory for lighthouse keys and databases.
--port
The TCP/UDP port to listen on for peer discovery.
--http
Enable the RESTful HTTP API server.
Disabled by default.
--http-address
Specify the listening address of the server.
--http-port
Specify the listening port of the server.
--metrics
Enable the Prometheus metrics HTTP server.
Disabled by default.
--validator-monitor-auto
When the --validator-monitor-auto
flag is supplied, any validator which uses the beacon_committee_subscriptions
API endpoint will be enrolled for additional monitoring.
All active validators will use this endpoint each epoch, so you can expect it to detect all local and active validators within several minutes after start up.
--monitoring-endpoint
(Not curreclty used)
Enables the monitoring service for sending system metrics to a remote endpoint.
This can be used to monitor your setup on certain services (e.g. https://beaconcha.in/user/settings#app).
This flag sets the endpoint where the beacon node metrics will be sent.
Note: This will send information to a remote server which may identify and associate your validators, IP address, and other personal information.
Always use a HTTPS connection and never provide an untrusted URL.
--execution-endpoints
One or more comma-delimited server endpoints for HTTP JSON-RPC connection.
If multiple endpoints are given the endpoints are used as fallback in the given order.
--jwt-secrets
The JWT secret is automatically generated when Geth
is first run and added to /var/lib/goethereum/
This is same location that is pointed to in both the
Geth
andLighthouse
configuration so that they use the same JWT secret and can talk to each other.
--suggested-fee-recipient
This address receives transaction fees collected from any blocks produced by this node.
The
--suggested-fee-recipient
can be provided to theBeacon Node
to act as a default value when the validator client does not transmit asuggested_fee_recipient
to theBeacon Node
--checkpoint-sync-url
Used to fast sync the chain rather than starting at genesis.
Only needed for the initial sync, I can remove it after.
--builder
Used to query the provided URL during block production for a block payload with stubbed-out transactions.
If this request fails, Lighthouse will fall back to the local execution engine and produce a block using transactions gathered and verified locally.
--reconstruct-historic-states
Used to reconstruct the history of the beacon chain when checkpoint sync was used.
Allows access to all historical data.
--purge-db
Add this flag to delete the existing database.
Start the service and check it's working as expected.
Command Aliases
daemon-reload # Reload any changes made to the lighthousebeacon.service
lighthouse-beacon-enable # Enable the lighthousebeacon.service
lighthouse-beacon-start # Start the lighthousebeacon.service
lighthouse-beacon-status # View the status of the lighthousebeacon.service
lighthouse-beacon-log # View the lighthousebeacon.service logs
Lighthouse - Update Scripts
Create Lighthouse
build script.
vim ~/lighthouse-build.sh
#!/bin/bash
set -e
cd ~/lighthouse
read -p "Enter the commit hash you want to checkout: " commit_hash
git fetch
git checkout $commit_hash
echo
echo "********************"
echo "Making Lighthouse..."
echo "********************"
make
Create Lighthouse
deploy script.
vim ~/lighthouse-deploy.sh
#!/bin/bash
# set -e # This isn't working correctly, so comment out for now
while true; do
read -p "Are you sure you want to deploy Lighthouse? (Y/N) " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer Y or N.";;
esac
done
# Check if the services exist before checking their status
if systemctl list-units --full -all | grep -Fq lighthousebeacon.service; then
beacon_status=$(sudo systemctl is-active lighthousebeacon.service)
else
beacon_status="not_installed"
fi
if systemctl list-units --full -all | grep -Fq lighthousevalidator.service; then
validator_status=$(sudo systemctl is-active lighthousevalidator.service)
else
validator_status="not_installed"
fi
echo "**********************"
if [ "$beacon_status" = "active" ]; then
echo "Stopping Lighthouse Beacon..."
sudo systemctl stop lighthousebeacon.service
elif [ "$beacon_status" = "not_installed" ]; then
echo "Warning: Lighthouse Beacon service is not installed."
fi
if [ "$validator_status" = "active" ]; then
echo "Stopping Lighthouse Validator..."
sudo systemctl stop lighthousevalidator.service
elif [ "$validator_status" = "not_installed" ]; then
echo "Warning: Lighthouse Validator service is not installed."
fi
echo "Replacing previous version..."
# Check if the file exists before trying to remove it
if [ -f /usr/local/bin/lighthouse ]; then
sudo rm /usr/local/bin/lighthouse
fi
# Check if the source file exists before copying
if [ -f ~/.cargo/bin/lighthouse ]; then
sudo cp ~/.cargo/bin/lighthouse /usr/local/bin
else
echo "Error: Source file does not exist. Installation aborted."
exit 1
fi
if [ "$beacon_status" = "active" ]; then
echo "Restarting Lighthouse Beacon..."
sudo systemctl start lighthousebeacon.service
fi
if [ "$validator_status" = "active" ]; then
echo "Restarting Lighthouse Validator..."
sudo systemctl start lighthousevalidator.service
fi
Make all scripts executable.
chmod u+x ~/lighthouse-build.sh
chmod u+x ~/lighthouse-deploy.sh
Last updated