-
Notifications
You must be signed in to change notification settings - Fork 3
/
externalStaker.sh
executable file
·53 lines (39 loc) · 1.16 KB
/
externalStaker.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
52
53
#!/bin/bash
PRIVATE_KEY="0xcc76648ce8798bc18130bc9d637995e5c42a922ebeab78795fac58081b9cf9d4"
PUBLIC_KEY="0x069346ca77152d3e42b1630826feef365683038c3b00ff20b0ea42d7c121fa9f"
TOOLS_JAR=Tools.jar
NODE_ADDRESS="127.0.0.1:8545"
function require_success()
{
if [ $1 -ne 0 ]
then
echo "Failed"
exit 1
fi
}
echo "Get current seed..."
seed=`./rpc.sh --getseed "$NODE_ADDRESS"`
require_success $?
echo "returned seed: \"$seed\"."
newSeed="$(java -cp $TOOLS_JAR cli.SignHash --privateKey "$PRIVATE_KEY" --signSeed "$seed")"
if [ $? -ne 0 ]
then
exit 1
fi
echo "Get new seed: \"$newSeed\"."
echo "Submit new seed..."
sealingHash=`./rpc.sh --submitseed $newSeed $PUBLIC_KEY "$NODE_ADDRESS"`
require_success $?
echo "returned sealinghash: \"$sealingHash\"."
signature="$(java -cp $TOOLS_JAR cli.SignHash --privateKey "$PRIVATE_KEY" --signSealingHash "$sealingHash")"
if [ $? -ne 0 ]
then
exit 1
fi
echo "Submit signature for sealing the new staking block..."
result=`./rpc.sh --submitsignature $signature $sealingHash "$NODE_ADDRESS"`
if [ $? -ne 0 ]
then
exit 1
fi
echo "Signature submit result: \"$result\"."