2019-03-20 00:05:10 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-03-28 22:19:12 +00:00
|
|
|
|
|
|
|
[ -z "$1" ] && { echo "Usage: `basename $0` testnetX"; exit 1; }
|
|
|
|
|
2019-07-11 11:52:59 +00:00
|
|
|
set -e
|
2019-03-28 22:19:12 +00:00
|
|
|
|
2019-03-20 00:05:10 +00:00
|
|
|
cd $(dirname "$0")
|
|
|
|
|
2019-03-28 22:19:12 +00:00
|
|
|
NETWORK_NAME="$1"
|
2019-03-20 00:05:10 +00:00
|
|
|
source "$NETWORK_NAME.env"
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
2019-07-11 11:52:59 +00:00
|
|
|
# the NIM_PARAMS env var will be set in the Makefile, based on NIMFLAGS passed on the `make` command line
|
|
|
|
# (i.e.: make NIMFLAGS="--stackTrace:on" testnet1).
|
2019-09-10 18:57:30 +00:00
|
|
|
OUR_NIM_FLAGS="-d:release --lineTrace:on -d:chronicles_log_level=DEBUG -d:const_preset=$CONST_PRESET -d:network_type=$NETWORK_TYPE -d:SECONDS_PER_SLOT=$SECONDS_PER_SLOT -d:SHARD_COUNT=$SHARD_COUNT -d:SLOTS_PER_EPOCH=$SLOTS_PER_EPOCH -d:DEFAULT_NETWORK=$NETWORK_NAME $NIM_PARAMS"
|
2019-03-27 13:04:09 +00:00
|
|
|
|
2019-03-28 22:19:12 +00:00
|
|
|
BEACON_NODE_BIN="build/${NETWORK_NAME}_node"
|
2019-03-27 13:04:09 +00:00
|
|
|
|
2019-07-11 11:52:59 +00:00
|
|
|
CMD="nim c $OUR_NIM_FLAGS -o:$BEACON_NODE_BIN beacon_chain/beacon_node"
|
2019-03-28 22:19:12 +00:00
|
|
|
echo "$CMD"
|
|
|
|
$CMD
|
2019-03-22 14:35:20 +00:00
|
|
|
|
2019-03-28 22:19:12 +00:00
|
|
|
if [ ! -d ~/.cache/nimbus/BeaconNode/${NETWORK_NAME}/validators ]; then
|
|
|
|
$BEACON_NODE_BIN --network=$NETWORK_NAME importValidator
|
2019-03-22 14:35:20 +00:00
|
|
|
fi
|
|
|
|
|
2019-07-11 11:52:59 +00:00
|
|
|
# simple wrapper script
|
|
|
|
BEACON_NODE_SCRIPT="scripts/${NETWORK_NAME}.sh"
|
|
|
|
cat > "$BEACON_NODE_SCRIPT" <<EOF
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
cd \$(dirname "\$0")/..
|
2019-08-21 12:45:24 +00:00
|
|
|
vendor/nimbus-build-system/scripts/env.sh $BEACON_NODE_BIN "\$@"
|
2019-07-11 11:52:59 +00:00
|
|
|
EOF
|
|
|
|
chmod 755 "$BEACON_NODE_SCRIPT"
|
|
|
|
|
2019-03-29 16:44:19 +00:00
|
|
|
echo
|
2019-03-29 19:48:02 +00:00
|
|
|
echo "Done! You're now ready to connect to $NETWORK_NAME by running:"
|
|
|
|
echo
|
2019-07-11 11:52:59 +00:00
|
|
|
echo " $BEACON_NODE_SCRIPT"
|
2019-03-29 19:48:02 +00:00
|
|
|
echo
|
2019-06-20 13:43:53 +00:00
|
|
|
echo "Database and configuration files will be placed in:"
|
2019-03-29 19:48:02 +00:00
|
|
|
echo
|
2019-04-09 18:51:03 +00:00
|
|
|
echo " ${HOME}/.cache/nimbus/BeaconNode/${NETWORK_NAME}"
|
2019-03-29 16:44:19 +00:00
|
|
|
echo
|