Skip to content

Instantly share code, notes, and snippets.

@babychain
Forked from cryptorex/mndeploy.sh
Last active July 28, 2020 14:10
Show Gist options
  • Save babychain/94a5f9385aa7e5c8b216d352d2d3d210 to your computer and use it in GitHub Desktop.
Save babychain/94a5f9385aa7e5c8b216d352d2d3d210 to your computer and use it in GitHub Desktop.
#!/bin/bash
#MIT License
#
#Copyright (c) 2018 cryptorex @ github.com
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all
#copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#SOFTWARE.
### THIS script is for deploying BABY coin masternodes on Ubuntu 16.04
### Best to use Vultr.com - you can use my referral link https://www.vultr.com/?ref=7393038
### Visit Bitcointalk: https://bitcointalk.org/index.php?topic=3227924.0
### Donations to author welcome BitcoinZ: t1VtKS3vj5YvyJk6djhtvWSLJnNxiKGMv94
### This script assumes:
###
### 1) babyd daemon is in /home/dir/babyd (ex. if username is ubuntu then /home/ubuntu/babyd)
### in this example the babyd binary will be accessed with /home/ubuntu/babyd/babyd
###
### 2) this is a brand new deployment and your IPv6 addresses have already been setup on your VPS
###
### 3) you are running this script from home directory (ex. if username is ubuntu then /home/ubuntu)
###
###
### STEP 1 - Enter your Network from Vultr Settings -> IPv6 panel
network=2001:19f0:6401:1cd9::
### STEP 2 - Enter your beginning and ending IPv6 IPs
### For example, if you will create 10 masternodes 'begin' should be 1000 and 'end' should be 1009
### WARNING - these must already be setup in your VPS - WARNING#####
### Example: if your network is 2001:32f3:74cf:1de1:: then your first IP is 2001:32f3:74cf:1de1::1000
###
begin=1000
end=1009
### STEP 3 - Create a file named mnkeys in the directory where you will execute this script
### and paste your masternode keys, one per line
###
### These are generated from the babyd wallet using 'masternode genkey'
### STEP 4 - Install pwgen with 'sudo apt-get install pwgen'
### STEP 5 - chmod +x mndeploy.sh
### Changes below this are NOT required
dircount=0
pwd=`pwd`
rpcuser=rpc`pwgen 15 1`
rpcpassword=rpc`pwgen 15 1`
echo ""
echo "Checking for pwgen package.."
if [ ! -f /usr/bin/pwgen ]; then
echo ""
echo "pwgen package not found. Please install with 'sudo apt-get install pwgen'"
echo ""
exit 0
fi
echo "Checking for mnkeys file..."
if [ ! -f $pwd/mnkeys ]; then
echo ""
echo "You must create your masternode keys file! ex." $pwd/mnkeys
echo "It should contain your masternode keys, one per line, created by wallet command 'masternode genkey'"
echo ""
exit 0
fi
echo "Checking for baby daemon.."
echo ""
if [ ! -f $pwd/babyd/babyd ]; then
echo ""
echo "Coin daemon NOT FOUND. Please place babyd daemon binary in: $pwd/babyd/"
echo ""
exit 0
fi
declare -a mnkeys
readarray -t mnkeys < $pwd/mnkeys
for i in $(seq $begin $end); do
`mkdir $pwd/.baby$((dircount + 1))`
echo creating datadir and config file at: $pwd/.baby$((dircount + 1))
echo "appending daemon start script..."
echo $pwd/babyd/./babyd -conf=\"$pwd/.baby$((dircount + 1))/baby.conf\" >> $pwd/startbabies
echo "echo starting baby daemon number:" $((dircount +1)) >> $pwd/startbabies
if [ $i != $end ]; then
echo sleep 5m >> $pwd/startbabies
fi
cat <<EOF > $pwd/.baby$((dircount + 1))/baby.conf
datadir=$pwd/.baby$((dircount + 1))
rpcallowip=127.0.0.1
rpcuser=$rpcuser
rpcpassword=$rpcpassword
staking=1
server=1
listen=1
daemon=1
bind=[$network$i]
rpcport=5546$dircount
masternode=1
masternodeaddr=[$network$i]:55442
externalip=[$network$i]:55442
masternodeprivkey=${mnkeys[$dircount]}
addnode=118.25.40.41
addnode=60.172.37.166
addnode=144.202.97.226
addnode=112.11.230.137
addnode=116.110.158.113
addnode=112.11.230.137
addnode=125.43.183.98
addnode=101.28.182.102
addnode=111.230.49.58
addnode=119.85.33.43
addnode=118.25.103.78
addnode=58.240.31.195
addnode=50.235.174.226
addnode=120.197.181.171
addnode=194.12.104.229
addnode=220.182.20.143
addnode=120.197.181.171
addnode=110.35.217.170
addnode=111.230.49.58
addnode=113.212.124.37
addnode=81.4.107.190
addnode=120.197.181.171
addnode=116.226.209.154
addnode=171.212.43.237
addnode=111.230.49.58
addnode=120.79.208.105
addnode=118.25.40.41
addnode=115.234.77.36
addnode=111.230.183.111
addnode=120.105.97.52
addnode=120.105.97.52
addnode=118.25.40.41
addnode=58.53.95.139
addnode=94.242.240.101
addnode=94.242.240.123
addnode=51.38.48.55
addnode=145.239.88.30
addnode=109.195.131.233
addnode=94.242.240.123
addnode=120.105.97.52
addnode=144.202.125.147
addnode=114.115.164.228
addnode=47.254.32.23
addnode=45.63.54.147
addnode=45.77.93.244
addnode=51.137.108.165
addnode=54.37.73.34
addnode=47.106.153.143
addnode=113.161.90.69
addnode=120.79.208.105
addnode=211.149.204.9
addnode=58.100.178.82
addnode=51.38.48.56
addnode=221.181.52.161
addnode=45.77.38.21
addnode=51.15.45.45
addnode=45.32.172.255
addnode=51.38.49.166
addnode=220.182.20.143
addnode=115.234.77.36
addnode=140.82.23.22
addnode=47.93.28.82
addnode=111.231.115.104
addnode=45.32.56.195
addnode=172.105.236.85
addnode=45.64.254.46
addnode=123.129.117.55
addnode=108.160.138.68
addnode=112.224.17.251
addnode=27.223.152.124
addnode=221.193.168.201
addnode=183.238.79.7
addnode=86.52.59.182
addnode=45.76.138.170
addnode=111.230.49.58
addnode=59.58.211.185
addnode=94.181.94.119
addnode=5.19.4.80
addnode=106.119.66.7
addnode=109.190.219.180
addnode=47.93.28.82
addnode=111.231.115.104
addnode=45.32.56.195
addnode=172.105.236.85
addnode=45.64.254.46
addnode=123.129.117.55
addnode=108.160.138.68
addnode=112.224.17.251
addnode=27.223.152.124
addnode=221.193.168.201
addnode=183.238.79.7
addnode=86.52.59.182
addnode=45.76.138.170
addnode=111.230.49.58
addnode=59.58.211.185
addnode=94.181.94.119
addnode=5.19.4.80
addnode=106.119.66.7
addnode=109.190.219.180
addnode=183.192.14.73
addnode=112.11.230.137
addnode=113.82.11.138
addnode=115.215.79.70
addnode=207.148.100.8
addnode=45.32.244.135
addnode=27.68.133.133
addnode=112.11.230.137
addnode=47.52.198.16
addnode=106.120.63.13
addnode=61.171.206.61
addnode=223.80.237.181
addnode=45.76.63.193
addnode=58.38.127.145
addnode=106.120.63.13
addnode=5.19.4.80
addnode=140.82.43.144
addnode=106.120.63.13
addnode=140.82.7.70
addnode=106.120.63.13
addnode=62.133.162.127
addnode=111.50.87.78
addnode=85.238.101.69
addnode=115.195.48.88
addnode=58.221.87.50
addnode=45.77.38.21
addnode=27.223.152.124
addnode=91.227.50.21
addnode=113.212.123.108
addnode=45.77.38.21
addnode=220.112.16.111
addnode=185.221.152.62
addnode=106.120.63.13
addnode=110.82.247.127
addnode=183.215.186.59
addnode=45.77.33.35
addnode=106.120.63.13
addnode=27.68.133.133
addnode=51.15.45.45
addnode=94.13.68.197
addnode=121.33.130.159
addnode=106.120.63.13
addnode=45.32.244.135
addnode=45.77.38.21
addnode=110.86.77.91
addnode=183.238.79.15
addnode=89.40.7.188
addnode=47.88.223.166
addnode=51.38.49.168
addnode=47.74.229.25
addnode=45.32.244.135
addnode=206.189.20.212
addnode=49.81.20.200
addnode=106.15.198.3
addnode=45.77.198.201
addnode=45.56.76.125
addnode=223.114.227.99
addnode=51.38.48.56
addnode=45.77.38.21
addnode=45.32.244.135
EOF
((dircount++))
done
chmod +x $pwd/startbabies
echo "echo All nodes started. Script exiting." >> $pwd/startbabies
echo ""
echo "All config files created. You may start your nodes with ./startbabies"
echo "Your local windows wallet baby.conf config file should use the following rpc values: "
echo ""
echo "rpcuser=$rpcuser"
echo "rpcpassword=$rpcpassword"
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment