-
Notifications
You must be signed in to change notification settings - Fork 1
/
vault712.sh
executable file
·334 lines (295 loc) · 6.47 KB
/
vault712.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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
#!/bin/bash
##Running Grin made bloddy easy
##Vault 712 by BloddyBaron
##Download on https://github.com/BloddyBaron/Vault712
##Config setup
GrinLog=/root/mw/grin/server/grin.log
##Rust installer function
rust_installer()
{
sudo apt-get update -y
sudo apt-get install build-essential cmake -y
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
}
##Clang installer function
clang_installer()
{
sudo apt-get update
sudo apt-get install clang-3.8
}
##Grin installer function
main_installer()
{
while true; do
read -p "Do you wish to install Grin? " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
cd $HOME
mkdir mw/
cd mw
git clone https://github.com/mimblewimble/grin.git
cd grin
git checkout milestone/testnet1
cargo build --verbose
mkdir node1 server
cp grin.toml node1/
cp grin.toml server/
main_menu
}
#Reinstall Grin
reinstall_grin()
{
rm -rf $HOME/mw
cd $HOME
mkdir mw/
cd mw
git clone https://github.com/mimblewimble/grin.git
cd grin
git checkout milestone/testnet1
cargo build --verbose
mkdir node1 server
cp grin.toml node1/
cp grin.toml server/
main_menu
}
##Start node function
my_node()
{
cd $HOME/mw/grin/node1
export PATH=$HOME/mw/grin/target/debug:$PATH
if [ -f "$HOME/mw/grin/node1/wallet.seed" ]
then
echo Grin Node is now running, please keep this window open
grin wallet -p password -e listen
else
echo Grin Node is now running, please keep this window open
grin wallet init
grin wallet -p password -e listen
fi
}
##Start server function
my_server()
{
cd $HOME/mw/grin/server
export PATH=$HOME/mw/grin/target/debug/:$PATH
grin server -m run
}
##Start server function non mining
my_server_nonmining()
{
cd $HOME/mw/grin/server
export PATH=$HOME/mw/grin/target/debug/:$PATH
grin server run
}
##Start spend balance function
my_spendbalance()
{
cd $HOME/mw/grin/node1
export PATH=/$HOME/mw/grin/target/debug/:$PATH
if [ -f "$HOME/mw/grin/node1/wallet.seed" ]
then
grin wallet -p password info
echo "Press ENTER To Return"
read continue
else
grin wallet init
grin wallet -p password info
echo "Press ENTER To Return"
read continue
fi
}
##Start output function
my_outputs()
{
cd $HOME/mw/grin/node1
export PATH=$HOME/mw/grin/target/debug/:$PATH
if [ -f "$HOME/mw/grin/node1/wallet.seed" ]
then
grin wallet -p password outputs
echo "Press ENTER To Return"
read continue
else
grin wallet init
grin wallet -p password outputs
echo "Press ENTER To Return"
read continue
fi
}
##Start output function in detail
my_outputs_detailed()
{
cd $HOME/mw/grin/node1
if [ -f "$HOME/mw/grin/node1/wallet.seed" ]
then
cat wallet.dat
echo "Press ENTER To Return"
read continue
else
grin wallet init
grin wallet -p password
cat wallet.dat
echo "Press ENTER To Return"
read continue
fi
}
##Start the main part of the application menu if Grin and prerequisites are installed
main_menu()
{
while :
do
clear
cat << "EOF"
__ __ _ _ ______ __ ___
\ \ / / | | | |____ /_ |__ \
\ \ / /_ _ _ _| | |_ / / | | ) |
\ \/ / _` | | | | | __| / / | | / /
\ / (_| | |_| | | |_ / / | |/ /_
\/ \__,_|\__,_|_|\__| /_/ |_|____|
EOF
echo " "
echo -e "Grin has been succesfully installed, please choose one of the options below.\nNOTE: You must start the Grin server and node before choosing other options\n"
echo -e "Please select an option\n"
echo "GRIN MAIN OPTIONS"
echo "1) Start a Grin Node"
echo "2) Start a Grin Mining Server"
echo "3) Start a Non-Mining Server"
echo "4) Shutdown all Grin Nodes & Servers"
echo ""
echo "GRIN DEBUG OPTIONS"
echo "5) View Confirmed & Spendable Balance "
echo "6) Show Individual Outputs"
echo "7) Show Detailed Individual Outputs"
echo ""
echo "GRIN SEND & RECEIVE OPTIONS"
echo "8) Send Grin to an IP:PORT"
echo "9) Receive Grin to an IP:PORT"
echo "10) Send Grin to Termbin"
echo "11) Receive Grin from Termbin"
echo "12) Send Grin to an Email"
echo ""
echo "VAULT 712 OPTIONS"
echo "13) Reinstall Grin To Latest Available"
echo "14) Exit"
echo "====================================="
read m_menu
case "$m_menu" in
1) option_1;;
2) option_2;;
3) option_3;;
4) option_4;;
5) option_5;;
6) option_6;;
7) option_7;;
8) option_8;;
9) option_9;;
10) option_10;;
11) option_11;;
12) option_12;;
13) option_13;;
14) exit 0;;
*) echo "Error, invalid input, press ENTER to go back"; read;;
esac
done
}
option_1()
{
##export function, run a new shell starting the wallet/node listener
export -f my_node
$(gnome-terminal --tab -e "bash -c 'my_node'")
}
option_2()
{
##export function, run a new shell starting the server
export -f my_server
$(gnome-terminal --tab -e "bash -c 'my_server'")
}
option_3()
{
##export function, run a new shell starting the server
export -f my_server_nonmining
$(gnome-terminal --tab -e "bash -c 'my_server_nonmining'")
}
option_4()
{
##shutdown any Grin process
killall -9 grin
main_menu
}
option_5()
{
##export function, run a new shell
export -f my_spendbalance
$(gnome-terminal --tab -e "bash -c 'my_spendbalance'")
}
option_6()
{
##export function, run a new shell
export -f my_outputs
$(gnome-terminal --tab -e "bash -c 'my_outputs'")
}
option_7()
{
export -f my_outputs_detailed
$(gnome-terminal --tab -e "bash -c 'my_outputs_detailed'")
}
option_8()
{
echo "option 8"
##TODO
}
option_9()
{
echo "option 9"
##TODO
}
option_10()
{
echo This option will send Grins to Termbin and can be claimed by anyone that knows the url
read -p 'Please enter amount to send: ' amountvar
grin wallet -p password send $amountvar
termbinvar="$( $amountvar | nc termbin.com 9999)"
echo Share this url to allow someone to claim the output: "$termbinvar"
echo Press any key to return
read
}
option_11()
{
echo "option 11"
##TODO
}
option_12()
{
echo "option 12"
##TODO
}
option_13()
{
export -f reinstall_grin
$(gnome-terminal --tab -e "bash -c 'reinstall_grin'")
}
##Check if Clang is installed
if [ "type -p clang-3.8" ];
then
:
else
clang_installer
fi
##Check if Rust is installed
if [ "type -p rustc" ];
then
:
else
rust_installer
fi
##Check if Grin is installed
if [ -d "$HOME/mw/grin/" ];
then
main_menu
else
main_installer
fi