Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions distros/raspberry_pi/config-consensus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ geth_port=30303

[nimbus]
nimbus_port=9000
# Ethereum network: mainnet/holesky/sepolia/goerli
# Ethereum network: mainnet/holesky/sepolia
nimbus_network=mainnet

[lighthouse]
lighthouse_port=9000
# Ethereum network: mainnet/holesky/sepolia/goerli
# Ethereum network: mainnet/holesky/sepolia
lighthouse_network=mainnet

# End of Web3 Pi config
Expand Down
4 changes: 2 additions & 2 deletions distros/raspberry_pi/config-exec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ geth_port=30303

[nimbus]
nimbus_port=9000
# Ethereum network: mainnet/holesky/sepolia/goerli
# Ethereum network: mainnet/holesky/sepolia
nimbus_network=mainnet

[lighthouse]
lighthouse_port=9000
# Ethereum network: mainnet/holesky/sepolia/goerli
# Ethereum network: mainnet/holesky/sepolia
lighthouse_network=mainnet

# End of Web3 Pi config
Expand Down
4 changes: 2 additions & 2 deletions distros/raspberry_pi/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ geth_port=30303

[nimbus]
nimbus_port=9000
# Ethereum network: mainnet/holesky/sepolia/goerli
# Ethereum network: mainnet/holesky/sepolia
nimbus_network=mainnet

[lighthouse]
lighthouse_port=9000
# Ethereum network: mainnet/holesky/sepolia/goerli
# Ethereum network: mainnet/holesky/sepolia
lighthouse_network=mainnet

# End of Web3 Pi config
Expand Down
17 changes: 12 additions & 5 deletions distros/raspberry_pi/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,18 @@ if [ "$(get_install_stage)" -eq 2 ]; then
echolog "Adding client directories required to run the node"
sudo -u ethereum mkdir -p /home/ethereum/clients/secrets/

set_status "[install.sh] - Generating the jwt.hex file"
#sudo -u ethereum openssl rand -hex 32 | tr -d "\n" | tee /home/ethereum/clients/secrets/jwt.hex
sudo -u ethereum openssl rand -hex 32 | sudo -u ethereum tr -d "\n" | sudo -u ethereum tee /home/ethereum/clients/secrets/jwt.hex
echolog " "

set_status "[install.sh] - Prepare the jwt.hex file"
# Check if the file exists
if [ -f "/boot/firmware/jwt.hex" ]; then
# Move the file to the destination directory
mv "/boot/firmware/jwt.hex" "/home/ethereum/clients/secrets/"
echolog "The /boot/firmware/jwt.hex file has been moved to /home/ethereum/clients/secrets/"
else
echolog "The /boot/firmware/jwt.hex file does not exist. Generating new jwt.hex file"
sudo -u ethereum openssl rand -hex 32 | sudo -u ethereum tr -d "\n" | sudo -u ethereum tee /home/ethereum/clients/secrets/jwt.hex
echolog " "
fi

