forked from ProvableHQ/snarkOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-prover.sh
executable file
·51 lines (41 loc) · 1.02 KB
/
run-prover.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# USAGE examples:
# CLI with env vars: PROVER_PRIVATE_KEY=APrivateKey1... ./run-prover.sh
# CLI with prompts for vars: ./run-prover.sh
# If the env var PROVER_PRIVATE_KEY is not set, prompt for it
if [ -z "${PROVER_PRIVATE_KEY}" ]
then
read -r -p "Enter the Aleo Prover account private key: "
PROVER_PRIVATE_KEY=$REPLY
fi
if [ "${PROVER_PRIVATE_KEY}" == "" ]
then
echo "Missing account private key. (run 'snarkos account new' and try again)"
exit
fi
COMMAND="cargo run --release -- start --nodisplay --prover --private-key ${PROVER_PRIVATE_KEY}"
for word in $*;
do
COMMAND="${COMMAND} ${word}"
done
function exit_node()
{
echo "Exiting..."
kill $!
exit
}
trap exit_node SIGINT
echo "Running an Aleo Prover node..."
$COMMAND &
while :
do
echo "Checking for updates..."
git stash
STATUS=$(git pull)
if [ "$STATUS" != "Already up to date." ]; then
echo "Updated code found, rebuilding and relaunching prover"
cargo clean
kill -INT $!; sleep 2; $COMMAND &
fi
sleep 1800;
done