-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchainflip.sh
138 lines (118 loc) · 5 KB
/
chainflip.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
#!/bin/bash
# the function is for showing progress bar
show_progress() {
local total_steps=$1
local current_step=0
while [ $current_step -le $total_steps ]; do
echo -ne "Processing: ${current_step}%\r"
sleep 0.5
((current_step+=5))
done
echo -ne "Installation complete: 100%\n"
}
echo "
░█████╗░██╗░░██╗░█████╗░██╗███╗░░██╗███████╗██╗░░░░░██╗██████╗░
██╔══██╗██║░░██║██╔══██╗██║████╗░██║██╔════╝██║░░░░░██║██╔══██╗
██║░░╚═╝███████║███████║██║██╔██╗██║█████╗░░██║░░░░░██║██████╔╝
██║░░██╗██╔══██║██╔══██║██║██║╚████║██╔══╝░░██║░░░░░██║██╝░
╚█████╔╝██║░░██║██║░░██║██║██║░╚███║██║░░░░░███████╗██║██║░░░░░
░╚════╝░╚═╝░░╚═╝╚═╝░░╚═╝╚═╝╚═╝░░╚══╝╚═╝░░░░░╚═══ @RamaAditya"
echo "Choose what do you want:"
echo "1. Fixing Chainflip node problem"
echo "2. Upgrade the node ( CFE Version )"
echo "3. Update boot node"
echo "4. Rotate your node"
echo "5. Change your vanity name"
echo "6. Restart the node and the engine"
echo "7. Check logs"
echo "8. Recovery your pharse"
read -p "Your choice: " choice
case $choice in
1)
# for fixing the chainflip's node problem
{
sudo systemctl stop chainflip-node > /dev/null 2>&1
sudo systemctl stop chainflip-engine > /dev/null 2>&1
sudo rm -rf /lib/systemd/system/chainflip-node.service
sudo rm -rf /etc/chainflip/perseverance.chainspec.json
sudo chainflip-node purge-chain --chain /etc/chainflip/perseverance.chainspec.json --base-path /etc/chainflip/chaindata/
sudo apt install git > /dev/null 2>&1
sudo git clone https://github.com/RamaaAditya/chainflip-0.9.git > /dev/null 2>&1
sudo cp -r ./chainflip-0.9/chainflip-node.service /lib/systemd/system/
sudo cp -r ./chainflip-0.9/perseverance.chainspec.json /etc/chainflip/
sudo rm -rf ./chainflip-0.9
sudo systemctl daemon-reload > /dev/null 2>&1
sudo systemctl start chainflip-node > /dev/null 2>&1
sudo systemctl start chainflip-engine > /dev/null 2>&1
} & show_progress 100
echo "All Installations Were Already done!, you can check your node
by execute this command below
sudo journalctl -f -u chainflip-*"
;;
2)
# For Update Chainflip version 0.8 -> 0.9
{
sudo systemctl stop chainflip-node
sudo systemctl stop chainflip-engine
sudo rm /etc/apt/sources.list.d/chainflip.list
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/chainflip.gpg] https://repo.chainflip.io/perseverance/$(lsb_release -c -s) $(lsb_release -c -s) main" | sudo tee /etc/apt/sources.list.d/chainflip.list
sudo apt update > /dev/null/ 2>&1
sudo apt --only-upgrade install "chainflip-*" > /dev/null/ 2>&1
sudo systemctl start chainflip-node
sudo systemctl start chainflip-engine
} & show_progress 100
echo "Update to 0.9 Already done .."
;;
3)
#Update bootnode
{
sudo systemctl stop chainflip-node
sudo systemctl stop chainflip-engine
sudo rm -rf /etc/chainflip/perseverance.chainspec.json
sudo apt install git > /dev/null 2>&1
sudo git clone https://github.com/RamaaAditya/chainflip-0.9.git > /dev/null 2>&1
sudo cp -r ./chainflip-0.9/perseverance.chainspec.json /etc/chainflip/
sudo rm -rf ./chainflip-0.9
sudo systemctl daemon-reload > /dev/null 2>&1
sudo systemctl start chainflip-node > /dev/null 2>&1
sudo systemctl start chainflip-engine > /dev/null 2>&1
} & show_progress 100
echo "Update bootnode already done .."
;;
4)
# Rotate node
{
sudo chainflip-cli --config-root /etc/chainflip rotate
}
;;
5)
# to change vanity name
echo "Input your vanity name ( highly recomended to use your discord name )"
read -p "Input your vanity name: " vanity
{
sudo chainflip-cli --config-root /etc/chainflip vanity-name $vanity
}
;;
6)
#to restart the node & the engine
{
sudo systemctl restart chainflip-node
sudo systemctl restart chainflip-engine
} & show_progress 100
echo "Restart already done"
;;
7)
# to check logs
{
sudo journalctl -f -u chainflip-*
}
;;
8)
{
chainflip-node key inspect "0x$(sudo cat /etc/chainflip/keys/signing_key_file)"
}
;;
*)
echo "Choise is not valid."
;;
esac