Helpful script for populating a node dataDir with a large number of validator keys

This commit is contained in:
Zahary Karadjov 2019-03-19 22:51:22 +02:00
parent 42ca6afae2
commit 23b7cbfc9c
2 changed files with 26 additions and 1 deletions

24
scripts/attach_validators.sh Executable file
View File

@ -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

View File

@ -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