2020-08-11 02:16:33 +00:00
|
|
|
#!/usr/bin/env bash
|
2020-05-17 11:16:48 +00:00
|
|
|
|
|
|
|
#
|
2021-10-01 06:32:37 +00:00
|
|
|
# Starts a beacon node based upon a genesis state created by `./setup.sh`.
|
2020-05-17 11:16:48 +00:00
|
|
|
#
|
|
|
|
|
2022-01-26 23:14:20 +00:00
|
|
|
set -Eeuo pipefail
|
|
|
|
|
2020-05-26 08:30:44 +00:00
|
|
|
source ./vars.env
|
|
|
|
|
2021-10-01 06:32:37 +00:00
|
|
|
SUBSCRIBE_ALL_SUBNETS=
|
|
|
|
DEBUG_LEVEL=${DEBUG_LEVEL:-info}
|
|
|
|
|
|
|
|
# Get options
|
|
|
|
while getopts "d:sh" flag; do
|
|
|
|
case "${flag}" in
|
|
|
|
d) DEBUG_LEVEL=${OPTARG};;
|
|
|
|
s) SUBSCRIBE_ALL_SUBNETS="--subscribe-all-subnets";;
|
|
|
|
h)
|
|
|
|
echo "Start a beacon node"
|
|
|
|
echo
|
|
|
|
echo "usage: $0 <Options> <DATADIR> <NETWORK-PORT> <HTTP-PORT>"
|
|
|
|
echo
|
|
|
|
echo "Options:"
|
|
|
|
echo " -s: pass --subscribe-all-subnets to 'lighthouse bn ...', default is not passed"
|
|
|
|
echo " -d: DEBUG_LEVEL, default info"
|
|
|
|
echo " -h: this help"
|
|
|
|
echo
|
|
|
|
echo "Positional arguments:"
|
|
|
|
echo " DATADIR Value for --datadir parameter"
|
|
|
|
echo " NETWORK-PORT Value for --enr-udp-port, --enr-tcp-port and --port"
|
|
|
|
echo " HTTP-PORT Value for --http-port"
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# Get positional arguments
|
|
|
|
data_dir=${@:$OPTIND+0:1}
|
|
|
|
network_port=${@:$OPTIND+1:1}
|
|
|
|
http_port=${@:$OPTIND+2:1}
|
2020-05-17 11:16:48 +00:00
|
|
|
|
|
|
|
exec lighthouse \
|
|
|
|
--debug-level $DEBUG_LEVEL \
|
|
|
|
bn \
|
2021-10-01 06:32:37 +00:00
|
|
|
$SUBSCRIBE_ALL_SUBNETS \
|
|
|
|
--datadir $data_dir \
|
2020-05-17 11:16:48 +00:00
|
|
|
--testnet-dir $TESTNET_DIR \
|
2022-03-02 03:14:27 +00:00
|
|
|
--enable-private-discovery \
|
2021-03-30 05:17:58 +00:00
|
|
|
--staking \
|
2020-05-26 08:30:44 +00:00
|
|
|
--enr-address 127.0.0.1 \
|
2021-10-01 06:32:37 +00:00
|
|
|
--enr-udp-port $network_port \
|
|
|
|
--enr-tcp-port $network_port \
|
|
|
|
--port $network_port \
|
|
|
|
--http-port $http_port \
|
2021-08-26 00:29:39 +00:00
|
|
|
--disable-packet-filter \
|
2021-10-01 06:32:37 +00:00
|
|
|
--target-peers $((BN_COUNT - 1))
|