Skip to content

Instantly share code, notes, and snippets.

@cryptorex
Last active April 22, 2018 13:08
Show Gist options
  • Save cryptorex/d8e413f5352e339323e26df72ea2dee3 to your computer and use it in GitHub Desktop.
Save cryptorex/d8e413f5352e339323e26df72ea2dee3 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=47.93.28.82:55442
addnode=111.231.115.104:55442
addnode=45.32.56.195:55442
addnode=172.105.236.85:55442
addnode=45.64.254.46:55442
addnode=123.129.117.55:44594
addnode=108.160.138.68:55442
addnode=112.224.17.251:59305
addnode=27.223.152.124:7276
addnode=221.193.168.201:43904
addnode=183.238.79.7:43856
addnode=86.52.59.182:51641
addnode=45.76.138.170:43998
addnode=111.230.49.58:57686
addnode=59.58.211.185:64985
addnode=94.181.94.119:62791
addnode=5.19.4.80:49900
addnode=106.119.66.7:1400
addnode=109.190.219.180:50046
addnode=183.192.14.73:36743
addnode=112.11.230.137:25537
addnode=113.82.11.138:19609
addnode=115.215.79.70:1451
addnode=207.148.100.8:35786
addnode=45.32.244.135:45560
addnode=27.68.133.133:40546
addnode=112.11.230.137:9281
addnode=47.52.198.16:49734
addnode=106.120.63.13:10063
addnode=61.171.206.61:52934
addnode=223.80.237.181:12682
addnode=45.76.63.193:55442
addnode=58.38.127.145:14427
addnode=106.120.63.13:29736
addnode=5.19.4.80:49915
addnode=140.82.43.144:55442
addnode=106.120.63.13:10272
addnode=140.82.7.70:40698
addnode=106.120.63.13:10179
addnode=62.133.162.127:9963
addnode=111.50.87.78:1696
addnode=85.238.101.69:52625
addnode=115.195.48.88:63621
addnode=58.221.87.50:37063
addnode=45.77.38.21:51772
addnode=27.223.152.124:6025
addnode=91.227.50.21:55442
addnode=113.212.123.108:55442
addnode=45.77.38.21:52138
addnode=220.112.16.111:10012
addnode=185.221.152.62:55442
addnode=106.120.63.13:10310
addnode=110.82.247.127:2161
addnode=183.215.186.59:54671
addnode=45.77.33.35:43600
addnode=106.120.63.13:10782
addnode=27.68.133.133:33518
addnode=51.15.45.45:36862
addnode=94.13.68.197:51182
addnode=121.33.130.159:3861
addnode=106.120.63.13:51267
addnode=106.120.63.13:51435
addnode=45.32.244.135:54108
addnode=45.77.38.21:53546
addnode=110.86.77.91:51001
addnode=183.238.79.15:26744
addnode=89.40.7.188:55442
addnode=47.88.223.166:42146
addnode=51.38.49.168:40332
addnode=47.74.229.25:55442
addnode=45.32.244.135:55106
addnode=206.189.20.212:41834
addnode=49.81.20.200:65205
addnode=106.15.198.3:58941
addnode=45.77.198.201:55442
addnode=45.56.76.125:55442
addnode=223.114.227.99:23743
addnode=51.38.48.56:55442
addnode=45.77.38.21:53858
addnode=45.32.244.135:56746
addnode=45.32.244.135:57014
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