-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcreate_account.sh
More file actions
executable file
·106 lines (103 loc) · 2.3 KB
/
create_account.sh
File metadata and controls
executable file
·106 lines (103 loc) · 2.3 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# !/bin/bash
# by Austin Hester
# Create 2 accounts for each node
CURR=`dirname $0`
BOOT=$CURR/bootstrap
MINER1=$CURR/miner1
MINER2=$CURR/miner2
if [[ -d $BOOT/geth/ && -d $MINER1/geth/ && -d $MINER2/geth/ ]]
then
read -p "Are you sure you want to create accounts? (yes/no):" -r
echo
if [[ $REPLY == "yes" ]]
then
echo "Make sure to write down your passwords somewhere."
echo "Run ./unlock_on_start.sh if you want to start each node"
echo "with their coinbase account unlocked"
read -p "" -r
echo
# bootstrap node
echo "============================"
echo "Bootstrap account #1"
echo "============================"
RIGHT=0
while [[ $RIGHT == 0 ]]
do
geth --datadir $BOOT account new && > tmpasdf
TEST=`cat tmpasdf | grep Fatal`
if [[ $TEST == "" ]]; then
RIGHT=1
fi
done
echo "============================"
echo "Bootstrap account #2"
echo "============================"
RIGHT=0
while [[ $RIGHT == 0 ]]
do
geth --datadir $BOOT account new && > tmpasdf
TEST=`cat tmpasdf | grep Fatal`
if [[ $TEST == "" ]]; then
RIGHT=1
fi
done
# miner 1
echo "============================"
echo "Miner1 account #1"
echo "============================"
RIGHT=0
while [[ $RIGHT == 0 ]]
do
geth --datadir $MINER1 account new && > tmpasdf
TEST=`cat tmpasdf | grep Fatal`
if [[ $TEST == "" ]]; then
RIGHT=1
fi
done
echo "============================"
echo "Miner1 account #2"
echo "============================"
RIGHT=0
while [[ $RIGHT == 0 ]]
do
geth --datadir $MINER1 account new && > tmpasdf
TEST=`cat tmpasdf | grep Fatal`
if [[ $TEST == "" ]]; then
RIGHT=1
fi
done
# miner 2
echo "============================"
echo "Miner2 account #1"
echo "============================"
RIGHT=0
while [[ $RIGHT == 0 ]]
do
geth --datadir $MINER2 account new && > tmpasdf
TEST=`cat tmpasdf | grep Fatal`
if [[ $TEST == "" ]]; then
RIGHT=1
fi
done
echo "============================"
echo "Miner2 account #2"
echo "============================"
RIGHT=0
while [[ $RIGHT == 0 ]]
do
geth --datadir $MINER2 account new &&> tmpasdf
TEST=`cat tmpasdf | grep Fatal`
if [[ $TEST == "" ]]; then
RIGHT=1
fi
done
rm -f tmpasdf
echo "if you messed up just manually add until there are two each."
echo "Done."
else
echo "quitting"
fi
else
echo "You must initialize first. Run ./initialize_chain.sh"
fi
echo