2019-04-02 20:45:40 +00:00
|
|
|
#!/bin/bash
|
2019-03-15 14:42:57 +00:00
|
|
|
|
2019-04-18 17:23:38 +00:00
|
|
|
# This script creates 8 private keys with 8 deposits and runs a single
|
|
|
|
# validator process.
|
|
|
|
|
2019-04-02 20:45:40 +00:00
|
|
|
PRIVATE_KEY_PATH=~/priv
|
2019-03-15 14:42:57 +00:00
|
|
|
|
|
|
|
echo "clearing data"
|
|
|
|
DATA_PATH=/tmp/data
|
|
|
|
rm -rf $DATA_PATH
|
|
|
|
mkdir -p $DATA_PATH
|
|
|
|
|
|
|
|
PASSWORD="password"
|
|
|
|
PASSWORD_PATH=$DATA_PATH/password.txt
|
|
|
|
|
|
|
|
UNAME=$(echo `uname` | tr '[A-Z]' '[a-z]')
|
|
|
|
|
|
|
|
echo $PASSWORD > $PASSWORD_PATH
|
|
|
|
|
|
|
|
bazel build //validator
|
2019-04-02 20:45:40 +00:00
|
|
|
bazel build //contracts/deposit-contract/sendDepositTx
|
|
|
|
|
|
|
|
START_INDEX=1
|
|
|
|
END_INDEX=8
|
|
|
|
|
|
|
|
while test $# -gt 0; do
|
|
|
|
case "$1" in
|
|
|
|
--deposit-contract)
|
|
|
|
shift
|
|
|
|
DEPOSIT_CONTRACT=$1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--end-index)
|
|
|
|
shift
|
|
|
|
END_INDEX=$1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--start-index)
|
|
|
|
shift
|
|
|
|
START_INDEX=$1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--privkey-path)
|
|
|
|
shift
|
|
|
|
PRIVATE_KEY_PATH=$1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "$1 is not a recognized flag!"
|
|
|
|
exit 1;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2019-03-15 14:42:57 +00:00
|
|
|
|
2019-04-18 17:23:38 +00:00
|
|
|
KEYSTORE=$DATA_PATH/keystore
|
|
|
|
|
2019-04-02 20:45:40 +00:00
|
|
|
for i in `seq $START_INDEX $END_INDEX`;
|
2019-03-15 14:42:57 +00:00
|
|
|
do
|
2019-04-18 17:23:38 +00:00
|
|
|
echo "Generating validator key $i"
|
2019-03-15 14:42:57 +00:00
|
|
|
|
2019-04-02 20:45:40 +00:00
|
|
|
ACCOUNTCMD="bazel-bin/validator/${UNAME}_amd64_pure_stripped/validator accounts create --password $(cat $PASSWORD_PATH) --keystore-path $KEYSTORE"
|
2019-03-15 14:42:57 +00:00
|
|
|
|
|
|
|
echo $ACCOUNTCMD
|
|
|
|
|
|
|
|
$ACCOUNTCMD
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2019-04-18 17:23:38 +00:00
|
|
|
CMD="bazel-bin/validator/${UNAME}_amd64_pure_stripped/validator --password $(cat $PASSWORD_PATH) --keystore-path $KEYSTORE"
|
2019-03-15 14:42:57 +00:00
|
|
|
|
2019-04-18 17:23:38 +00:00
|
|
|
echo $CMD
|
|
|
|
nohup $CMD $> /tmp/validator.log &
|
2019-03-15 14:42:57 +00:00
|
|
|
|
2019-04-18 17:23:38 +00:00
|
|
|
echo "Sending TX for validator key $i"
|
2019-03-15 14:42:57 +00:00
|
|
|
|
2019-04-18 17:23:38 +00:00
|
|
|
HTTPFLAG="--httpPath=https://goerli.prylabs.net"
|
|
|
|
PASSFLAG="--passwordFile=$PASSWORD_PATH"
|
|
|
|
CONTRACTFLAG="--depositContract=$DEPOSIT_CONTRACT"
|
|
|
|
PRIVFLAG="--privKey=$(cat $PRIVATE_KEY_PATH)"
|
|
|
|
KEYFLAG="--prysm-keystore=$KEYSTORE"
|
|
|
|
AMOUNTFLAG="--depositAmount=3200000"
|
2019-03-15 14:42:57 +00:00
|
|
|
|
2019-04-18 17:23:38 +00:00
|
|
|
CMD="bazel-bin/contracts/deposit-contract/sendDepositTx/${UNAME}_amd64_stripped/sendDepositTx"
|
2019-03-15 14:42:57 +00:00
|
|
|
|
2019-04-18 17:23:38 +00:00
|
|
|
DEPOSITCMD="$CMD $HTTPFLAG $PASSFLAG $CONTRACTFLAG $PRIVFLAG $KEYFLAG $AMOUNTFLAG"
|
2019-04-02 20:45:40 +00:00
|
|
|
|
2019-04-18 17:23:38 +00:00
|
|
|
$DEPOSITCMD
|
2019-03-15 14:42:57 +00:00
|
|
|
|
2019-04-18 17:23:38 +00:00
|
|
|
echo "A validator is running in the background. You can follow the logs at /tmp/validator.log."
|
2019-03-15 14:42:57 +00:00
|
|
|
|
2019-04-18 17:23:38 +00:00
|
|
|
echo "To stop the processes, use 'pkill validator'"
|