2019-03-19 19:50:22 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
cd $(dirname "$0")
|
|
|
|
|
|
|
|
NETWORK_NAME=$1
|
|
|
|
source "$NETWORK_NAME.env"
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
if [ -f .env ]; then
|
|
|
|
# allow server overrides for WWW_DIR and DATA_DIR
|
|
|
|
source .env
|
|
|
|
fi
|
|
|
|
|
|
|
|
PUBLIC_IP=$(curl -s ifconfig.me)
|
|
|
|
NETWORK_DIR=$WWW_DIR/$NETWORK_NAME
|
|
|
|
|
|
|
|
regenTestnetFiles() {
|
|
|
|
NIM_FLAGS="-d:release -d:SHARD_COUNT=$SHARD_COUNT -d:SLOTS_PER_EPOCH=$SLOTS_PER_EPOCH ${2:-}"
|
|
|
|
NETWORK_FLAVOUR=$1
|
|
|
|
|
|
|
|
if [ ! -f $NETWORK_DIR/genesis.json ]; then
|
2019-03-19 20:51:22 +00:00
|
|
|
rm -f $NETWORK_DIR/*
|
2019-03-19 19:50:22 +00:00
|
|
|
nim c -r $NIM_FLAGS beacon_chain/validator_keygen \
|
2019-03-19 20:51:22 +00:00
|
|
|
--generateFakeKeys=no \
|
2019-03-19 19:50:22 +00:00
|
|
|
--validators=$VALIDATOR_COUNT \
|
|
|
|
--outputDir="$NETWORK_DIR"
|
|
|
|
fi
|
|
|
|
|
2019-03-20 11:52:30 +00:00
|
|
|
nim c -r $NIM_FLAGS beacon_chain/beacon_node \
|
|
|
|
--network=$NETWORK_NAME \
|
|
|
|
--dataDir=$DATA_DIR/node-0 \
|
2019-03-19 19:50:22 +00:00
|
|
|
createTestnet \
|
|
|
|
--networkId=$NETWORK_ID \
|
|
|
|
--validatorsDir=$NETWORK_DIR \
|
|
|
|
--numValidators=$VALIDATOR_COUNT \
|
|
|
|
--firstUserValidator=$FIRST_USER_VALIDATOR \
|
|
|
|
--outputGenesis=$NETWORK_DIR/genesis.json \
|
|
|
|
--outputNetwork=$NETWORK_DIR/$NETWORK_FLAVOUR-network.json \
|
|
|
|
--bootstrapAddress=$PUBLIC_IP \
|
2019-03-26 19:44:51 +00:00
|
|
|
--bootstrapPort=$BOOTSTRAP_PORT \
|
2019-03-19 19:50:22 +00:00
|
|
|
--genesisOffset=600 # Delay in seconds
|
|
|
|
}
|
|
|
|
|
|
|
|
regenTestnetFiles rlpx
|
|
|
|
# regenTestnetFiles libp2p -d:withLibP2P
|
|
|
|
|