set_status "[install.sh] - Copying scripts to /home/ethereum/scripts"
ln -s /opt/web3pi/Ethereum-On-Raspberry-Pi/distros/raspberry_pi/scripts/ /home/ethereum/
chmod +x /opt/web3pi/Ethereum-On-Raspberry-Pi/distros/raspberry_pi/scripts/*.sh
Expand Down
2 changes: 1 addition & 1 deletion distros/raspberry_pi/lighthouse/lighthouse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ while [ $? -ne 0 ]; do
done

# Script for finding the best server
source /opt/web3pi/Ethereum-On-Raspberry-Pi/distros/raspberry_pi/scripts/pingServers.sh
source /opt/web3pi/Ethereum-On-Raspberry-Pi/distros/raspberry_pi/scripts/ping_servers.sh

echolog "$(date): Connected - ${pingServerAdr}"
echolog "exec_url = ${exec_url}"
Expand Down
15 changes: 12 additions & 3 deletions distros/raspberry_pi/nimbus/nimbus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,19 @@ echolog "nimbus_port = ${nimbus_port}"
echolog "nimbus_network = ${nimbus_network}"
echolog "nimbus_dir = ${nimbus_dir}"

bash /opt/web3pi/Ethereum-On-Raspberry-Pi/distros/raspberry_pi/scripts/sort_servers.sh

# File with the list of servers
SERVERS_FILE="/opt/web3pi/Ethereum-On-Raspberry-Pi/distros/raspberry_pi/scripts/serversList.txt"
SERVERS_FILE="/opt/web3pi/Ethereum-On-Raspberry-Pi/distros/raspberry_pi/scripts/servers_list_${nimbus_network}.txt"

if [ -f "${SERVERS_FILE}" ]; then
echolog "SERVERS_FILE = ${SERVERS_FILE}"
else
echolog "File ${SERVERS_FILE} does not exist."
return 1
fi

bash /opt/web3pi/Ethereum-On-Raspberry-Pi/distros/raspberry_pi/scripts/servers_sort.sh $SERVERS_FILE

sleep 1

# Iterate through each server from the list
success=false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/bin/bash

servers_file="/opt/web3pi/Ethereum-On-Raspberry-Pi/distros/raspberry_pi/scripts/serversList.txt"
# Read custom config flags from /boot/firmware/config.txt
config_read_file() {
(grep -E "^${2}=" -m 1 "${1}" 2>/dev/null || echo "VAR=UNDEFINED") | head -n 1 | cut -d '=' -f 2-;
}

config_get() {
val="$(config_read_file /boot/firmware/config.txt "${1}")";
printf -- "%s" "${val}";
}

servers_file="/opt/web3pi/Ethereum-On-Raspberry-Pi/distros/raspberry_pi/scripts/servers_list_${lighthouse_network}.txt"
best_server=""
best_ping=1000000 # set a very high initial value

Expand Down
5 changes: 5 additions & 0 deletions distros/raspberry_pi/scripts/servers_list_holesky.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
https://holesky.beaconstate.info
https://holesky-checkpoint-sync.stakely.io
https://beaconstate-holesky.chainsafe.io
https://holesky.beaconstate.ethstaker.cc
https://checkpoint-sync.holesky.ethpandaops.io
3 changes: 3 additions & 0 deletions distros/raspberry_pi/scripts/servers_list_sepolia.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://checkpoint-sync.sepolia.ethpandaops.io
https://beaconstate-sepolia.chainsafe.io
https://sepolia.beaconstate.info
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
#!/bin/bash

echo "Start sorting server list..."
# Function: echolog
# Description: Logs messages with a timestamp prefix. If no arguments are provided,
# reads from stdin and logs each line. Outputs to console and appends to $LOGI file.
LOGI="/var/log/web3pi.log"
echolog(){
if [ $# -eq 0 ]
then cat - | while read -r message
do
echo "$(date +"[%F %T %Z] -") $message" | tee -a $LOGI
done
else
echo -n "$(date +'[%F %T %Z]') - " | tee -a $LOGI
echo "$*" | tee -a $LOGI
fi
}

echolog "Start sorting server list..."

# File with the list of servers
SERVERS_FILE="/opt/web3pi/Ethereum-On-Raspberry-Pi/distros/raspberry_pi/scripts/serversList.txt"
SERVERS_FILE=$1

echolog "SERVERS_FILE = ${SERVERS_FILE}"

# Check if the file exists
if [ ! -f "$SERVERS_FILE" ]; then
Expand Down Expand Up @@ -45,4 +63,4 @@ awk '{print $2}' "$TEMP_FILE" > "$SERVERS_FILE"
# Remove the temporary file
rm "$TEMP_FILE"

echo "The server list has been sorted based on average ping times."
echolog "The server list has been sorted based on average ping times."