From 23b7cbfc9c5a585bd32a42b67bee1daf03a87cee Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Tue, 19 Mar 2019 22:51:22 +0200 Subject: [PATCH] Helpful script for populating a node dataDir with a large number of validator keys --- scripts/attach_validators.sh | 24 ++++++++++++++++++++++++ scripts/reset_testnet.sh | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 scripts/attach_validators.sh diff --git a/scripts/attach_validators.sh b/scripts/attach_validators.sh new file mode 100755 index 000000000..f17a04e21 --- /dev/null +++ b/scripts/attach_validators.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -eu + +NETWORK_NAME=$1 +NODE_ID=$2 +FIRST_VALIDATOR=$3 +LAST_VALIDATOR=$4 + +cd $(dirname "$0") +cd .. + +if [ -f .env ]; then + source .env +fi + +NETWORK_DIR=$WWW_DIR/$NETWORK_NAME + +for i in $(seq $FIRST_VALIDATOR $LAST_VALIDATOR); do + VALIDATOR=v$(printf '%07d' $i) + beacon_chain/beacon_node --dataDir="$DATA_DIR/node-$NODE_ID" importValidators \ + --keyfile="$NETWORK_DIR/$VALIDATOR.privkey" +done + diff --git a/scripts/reset_testnet.sh b/scripts/reset_testnet.sh index 9c9c33f36..33ee6e322 100755 --- a/scripts/reset_testnet.sh +++ b/scripts/reset_testnet.sh @@ -22,8 +22,9 @@ regenTestnetFiles() { NETWORK_FLAVOUR=$1 if [ ! -f $NETWORK_DIR/genesis.json ]; then - rm $NETWORK_DIR/* + rm -f $NETWORK_DIR/* nim c -r $NIM_FLAGS beacon_chain/validator_keygen \ + --generateFakeKeys=no \ --validators=$VALIDATOR_COUNT \ --outputDir="$NETWORK_DIR" fi