-
Notifications
You must be signed in to change notification settings - Fork 1
/
mn2.sh
executable file
·133 lines (112 loc) · 3.53 KB
/
mn2.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
#!/bin/bash
clear
echo "This is utility for setting up second MN on VPS with additional IPv6, refer to your VPS provider for info how to set it up."
read -p "Press enter to continue, or ctrl+c to terminate this procedure " -n1 -s
clear
systemctl stop xdn.service
sleep 2
echo "Copying blockchain for Mastenode #2"
rm ~/.XDN/debug.log
touch ~/.XDN/debug.log
rsync -av --progress ~/.XDN/* ~/.XDN2
rm ~/.XDN2/wallet.dat
rm ~/.XDN2/DigitalNote.conf
systemctl start xdn.service
clear
USER=root
RPCUSER=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1)
RPCPASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
echo "Checking IPv6, please wait"
if [ -z "$EXTERNALIP" ]; then
EXTERNALIP=$(dig +short -6 myip.opendns.com aaaa @resolver1.ipv6-sandbox.opendns.com)
fi
if [ -z "$ARGUMENTIP" ]; then
if [ -z "$EXTERNALIP" ]; then
echo "Script tried unsuccessfully find your IPv6 interface, please make sure you have IPv6 activated on this VPS"
echo "If you want script to configure your Netplan network for you please use command mnxsetup"
echo "If everything is in order and you are sure of it, please enter your IPv6 manually"
echo ""
sleep 2
else
echo "Please confirm your IP address by pressing ENTER"
echo ""
fi
read -e -p "Server IPv6 Address: " -i $EXTERNALIP -e IP
fi
if [ -z "$KEY" ]; then
read -e -p "Masternode Private Key for your second MN : " KEY
fi
echo ""
echo "Add this to your masternode.conf on your local machine: <MN name> [${EXTERNALIP}]:19427 ${KEY} <TX ID>"
read -p "Press Enter to continue" -n1 -s
touch ~/.XDN2/DigitalNote.conf
cat > ~/.XDN2/DigitalNote.conf << EOL
${INSTALLERUSED}
rpcuser=${RPCUSER}
rpcpassword=${RPCPASSWORD}
rpcallowip=127.0.0.1
rpcport=12001
listen=1
server=1
daemon=1
maxconnections=150
externalip=[${IP}]
bind=[${IP}]:19427
masternodeaddr=[${IP}]:19427
masternodeprivkey=${KEY}
masternode=1
addnode=157.230.107.144:19427
addnode=89.40.10.129:19427
addnode=45.77.58.250:19427
addnode=104.131.27.134:19427
addnode=138.68.10.197:19427
addnode=212.24.103.156:19427
addnode=110.232.115.241:19427
addnode=139.99.239.62:19427
addnode=194.135.81.164:19427
addnode=161.35.231.193:19427
addnode=64.225.122.213:19427
addnode=82.165.119.20:19427
addnode=185.5.53.254:19427
addnode=138.197.161.183:19427
addnode=176.223.128.109:19427
addnode=66.42.71.176:19427
addnode=94.176.232.189:19427
addnode=185.81.167.251:19427
addnode=82.165.119.20:19427
addnode=104.238.156.128:19427
addnode=85.214.212.126:19427
EOL
chmod 0600 ~/.XDN2/DigitalNote.conf
chown -R $USER:$USER ~/.XDN2
cat > /etc/systemd/system/xdn2.service << EOL
[Unit]
Description=XDND2
After=network.target
[Service]
Type=forking
User=root
WorkingDirectory=/root/
ExecStart=/root/Campusd -conf=/root/.XDN2/DigitalNote.conf -datadir=/root/.XDN2 -listen=12001
ExecStop=/root/Campusd -conf=/root/.XDN2/DigitalNote.conf -datadir=/root/.XDN2 -listen=12001
Restart=on-abort
[Install]
WantedBy=multi-user.target
EOL
sudo systemctl daemon-reload
sudo systemctl enable xdn2.service
sudo systemctl start xdn2.service
clear
echo "" && echo "Masternode #2 setup complete" && echo ""
cat << "EOF"
|Brought to you by|
__ __ _ ____ _ _ _ ____ _____
| \/ / |/ ___| | | | | / ___|__ /
| |\/| | | | | |_| | | | | / /
| | | | | |___| _ | |__| |___ / /_
|_| |_|_|\____|_| |_|_____\____/____|
For complains Tweet @M1chl
XDN: dUUhW8oUsuB7GieV1PkqEctArPLvS5j7a2
EOF
rm ~/mn2.sh
read -p "Press Enter to continue" -n1 -s