forked from okannako/celestia-blockspacerace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nodescript.sh
461 lines (359 loc) · 14.4 KB
/
nodescript.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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
#!/bin/bash
echo -e "\033[0;37m"
echo "============================================================================================================"
echo " ##### #### #### #### #### ###### ########## #### #### ########### #### ####"
echo " ###### #### ###### #### #### ######## ########## #### #### #### #### #### ####"
echo " ####### #### ### ### ######## #### #### #### #### #### #### #### ########"
echo " #### ####### ########## ######## #### #### #### #### #### ########### ########"
echo " #### ###### ############ #### #### #### #### #### #### #### #### #### #### ####"
echo " #### ##### #### #### #### #### ######## #### ############ #### #### #### ####"
echo " #### #### #### #### #### #### #### #### ############ #### #### #### ####"
echo "============================================================================================================"
echo -e '\e[36mTwitter :\e[39m' https://twitter.com/NakoTurk
echo -e '\e[36mGithub :\e[39m' https://github.com/okannako
echo -e '\e[36mYoutube :\e[39m' https://www.youtube.com/@CryptoChainNakoTurk
echo -e "\e[0m"
sleep 5
echo -e "\e[1m\e[32m What is it you want to do? \e[0m" && sleep 2
PS3='Select an action: '
options=(
"Validator Node Install"
"Validator Node Control"
"Create Validator"
"Light Node Install"
"Bridge Node Install"
"Full Storage Node Install"
"Light Node Resetting Data"
"Bridge Node Resetting Data"
"Full Storage Node Resetting Data"
"What is Light Node ID?"
"What is Bridge Node ID?"
"What is Full Storage Node ID?"
"Exit")
select opt in "${options[@]}"
do
case $opt in
"Validator Node Install")
echo -e "\e[1m\e[32m Updates \e[0m" && sleep 2
sudo apt update && sudo apt upgrade -y
sudo apt install curl tar wget clang pkg-config libssl-dev jq build-essential git ncdu -y
sudo apt install make -y && cd $HOME
sleep 1
echo -e "\e[1m\e[32m Install Go \e[0m" && sleep 2
ver="1.20.3"
cd $HOME
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz"
rm "go$ver.linux-amd64.tar.gz"
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile
go version && sleep 2
cd $HOME
rm -rf celestia-app
git clone https://github.com/celestiaorg/celestia-app.git
cd celestia-app/
APP_VERSION=v0.13.0
git checkout tags/$APP_VERSION -b $APP_VERSION
make install
celestia-appd version && sleep 3
cd $HOME
rm -rf networks
git clone https://github.com/celestiaorg/networks.git
echo "NodeName:"
read NodeName
echo export NodeName=${NodeName} >> $HOME/.bash_profile
celestia-appd init "$NodeName" --chain-id blockspacerace-0
cp $HOME/networks/blockspacerace/genesis.json $HOME/.celestia-app/config
peers="[email protected]:26656,[email protected]:26686,[email protected]:26656,[email protected]:26656,[email protected]:2000,[email protected]:26656,[email protected]:20656,[email protected]:52656,[email protected]:12056,[email protected]:26656"
sed -i -e "s|^persistent_peers *=.*|persistent_peers = \"$peers\"|" $HOME/.celestia-app/config/config.toml
PRUNING="nothing"
sed -i -e "s/^pruning *=.*/pruning = \"$PRUNING\"/" $HOME/.celestia-app/config/app.toml
celestia-appd tendermint unsafe-reset-all --home $HOME/.celestia-app
sudo tee <<EOF >/dev/null /etc/systemd/system/celestia-appd.service
[Unit]
Description=celestia-appd Cosmos daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$HOME/go/bin/celestia-appd start
Restart=on-failure
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable celestia-appd
sudo systemctl start celestia-appd
echo "WalletName:"
read WalletName
echo export WalletName=${WalletName} >> $HOME/.bash_profile
celestia-appd keys add $WalletName
echo -e '\e[36mIn this step, information about your wallet is shared. >>>PLEASE BACK UP THE MNEMONIC WORDS.<<< After backing up, you can continue by pressing the Enter key.\e[39m'
read Enter
echo -e '\e[36mIMPORTANT: Wait for synchronisation to the current block. To check, restart the script and select the relevant option.\e[39m'
sleep 7
sudo journalctl -u celestia-appd -f
break
;;
"Validator Node Control")
celestia-appd status 2>&1 | jq .SyncInfo
echo -e '\e[36mIMPORTANT: When "catching_up": false, you have accessed the current block and you can run the script again and Create Validator. Before creating a validator, be sure to request a test token on Discord to your wallet.\e[39m'
sleep 10
break
;;
"Create Validator")
celestia-appd tx staking create-validator \
--amount=1000000utia \
--pubkey=$(celestia-appd tendermint show-validator) \
--moniker=$NodeName \
--chain-id=blockspacerace-0 \
--commission-rate=0.05 \
--commission-max-rate=0.20 \
--commission-max-change-rate=0.01 \
--min-self-delegation=1 \
--from=$WalletName \
--gas-adjustment=1.4 \
--gas=auto \
--gas-prices=0.01utia
echo -e '\e[36mIMPORTANT: After the validator creation step is finished, be sure to back up the config folder in the .celestia-appd folder.\e[39m'
sleep 10
break
;;
"Light Node Install")
echo -e "\e[1m\e[32m Updates \e[0m" && sleep 2
sudo apt update && sudo apt upgrade -y
sudo apt install curl tar wget clang pkg-config libssl-dev jq build-essential git ncdu -y
sudo apt install make -y && cd $HOME
sleep 1
echo -e "\e[1m\e[32m Install Go \e[0m" && sleep 2
ver="1.20.3"
cd $HOME
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz"
rm "go$ver.linux-amd64.tar.gz"
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile
go version && sleep 2
cd $HOME
rm -rf celestia-node
git clone https://github.com/celestiaorg/celestia-node.git
cd celestia-node/
git checkout tags/v0.9.4
make build
make install
make cel-key
celestia version && sleep 3
celestia light init --p2p.network blockspacerace
echo -e '\e[36mIn this step, information about your wallet is shared. >>>PLEASE BACK UP THE MNEMONIC WORDS.<<< After backing up, you can continue by pressing the Enter key.\e[39m'
read Enter
sudo tee <<EOF >/dev/null /etc/systemd/system/celestia-lightd.service
[Unit]
Description=celestia-lightd Light Node
After=network-online.target
[Service]
User=$USER
ExecStart=/usr/local/bin/celestia light start --core.ip https://rpc-blockspacerace.pops.one --core.rpc.port 26657 --core.grpc.port 9090 --keyring.accname my_celes_key --metrics.tls=false --metrics --metrics.endpoint otel.celestia.tools:4318 --gateway --gateway.addr localhost --gateway.port 26659 --p2p.network blockspacerace
Restart=on-failure
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF
systemctl enable celestia-lightd
systemctl start celestia-lightd
echo -e '\e[36mIMPORTANT: /root/.celestia-light-blockspacerace-0 under the keys folder must be backed up.\e[39m'
sleep 7
journalctl -u celestia-lightd.service -f
break
;;
"Bridge Node Install")
echo -e "\e[1m\e[32m Updates \e[0m" && sleep 2
sudo apt update && sudo apt upgrade -y
sudo apt install curl tar wget clang pkg-config libssl-dev jq build-essential git ncdu -y
sudo apt install make -y && cd $HOME
sleep 1
echo -e "\e[1m\e[32m Install Go \e[0m" && sleep 2
ver="1.20.3"
cd $HOME
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz"
rm "go$ver.linux-amd64.tar.gz"
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile
go version && sleep 2
cd $HOME
rm -rf celestia-app
git clone https://github.com/celestiaorg/celestia-app.git
cd celestia-app/
APP_VERSION=v0.13.0
git checkout tags/$APP_VERSION -b $APP_VERSION
make install
celestia-appd version && sleep 3
cd $HOME
rm -rf networks
git clone https://github.com/celestiaorg/networks.git
echo "NodeName:"
read NodeName
echo export NodeName=${NodeName} >> $HOME/.bash_profile
celestia-appd init "$NodeName" --chain-id blockspacerace-0
cp $HOME/networks/blockspacerace/genesis.json $HOME/.celestia-app/config
peers="[email protected]:26656,[email protected]:26686,[email protected]:26656,[email protected]:26656,[email protected]:2000,[email protected]:26656,[email protected]:20656,[email protected]:52656,[email protected]:12056,[email protected]:26656"
sed -i -e "s|^persistent_peers *=.*|persistent_peers = \"$peers\"|" $HOME/.celestia-app/config/config.toml
PRUNING="nothing"
sed -i -e "s/^pruning *=.*/pruning = \"$PRUNING\"/" $HOME/.celestia-app/config/app.toml
celestia-appd tendermint unsafe-reset-all --home $HOME/.celestia-app
sudo tee <<EOF >/dev/null /etc/systemd/system/celestia-appd.service
[Unit]
Description=celestia-appd Cosmos daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$HOME/go/bin/celestia-appd start
Restart=on-failure
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable celestia-appd
sudo systemctl start celestia-appd
echo -e '\e[36mIMPORTANT: /root/.celestia-appd under the config folder must be backed up.\e[39m'
sleep 7
cd $HOME
rm -rf celestia-node
git clone https://github.com/celestiaorg/celestia-node.git
cd celestia-node/
git checkout tags/v0.9.4
make build
make install
make cel-key
celestia version && sleep 3
celestia bridge init --core.ip localhost --core.rpc.port 26657 --core.grpc.port 9090 --p2p.network blockspacerace
echo -e '\e[36mIn this step, information about your wallet is shared. >>>PLEASE BACK UP THE MNEMONIC WORDS.<<< After backing up, you can continue by pressing the Enter key.\e[39m'
read Enter
sudo tee <<EOF >/dev/null /etc/systemd/system/celestia-bridge.service
[Unit]
Description=celestia-bridge Cosmos daemon
After=network-online.target
[Service]
User=$USER
ExecStart=/usr/local/bin/celestia bridge start --core.ip localhost --core.rpc.port 26657 --core.grpc.port 9090 --keyring.accname my_celes_key --metrics.tls=false --metrics --metrics.endpoint otel.celestia.tools:4318 --p2p.network blockspacerace
Restart=on-failure
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable celestia-bridge
sudo systemctl start celestia-bridge
echo -e '\e[36mIMPORTANT: /root/.celestia-bridge-blockspacerace-0 under the keys folder must be backed up.\e[39m'
sleep 7
sudo journalctl -u celestia-bridge.service -f
break
;;
"Full Storage Node Install")
echo -e "\e[1m\e[32m Updates \e[0m" && sleep 2
sudo apt update && sudo apt upgrade -y
sudo apt install curl tar wget clang pkg-config libssl-dev jq build-essential git ncdu -y
sudo apt install make -y && cd $HOME
sleep 1
echo -e "\e[1m\e[32m Install Go \e[0m" && sleep 2
ver="1.20.3"
cd $HOME
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz"
rm "go$ver.linux-amd64.tar.gz"
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile
go version && sleep 2
cd $HOME
rm -rf celestia-node
git clone https://github.com/celestiaorg/celestia-node.git
cd celestia-node/
git checkout tags/v0.9.4
make build
make install
make cel-key
celestia version && sleep 3
celestia full init --p2p.network blockspacerace
echo -e '\e[36mIn this step, information about your wallet is shared. >>>PLEASE BACK UP THE MNEMONIC WORDS.<<< After backing up, you can continue by pressing the Enter key.\e[39m'
read Enter
sudo tee <<EOF >/dev/null /etc/systemd/system/celestia-fulld.service
[Unit]
Description=celestia-fulld Full Node
After=network-online.target
[Service]
User=$USER
ExecStart=/usr/local/bin/celestia full start --core.ip https://rpc-blockspacerace.pops.one --core.rpc.port 26657 --core.grpc.port 9090 --keyring.accname my_celes_key --metrics.tls=false --metrics --metrics.endpoint otel.celestia.tools:4318 --gateway --gateway.addr localhost --gateway.port 26659 --p2p.network blockspacerace
Restart=on-failure
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF
systemctl enable celestia-fulld
systemctl start celestia-fulld
echo -e '\e[36mIMPORTANT: /root/.celestia-full-blockspacerace-0 under the keys folder must be backed up.\e[39m'
sleep 7
journalctl -u celestia-fulld.service -f
break
;;
"Light Node Resetting Data")
systemctl stop celestia-lightd
celestia light unsafe-reset-store --p2p.network blockspacerace
systemctl restart celestia-lightd
journalctl -u celestia-lightd.service -f
break
;;
"Bridge Node Resetting Data")
sudo systemctl stop celestia-bridge
celestia bridge unsafe-reset-store --p2p.network blockspacerace
sudo systemctl restart celestia-bridge
sudo journalctl -u celestia-bridge.service -f
break
;;
"Full Storage Node Resetting Data")
systemctl stop celestia-fulld
celestia full unsafe-reset-store --p2p.network blockspacerace
systemctl restart celestia-fulld
journalctl -u celestia-fulld.service -f
break
;;
"What is Light Node ID?")
AUTH_TOKEN=$(celestia light auth admin --p2p.network blockspacerace)
curl -X POST \
-H "Authorization: Bearer $AUTH_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":0,"method":"p2p.Info","params":[]}' \
http://localhost:26658
break
;;
"What is Bridge Node ID?")
AUTH_TOKEN=$(celestia bridge auth admin --p2p.network blockspacerace)
curl -X POST \
-H "Authorization: Bearer $AUTH_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":0,"method":"p2p.Info","params":[]}' \
http://localhost:26658
break
;;
"What is Full Storage Node ID?")
AUTH_TOKEN=$(celestia full auth admin --p2p.network blockspacerace)
curl -X POST \
-H "Authorization: Bearer $AUTH_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":0,"method":"p2p.Info","params":[]}' \
http://localhost:26658
break
;;
"Exit")
exit
;;
*) echo "invalid option";;
esac
done
done