Syscoin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Useful scripts for Syscoin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# update | |
sudo yum update -y | |
# build tools | |
sudo yum install -y git gcc-c++ libtool make autoconf automake epel-release openssl-devel libevent-devel python3 python-devel patch | |
# boost 1.65 | |
curl -sL https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz -o boost_1_65_1.tar.gz | |
tar -xvf boost_1_65_1.tar.gz && pushd boost_1_65_1 | |
./bootstrap.sh | |
sudo ./b2 cxxflags=-fPIC -a --with=all -j$(nproc) toolset=gcc link=static runtime-link=static install | |
popd | |
# berkeleydb 4.8 (requires epel-release) | |
sudo yum install -y libdb4-devel libdb4-cxx-devel | |
# upnp (requires epel-release) | |
sudo yum install -y miniupnpc-devel | |
# zmq (requires epel-release) | |
sudo yum install -y czmq-devel | |
# syscoin | |
git clone https://github.com/syscoin/syscoin.git | |
cd syscoin | |
./autogen.sh | |
./configure | |
make -j$(nproc) -pipe | |
sudo make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# update | |
sudo apt update -y | |
# build tools | |
sudo apt install -y git build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3 | |
# boost | |
sudo apt install -y libboost-all-dev | |
# berkeleydb 4.8 via syscoin contrib | |
source <(curl https://raw.githubusercontent.com/syscoin/syscoin/master/contrib/install_db4.sh) "$(pwd)" | |
export BDB_PREFIX="$(pwd)/db4" | |
# miniupnpc | |
sudo apt install -y libminiupnpc-dev | |
# zmq | |
sudo apt install -y libzmq3-dev | |
# syscoin | |
git clone https://github.com/syscoin/syscoin.git | |
cd syscoin | |
./autogen.sh | |
./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include" | |
make -j$(nproc) -pipe | |
sudo make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# update | |
sudo dnf update -y | |
# build tools | |
sudo dnf install -y git gcc-c++ libtool make autoconf automake openssl-devel libevent-devel python3 | |
# boost | |
sudo dnf install -y boost-devel | |
# berkeleydb 4.8 | |
sudo dnf install -y libdb4-devel libdb4-cxx-devel | |
# miniupnpc | |
sudo dnf install -y miniupnpc-devel | |
# zmq | |
sudo dnf install -y czmq-devel | |
# syscoin | |
git clone https://github.com/syscoin/syscoin.git | |
cd syscoin | |
./autogen.sh | |
./configure | |
make -j$(nproc) -pipe | |
sudo make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# xcode command line tools | |
xcode-select --install | |
# update | |
brew update | |
# build tools | |
brew install git automake libtool miniupnpc openssl pkg-config protobuf python qt libevent qrencode librsvg | |
# boost | |
brew install boost | |
# berkeleydb 4.8 | |
brew install berkeley-db@4 | |
# miniupnpc | |
brew install miniupnpc | |
# zmq | |
brew install czmq | |
# syscoin | |
git clone https://github.com/syscoin/syscoin.git | |
cd syscoin | |
./autogen.sh | |
./configure | |
make -j$(sysctl -n hw.ncpu) -pipe | |
sudo make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# required for libdb4.8 | |
sudo apt install -y software-properties-common | |
sudo add-apt-repository ppa:bitcoin/bitcoin | |
# update | |
sudo apt update -y | |
# build tools | |
sudo apt install -y git build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3 | |
# boost | |
sudo apt install -y libboost-all-dev | |
# berkeleydb 4.8 | |
sudo apt install -y libdb4.8-dev libdb4.8++-dev | |
# miniupnpc | |
sudo apt install -y libminiupnpc-dev | |
# zmq | |
sudo apt install -y libzmq3-dev | |
# syscoin | |
git clone https://github.com/syscoin/syscoin.git | |
cd syscoin | |
./autogen.sh | |
./configure | |
make -j$(nproc) -pipe | |
sudo make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# required for libdb4.8 | |
sudo apt install -y software-properties-common | |
sudo add-apt-repository ppa:bitcoin/bitcoin | |
# update | |
sudo apt update -y | |
# build tools | |
sudo apt install -y git build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3 python-dev | |
# boost 1.65 | |
curl -sL https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz -o boost_1_65_1.tar.gz | |
tar -xvf boost_1_65_1.tar.gz && pushd boost_1_65_1 | |
./bootstrap.sh | |
sudo ./b2 cxxflags=-fPIC -a --with=all -j$(nproc) toolset=gcc install | |
popd | |
# berkeleydb 4.8 | |
sudo apt install -y libdb4.8-dev libdb4.8++-dev | |
# miniupnpc | |
sudo apt install -y libminiupnpc-dev | |
# zmq | |
sudo apt install -y libzmq3-dev | |
# syscoin | |
git clone https://github.com/syscoin/syscoin.git | |
cd syscoin | |
./autogen.sh | |
# must point to newer boost to prevent conflicts! | |
./configure --with-boost-libdir="/usr/local/lib/" | |
make -j$(nproc) -pipe | |
sudo make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Only run as a root user | |
if [ "$(sudo id -u)" != "0" ]; then | |
echo "This script may only be run as root or with user with sudo privileges." | |
exit 1 | |
fi | |
HBAR="---------------------------------------------------------------------------------------" | |
# import messages | |
source <(curl -sL https://gist.githubusercontent.com/doublesharp/bacf7f9ac1ff15dccc1acffe49f989e9/raw/messages.sh) | |
pause(){ | |
echo "" | |
read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n' | |
} | |
do_exit(){ | |
echo "" | |
echo "Install script (and donations welcomed) by:" | |
echo "" | |
echo " demesm @ address SkSsc5DDejrXq2HfRf9B9QDqHrNiuUvA9Y" | |
echo " doublesharp @ alias doublesharp / address Sj2UbC3rYnbDULmQTir24swKactV6WPzoh" | |
echo "" | |
echo "Goodbye!" | |
echo "" | |
exit 0 | |
} | |
update_system(){ | |
echo "$MESSAGE_UPDATE" | |
# update package and upgrade Ubuntu | |
sudo DEBIAN_FRONTEND=noninteractive apt -y update | |
sudo DEBIAN_FRONTEND=noninteractive apt -y upgrade | |
sudo DEBIAN_FRONTEND=noninteractive apt -y autoremove | |
sudo apt install git -y | |
clear | |
} | |
maybe_prompt_for_swap_file(){ | |
# Create swapfile if less than 4GB memory | |
MEMORY_RAM=$(free -m | awk '/^Mem:/{print $2}') | |
MEMORY_SWAP=$(free -m | awk '/^Swap:/{print $2}') | |
MEMORY_TOTAL=$(($MEMORY_RAM + $MEMORY_SWAP)) | |
if [ $MEMORY_TOTAL -lt 3500 ]; then | |
echo "" | |
echo "Server memory is less than 4GB... you will be able to compile Syscoin Core faster by creating a swap file." | |
echo "" | |
if ! grep -q '/swapfile' /etc/fstab ; then | |
read -e -p "Do you want to create a swap file? [Y/n]: " CREATE_SWAP | |
if [ "$CREATE_SWAP" = "" ] || [ "$CREATE_SWAP" = "y" ] || [ "$CREATE_SWAP" = "Y" ]; then | |
IS_CREATE_SWAP="Y"; | |
fi | |
fi | |
fi | |
} | |
maybe_create_swap_file(){ | |
if [ "$IS_CREATE_SWAP" = "Y" ]; then | |
echo "Creating a 4GB swapfile..." | |
sudo swapoff -a | |
sudo dd if=/dev/zero of=/swapfile bs=1M count=4096 | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
echo '/swapfile none swap sw 0 0' | sudo tee --append /etc/fstab > /dev/null | |
sudo mount -a | |
echo "Swapfile created." | |
fi | |
} | |
install_dependencies(){ | |
echo "$MESSAGE_DEPENDENCIES" | |
# git | |
sudo apt install -y git | |
# build tools | |
sudo apt install -y build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils software-properties-common | |
# boost | |
sudo apt install -y libboost-all-dev | |
# bdb 4.8 | |
sudo add-apt-repository -y ppa:bitcoin/bitcoin | |
sudo apt update -y | |
sudo apt install -y libdb4.8-dev libdb4.8++-dev | |
# zmq | |
sudo apt install -y libzmq3-dev | |
clear | |
} | |
git_clone_repository(){ | |
echo "$MESSAGE_CLONING" | |
cd | |
if [ ! -d ~/syscoin ]; then | |
git clone https://github.com/syscoin/syscoin.git | |
fi | |
} | |
syscoin_branch(){ | |
read -e -p "Syscoin Core Github Branch [master]: " SYSCOIN_BRANCH | |
if [ "$SYSCOIN_BRANCH" = "" ]; then | |
SYSCOIN_BRANCH="master" | |
fi | |
} | |
git_checkout_branch(){ | |
cd ~/syscoin | |
git fetch | |
git checkout $SYSCOIN_BRANCH --quiet | |
if [ ! $? = 0 ]; then | |
echo "$MESSAGE_ERROR" | |
echo "Unable to checkout https://www.github.com/syscoin/syscoin/tree/${SYSCOIN_BRANCH}, please make sure it exists." | |
echo "" | |
exit 1 | |
fi | |
git pull | |
} | |
autogen(){ | |
echo "$MESSAGE_AUTOGEN" | |
cd ~/syscoin | |
./autogen.sh | |
clear | |
} | |
configure(){ | |
echo "$MESSAGE_MAKE_CONFIGURE" | |
cd ~/syscoin | |
./configure --without-gui | |
clear | |
} | |
compile(){ | |
echo "$MESSAGE_MAKE" | |
echo "Running compile with $(nproc) core(s)..." | |
# compile using all available cores | |
cd ~/syscoin | |
make -j$(nproc) -pipe | |
clear | |
} | |
make_install() { | |
echo "$MESSAGE_MAKE_INSTALL" | |
# install the binaries to /usr/local/bin | |
cd ~/syscoin | |
sudo make install | |
clear | |
} | |
install_sentinel(){ | |
echo "$MESSAGE_SENTINEL" | |
# go home | |
cd | |
if [ ! -d ~/sentinel ]; then | |
git clone https://github.com/syscoin/sentinel.git | |
else | |
cd sentinel | |
git fetch | |
git checkout master --quiet | |
git pull | |
fi | |
clear | |
} | |
install_virtualenv(){ | |
echo "$MESSAGE_VIRTUALENV" | |
cd ~/sentinel | |
# install virtualenv | |
sudo apt-get install -y python-virtualenv virtualenv | |
# setup virtualenv | |
virtualenv venv | |
venv/bin/pip install -r requirements.txt | |
clear | |
} | |
# syscoind.service config | |
SENTINEL_CONF=$(cat <<EOF | |
# syscoin conf location | |
syscoin_conf=/home/syscoin/.syscoincore/syscoin.conf | |
# db connection details | |
db_name=/home/syscoin/sentinel/database/sentinel.db | |
db_driver=sqlite | |
# network | |
EOF | |
) | |
# syscoind.service config | |
SENTINEL_PING=$(cat <<EOF | |
#!/bin/bash | |
~/sentinel/venv/bin/python ~/sentinel/bin/sentinel.py 2>&1 >> ~/sentinel/sentinel-cron.log | |
EOF | |
) | |
configure_sentinel(){ | |
echo "$MESSAGE_CRONTAB" | |
# create sentinel conf file | |
echo "$SENTINEL_CONF" > ~/sentinel/sentinel.conf | |
if [ "$IS_MAINNET" = "" ] || [ "$IS_MAINNET" = "y" ] || [ "$IS_MAINNET" = "Y" ]; then | |
echo "network=mainnet" >> ~/sentinel/sentinel.conf | |
else | |
echo "network=testnet" >> ~/sentinel/sentinel.conf | |
fi | |
cd | |
if [ -d /home/syscoin/sentinel ]; then | |
sudo rm -rf /home/syscoin/sentinel | |
fi | |
sudo mv -f ~/sentinel /home/syscoin | |
sudo chown -R syscoin.syscoin /home/syscoin/sentinel | |
# create sentinel-ping | |
echo "$SENTINEL_PING" > ~/sentinel-ping | |
# install sentinel-ping script | |
sudo mv -f ~/sentinel-ping /usr/local/bin | |
sudo chmod +x /usr/local/bin/sentinel-ping | |
# setup cron for syscoin user | |
sudo crontab -r -u syscoin | |
sudo crontab -l -u syscoin | grep sentinel-ping || echo "*/10 * * * * /usr/local/bin/sentinel-ping" | sudo crontab -u syscoin - | |
clear | |
} | |
start_syscoind(){ | |
echo "$MESSAGE_SYSCOIND" | |
sudo service syscoind start # start the service | |
sudo systemctl enable syscoind # enable at boot | |
clear | |
} | |
stop_syscoind(){ | |
echo "$MESSAGE_STOPPING" | |
sudo service syscoind stop | |
clear | |
} | |
clear | |
echo "$MESSAGE_WELCOME" | |
pause | |
clear | |
echo "$MESSAGE_PLAYER_ONE" | |
sleep 1 | |
clear | |
upgrade() { | |
syscoin_branch # ask which branch to use | |
clear | |
install_dependencies # make sure we have the latest deps | |
update_system # update all the system libraries | |
git_checkout_branch # check out our branch | |
clear | |
autogen # run ./autogen.sh | |
configure # run ./configure | |
compile # make and make install | |
stop_syscoind # stop syscoind if it is running | |
make_install # install the binaries | |
# maybe upgrade sentinel | |
if [ "$IS_UPGRADE_SENTINEL" = "" ] || [ "$IS_UPGRADE_SENTINEL" = "y" ] || [ "$IS_UPGRADE_SENTINEL" = "Y" ]; then | |
install_sentinel | |
install_virtualenv | |
configure_sentinel | |
fi | |
start_syscoind # start syscoind back up | |
echo "$MESSAGE_COMPLETE" | |
echo "Syscoin Core update complete using https://www.github.com/syscoin/syscoin/tree/${SYSCOIN_BRANCH}!" | |
do_exit # exit the script | |
} | |
# errors are shown if LC_ALL is blank when you run locale | |
if [ "$LC_ALL" = "" ]; then export LC_ALL="$LANG"; fi | |
# check to see if there is already a syscoin user on the system | |
if grep -q '^syscoin:' /etc/passwd; then | |
clear | |
echo "$MESSAGE_UPGRADE" | |
echo "" | |
echo " Choose [Y]es (default) to upgrade Syscoin Core on a working masternode." | |
echo " Choose [N]o to re-run the configuration process for your masternode." | |
echo "" | |
echo "$HBAR" | |
echo "" | |
read -e -p "Upgrade/recompile Syscoin Core? [Y/n]: " IS_UPGRADE | |
if [ "$IS_UPGRADE" = "" ] || [ "$IS_UPGRADE" = "y" ] || [ "$IS_UPGRADE" = "Y" ]; then | |
read -e -p "Upgrade Sentinel as well? [Y/n]: " IS_UPGRADE_SENTINEL | |
upgrade | |
fi | |
fi | |
clear | |
RESOLVED_ADDRESS=$(curl -s ipinfo.io/ip) | |
echo "$MESSAGE_CONFIGURE" | |
echo "" | |
echo "This script has been tested on Ubuntu 16.04 LTS x64." | |
echo "" | |
echo "Before starting script ensure you have: " | |
echo "" | |
echo " - Sent 100,000SYS to your masternode address" | |
echo " - Run 'masternode genkey' and 'masternode outputs' and recorded the outputs" | |
echo " - Added masternode config file ('Tools>Open Masternode Config' in Syscoin-Qt) " | |
echo " - addressAlias vpsIp:8369 masternodePrivateKey transactionId outputIndex" | |
echo " - EXAMPLE: mn1 ${RESOLVED_ADDRESS}:8369 ctk9ekf0m3049fm930jf034jgwjfk zkjfklgjlkj3rigj3io4jgklsjgklsjgklsdj 0" | |
echo " - Restarted Syscoin-Qt" | |
echo "" | |
echo "Default values are in brackets [default] or capitalized [Y/n] - pressing enter will use this value." | |
echo "" | |
echo "$HBAR" | |
echo "" | |
SYSCOIN_BRANCH="master" | |
DEFAULT_PORT=8369 | |
# syscoin.conf value defaults | |
rpcuser="sycoinrpc" | |
rpcpassword="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)" | |
masternodeprivkey="" | |
externalip="$RESOLVED_ADDRESS" | |
port="$DEFAULT_PORT" | |
# try to read them in from an existing install | |
if sudo test -f /home/syscoin/.syscoincore/syscoin.conf; then | |
sudo cp /home/syscoin/.syscoincore/syscoin.conf ~/syscoin.conf | |
sudo chown $(whoami).$(id -g -n $(whoami)) ~/syscoin.conf | |
source ~/syscoin.conf | |
rm -f ~/syscoin.conf | |
fi | |
RPC_USER="$rpcuser" | |
RPC_PASSWORD="$rpcpassword" | |
MASTERNODE_PORT="$port" | |
# ask which branch to use | |
syscoin_branch | |
if [ "$externalip" != "$RESOLVED_ADDRESS" ]; then | |
echo "" | |
echo "WARNING: The syscoin.conf value for externalip=${externalip} does not match your detected external ip of ${RESOLVED_ADDRESS}." | |
echo "" | |
fi | |
read -e -p "External IP Address [$externalip]: " EXTERNAL_ADDRESS | |
if [ "$EXTERNAL_ADDRESS" = "" ]; then | |
EXTERNAL_ADDRESS="$externalip" | |
fi | |
if [ "$port" != "" ] && [ "$port" != "$DEFAULT_PORT" ]; then | |
echo "" | |
echo "WARNING: The syscoin.conf value for port=${port} does not match the default of ${DEFAULT_PORT}." | |
echo "" | |
fi | |
read -e -p "Masternode Port [$port]: " MASTERNODE_PORT | |
if [ "$MASTERNODE_PORT" = "" ]; then | |
MASTERNODE_PORT="$port" | |
fi | |
masternode_private_key(){ | |
read -e -p "Masternode Private Key [$masternodeprivkey]: " MASTERNODE_PRIVATE_KEY | |
if [ "$MASTERNODE_PRIVATE_KEY" = "" ]; then | |
if [ "$masternodeprivkey" != "" ]; then | |
MASTERNODE_PRIVATE_KEY="$masternodeprivkey" | |
else | |
echo "You must enter a masternode private key!"; | |
masternode_private_key | |
fi | |
fi | |
} | |
masternode_private_key | |
# read -e -p "Configure for mainnet? [Y/n]: " IS_MAINNET | |
maybe_prompt_for_swap_file | |
#Generating Random Passwords | |
RPC_PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
pause | |
clear | |
# syscoin conf file | |
SYSCOIN_CONF=$(cat <<EOF | |
# rpc config | |
rpcuser=user | |
rpcpassword=$RPC_PASSWORD | |
rpcallowip=127.0.0.1 | |
rpcbind=127.0.0.1 | |
# syscoind config | |
listen=1 | |
server=1 | |
daemon=1 | |
maxconnections=24 | |
addressindex=1 | |
debug=0 | |
# masternode config | |
masternode=1 | |
masternodeprivkey=$MASTERNODE_PRIVATE_KEY | |
externalip=$EXTERNAL_ADDRESS | |
port=$MASTERNODE_PORT | |
EOF | |
) | |
# testnet config | |
SYSCOIN_TESTNET_CONF=$(cat <<EOF | |
# testnet config | |
testnet=1 | |
addnode=40.121.201.195 | |
addnode=40.71.212.2 | |
addnode=40.76.48.206 | |
EOF | |
) | |
# syscoind.service config | |
SYSCOIND_SERVICE=$(cat <<EOF | |
[Unit] | |
Description=Syscoin Core Service | |
After=network.target iptables.service firewalld.service | |
[Service] | |
Type=forking | |
User=syscoin | |
ExecStart=/usr/local/bin/syscoind | |
ExecStop=/usr/local/bin/syscoin-cli stop && sleep 20 && /usr/bin/killall syscoind | |
ExecReload=/usr/local/bin/syscoin-cli stop && sleep 20 && /usr/local/bin/syscoind | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
) | |
# functions to install a masternode from scratch | |
create_and_configure_syscoin_user(){ | |
echo "$MESSAGE_CREATE_USER" | |
# create a syscoin user if it doesn't exist | |
grep -q '^syscoin:' /etc/passwd || sudo adduser --disabled-password --gecos "" syscoin | |
# add alias to .bashrc to run syscoin-cli as sycoin user | |
grep -q "syscli\(\)" ~/.bashrc || echo "syscli() { sudo su -c \"syscoin-cli \$*\" syscoin; }" >> ~/.bashrc | |
grep -q "alias syscoin-cli" ~/.bashrc || echo "alias syscoin-cli='syscli'" >> ~/.bashrc | |
grep -q "sysd\(\)" ~/.bashrc || echo "sysd() { sudo su -c \"syscoind \$*\" syscoin; }" >> ~/.bashrc | |
grep -q "alias syscoind" ~/.bashrc || echo "alias syscoind='sysd'" >> ~/.bashrc | |
grep -q "sysmasternode\(\)" ~/.bashrc || echo "sysmasternode() { bash <(curl -sL doublesharp.com/sysmasternode); }" >> ~/.bashrc | |
echo "$SYSCOIN_CONF" > ~/syscoin.conf | |
if [ ! "$IS_MAINNET" = "" ] && [ ! "$IS_MAINNET" = "y" ] && [ ! "$IS_MAINNET" = "Y" ]; then | |
echo "$SYSCOIN_TESTNET_CONF" >> ~/syscoin.conf | |
fi | |
# in case it's already running because this is a re-install | |
sudo service syscoind stop | |
# create conf directory | |
sudo mkdir -p /home/syscoin/.syscoincore | |
sudo rm -rf /home/syscoin/.syscoincore/debug.log | |
sudo mv -f ~/syscoin.conf /home/syscoin/.syscoincore/syscoin.conf | |
sudo chown -R syscoin.syscoin /home/syscoin/.syscoincore | |
sudo chmod 600 /home/syscoin/.syscoincore/syscoin.conf | |
clear | |
} | |
create_systemd_syscoind_service(){ | |
echo "$MESSAGE_SYSTEMD" | |
# create systemd service | |
echo "$SYSCOIND_SERVICE" > ~/syscoind.service | |
# install the service | |
sudo mkdir -p /usr/lib/systemd/system/ | |
sudo mv -f ~/syscoind.service /usr/lib/systemd/system/syscoind.service | |
# reload systemd daemon | |
sudo systemctl daemon-reload | |
clear | |
} | |
install_fail2ban(){ | |
echo "$MESSAGE_FAIL2BAN" | |
sudo apt-get install fail2ban -y | |
sudo service fail2ban restart | |
sudo systemctl fail2ban enable | |
clear | |
} | |
install_ufw(){ | |
echo "$MESSAGE_UFW" | |
sudo apt-get install ufw -y | |
sudo ufw default deny incoming | |
sudo ufw default allow outgoing | |
sudo ufw allow ssh | |
sudo ufw allow 8369/tcp | |
yes | sudo ufw enable | |
clear | |
} | |
get_masternode_status(){ | |
echo "" | |
sudo su -c "syscoin-cli mnsync status" syscoin && \ | |
sudo su -c "syscoin-cli masternode status" syscoin | |
echo "" | |
read -e -p "Check again? [Y/n]: " CHECK_AGAIN | |
if [ "$CHECK_AGAIN" = "" ] || [ "$CHECK_AGAIN" = "y" ] || [ "$CHECK_AGAIN" = "Y" ]; then | |
get_masternode_status | |
fi | |
} | |
# if there is <4gb and the user said yes to a swapfile... | |
maybe_create_swap_file | |
# prepare to build | |
update_system | |
install_dependencies | |
git_clone_repository | |
git_checkout_branch | |
clear | |
# run the build steps | |
autogen | |
configure | |
compile | |
make_install | |
clear | |
create_and_configure_syscoin_user | |
create_systemd_syscoind_service | |
start_syscoind | |
install_sentinel | |
install_virtualenv | |
configure_sentinel | |
install_fail2ban | |
install_ufw | |
clear | |
echo "$MESSAGE_COMPLETE" | |
echo "" | |
echo "Your masternode configuration should now be completed and running as the syscoin user." | |
echo "If you see MASTERNODE_SYNC_FINISHED return to Syscoin-Qt and start your node, otherwise check again." | |
get_masternode_status | |
# ping sentinel | |
sudo su -c "sentinel-ping" syscoin | |
echo "" | |
echo "Masternode setup complete!" | |
echo "" | |
echo "Please run the following command to access syscoin-cli from this session or re-login." | |
echo "" | |
echo " source ~/.bashrc" | |
echo "" | |
echo "You can run syscoin-cli commands as the syscoin user: " | |
echo "" | |
echo " syscoin-cli getinfo" | |
echo " syscoin-cli masternode status" | |
echo "" | |
echo "To update this masternode just type:" | |
echo "" | |
echo " sysmasternode" | |
do_exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
read -r -d '' MESSAGE_WELCOME <<'EOF' | |
--------------------------------------------------------------------------------------- | |
_________ .__ ________ _______ | |
/ _____/__.__. ______ ____ ____ |__| ____ \_____ \ \ _ \ | |
\_____ < | |/ ___// ___\/ _ \| |/ \ _(__ < / /_\ \ | |
/ \___ |\___ \\ \__( <_> ) | | \ / \ \ \_/ \ | |
/_______ / ____/____ >\___ >____/|__|___| / /______ / /\ \_____ / | |
\/\/ \/ \/ \/ \/ \/ \/ | |
_____ __ .___ | |
/ \ _____ _______/ |_ ___________ ____ ____ __| _/____ | |
/ \ / \\__ \ / ___/\ __\/ __ \_ __ \/ \ / _ \ / __ |/ __ \ | |
/ Y \/ __ \_\___ \ | | \ ___/| | \/ | ( <_> ) /_/ \ ___/ | |
\____|__ (____ /____ > |__| \___ >__| |___| /\____/\____ |\___ > | |
\/ \/ \/ \/ \/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_PLAYER_ONE <<'EOF' | |
--------------------------------------------------------------------------------------- | |
__ _ ___ _ ___ | |
/__\ ___ __ _ __| |_ _ / _ | | __ _ _ _ ___ _ __ /___\_ __ ___ | |
/ \/// _ \/ _` |/ _` | | | | / /_)| |/ _` | | | |/ _ | '__| // /| '_ \ / _ \ | |
/ _ | __| (_| | (_| | |_| | / ___/| | (_| | |_| | __| | / \_//| | | | __/ | |
\/ \_/\___|\__,_|\__,_|\__, | \/ |_|\__,_|\__, |\___|_| \___/ |_| |_|\___| | |
|___/ |___/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_UPGRADE <<'EOF' | |
--------------------------------------------------------------------------------------- | |
____ ___ .___ | |
| | \______ ________________ __| _/____ | |
| | /\____ \ / ___\_ __ \__ \ / __ |/ __ \ | |
| | / | |_> > /_/ > | \// __ \_/ /_/ \ ___/ | |
|______/ | __/\___ /|__| (____ /\____ |\___ > | |
|__| /_____/ \/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_CONFIGURE <<'EOF' | |
--------------------------------------------------------------------------------------- | |
_________ _____.__ | |
\_ ___ \ ____ _____/ ____\__| ____ __ _________ ____ | |
/ \ \/ / _ \ / \ __\| |/ ___\| | \_ __ \_/ __ \ | |
\ \___( <_> ) | \ | | / /_/ > | /| | \/\ ___/ | |
\______ /\____/|___| /__| |__\___ /|____/ |__| \___ > | |
\/ \/ /_____/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_UPDATE <<'EOF' | |
--------------------------------------------------------------------------------------- | |
__ .___ __ | |
_________.__. _______/ |_ ____ _____ __ ________ __| _/____ _/ |_ ____ | |
/ ___< | |/ ___/\ __\/ __ \ / \ | | \____ \ / __ |\__ \\ __\/ __ \ | |
\___ \ \___ |\___ \ | | \ ___/| Y Y \ | | / |_> > /_/ | / __ \| | \ ___/ | |
/____ >/ ____/____ > |__| \___ >__|_| / |____/| __/\____ |(____ /__| \___ > | |
\/ \/ \/ \/ \/ |__| \/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_DEPENDENCIES <<'EOF' | |
--------------------------------------------------------------------------------------- | |
.___ .___ .__ | |
__| _/____ ______ ____ ____ __| _/____ ____ ____ |__| ____ ______ | |
/ __ |/ __ \\____ \_/ __ \ / \ / __ |/ __ \ / \_/ ___\| |/ __ \ / ___/ | |
/ /_/ \ ___/| |_> > ___/| | \/ /_/ \ ___/| | \ \___| \ ___/ \___ \ | |
\____ |\___ > __/ \___ >___| /\____ |\___ >___| /\___ >__|\___ >____ > | |
\/ \/|__| \/ \/ \/ \/ \/ \/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_CLONING <<'EOF' | |
--------------------------------------------------------------------------------------- | |
.__ .__ | |
____ | | ____ ____ |__| ____ ____ _______ ____ ______ ____ | |
_/ ___\| | / _ \ / \| |/ \ / ___\ \_ __ \_/ __ \\____ \ / _ \ | |
\ \___| |_( <_> ) | \ | | \/ /_/ > | | \/\ ___/| |_> > <_> ) | |
\___ >____/\____/|___| /__|___| /\___ / |__| \___ > __/ \____/ | |
\/ \/ \//_____/ \/|__| | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_ERROR <<'EOF' | |
--------------------------------------------------------------------------------------- | |
__________________ ___________ | |
_/ __ \_ __ \_ __ \/ _ \_ __ \ | |
\ ___/| | \/| | \( <_> ) | \/ | |
\___ >__| |__| \____/|__| | |
\/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_AUTOGEN <<'EOF' | |
--------------------------------------------------------------------------------------- | |
/\ __ .__ | |
/ / _____ __ ___/ |_ ____ ____ ____ ____ _____| |__ | |
/ / \__ \ | | \ __\/ _ \ / ___\_/ __ \ / \ / ___/ | \ | |
/ / / __ \| | /| | ( <_> ) /_/ > ___/| | \ \___ \| Y \ | |
/\ / / (____ /____/ |__| \____/\___ / \___ >___| / /\ /____ >___| / | |
\/ \/ \/ /_____/ \/ \/ \/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_MAKE_CONFIGURE <<'EOF' | |
--------------------------------------------------------------------------------------- | |
/\ _____.__ | |
/ / ____ ____ _____/ ____\__| ____ __ _________ ____ | |
/ / _/ ___\/ _ \ / \ __\| |/ ___\| | \_ __ \_/ __ \ | |
/ / \ \__( <_> ) | \ | | / /_/ > | /| | \/\ ___/ | |
/\ / / \___ >____/|___| /__| |__\___ /|____/ |__| \___ > | |
\/ \/ \/ \/ /_____/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_MAKE <<'EOF' | |
--------------------------------------------------------------------------------------- | |
__ | |
_____ _____ | | __ ____ | |
/ \\__ \ | |/ // __ \ | |
| Y Y \/ __ \| <\ ___/ | |
|__|_| (____ /__|_ \\___ > | |
\/ \/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_MAKE_INSTALL <<'EOF' | |
--------------------------------------------------------------------------------------- | |
__ .__ __ .__ .__ | |
_____ _____ | | __ ____ |__| ____ _______/ |______ | | | | | |
/ \\__ \ | |/ // __ \ | |/ \ / ___/\ __\__ \ | | | | | |
| Y Y \/ __ \| <\ ___/ | | | \\___ \ | | / __ \| |_| |__ | |
|__|_| (____ /__|_ \\___ > |__|___| /____ > |__| (____ /____/____/ | |
\/ \/ \/ \/ \/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_SYSCOIND <<'EOF' | |
--------------------------------------------------------------------------------------- | |
.__ .___ | |
_________.__. ______ ____ ____ |__| ____ __| _/ | |
/ ___< | |/ ___// ___\/ _ \| |/ \ / __ | | |
\___ \ \___ |\___ \\ \__( <_> ) | | \/ /_/ | | |
/____ >/ ____/____ >\___ >____/|__|___| /\____ | | |
\/ \/ \/ \/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_STOPPING <<'EOF' | |
--------------------------------------------------------------------------------------- | |
__ .__ | |
_______/ |_ ____ ______ ______ |__| ____ ____ | |
/ ___/\ __\/ _ \\____ \\____ \| |/ \ / ___\ | |
\___ \ | | ( <_> ) |_> > |_> > | | \/ /_/ > | |
/____ > |__| \____/| __/| __/|__|___| /\___ / /\ /\ /\ | |
\/ |__| |__| \//_____/ \/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_CREATE_USER <<'EOF' | |
--------------------------------------------------------------------------------------- | |
__ | |
___________ ____ _____ _/ |_ ____ __ __ ______ ___________ | |
_/ ___\_ __ \_/ __ \\__ \\ __\/ __ \ | | \/ ___// __ \_ __ \ | |
\ \___| | \/\ ___/ / __ \| | \ ___/ | | /\___ \\ ___/| | \/ | |
\___ >__| \___ >____ /__| \___ > |____//____ >\___ >__| | |
\/ \/ \/ \/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_SYSTEMD <<'EOF' | |
--------------------------------------------------------------------------------------- | |
__ .___ | |
_________.__. _______/ |_ ____ _____ __| _/ | |
/ ___< | |/ ___/\ __\/ __ \ / \ / __ | | |
\___ \ \___ |\___ \ | | \ ___/| Y Y \/ /_/ | | |
/____ >/ ____/____ > |__| \___ >__|_| /\____ | | |
\/ \/ \/ \/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_SENTINEL <<'EOF' | |
--------------------------------------------------------------------------------------- | |
__ .__ .__ | |
______ ____ _____/ |_|__| ____ ____ | | | |
/ ___// __ \ / \ __\ |/ \_/ __ \| | | |
\___ \\ ___/| | \ | | | | \ ___/| |__ | |
/____ >\___ >___| /__| |__|___| /\___ >____/ | |
\/ \/ \/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_VIRTUALENV <<'EOF' | |
--------------------------------------------------------------------------------------- | |
.__ __ .__ | |
___ _|__|_______/ |_ __ _______ | | ____ _______ __ | |
\ \/ / \_ __ \ __\ | \__ \ | | _/ __ \ / \ \/ / | |
\ /| || | \/| | | | // __ \| |_\ ___/| | \ / | |
\_/ |__||__| |__| |____/(____ /____/\___ >___| /\_/ | |
\/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_CRONTAB <<'EOF' | |
--------------------------------------------------------------------------------------- | |
__ ___. | |
___________ ____ _____/ |______ \_ |__ | |
_/ ___\_ __ \/ _ \ / \ __\__ \ | __ \ | |
\ \___| | \( <_> ) | \ | / __ \| \_\ \ | |
\___ >__| \____/|___| /__| (____ /___ / | |
\/ \/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_FAIL2BAN <<'EOF' | |
--------------------------------------------------------------------------------------- | |
_____ .__.__ ___________. | |
_/ ____\____ |__| | \_____ \_ |__ _____ ____ | |
\ __\\__ \ | | | / ____/| __ \\__ \ / \ | |
| | / __ \| | |__/ \| \_\ \/ __ \| | \ | |
|__| (____ /__|____/\_______ \___ (____ /___| / | |
\/ \/ \/ \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_UFW <<'EOF' | |
--------------------------------------------------------------------------------------- | |
____ ________________ __ | |
| | \_ _____/ \ / \ | |
| | /| __) \ \/\/ / | |
| | / | \ \ / | |
|______/ \___ / \__/\ / | |
\/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF | |
read -r -d '' MESSAGE_COMPLETE <<'EOF' | |
--------------------------------------------------------------------------------------- | |
_________ .__ __ | |
\_ ___ \ ____ _____ ______ | | _____/ |_ ____ | |
/ \ \/ / _ \ / \\____ \| | _/ __ \ __\/ __ \ | |
\ \___( <_> ) Y Y \ |_> > |_\ ___/| | \ ___/ | |
\______ /\____/|__|_| / __/|____/\___ >__| \___ > | |
\/ \/|__| \/ \/ | |
--------------------------------------------------------------------------------------- | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# server | |
server=1 | |
daemon=1 | |
# indexes | |
addressindex=1 | |
txindex=1 | |
litemode=0 | |
# rpc | |
rpcuser=u | |
rpcpassword=p | |
rpcport=8370 | |
rpcallowip=127.0.0.1 | |
# zmq listener config | |
zmqpubaliasrecord=tcp://127.0.0.1:3030 | |
zmqpubaliashistory=tcp://127.0.0.1:3030 | |
zmqpubaliastxhistory=tcp://127.0.0.1:3030 | |
zmqpubassetrecord=tcp://127.0.0.1:3030 | |
zmqpubassetallocation=tcp://127.0.0.1:3030 | |
zmqpubassethistory=tcp://127.0.0.1:3030 | |
zmqpubcertrecord=tcp://127.0.0.1:3030 | |
zmqpubcerthistory=tcp://127.0.0.1:3030 | |
zmqpubescrowrecord=tcp://127.0.0.1:3030 | |
zmqpubescrowbid=tcp://127.0.0.1:3030 | |
zmqpubescrowfeedback=tcp://127.0.0.1:3030 | |
zmqpubofferrecord=tcp://127.0.0.1:3030 | |
zmqpubofferhistory=tcp://127.0.0.1:3030 | |
zmqpubhashblock=tcp://127.0.0.1:3030 | |
zmqpubhashtx=tcp://127.0.0.1:3030 | |
zmqpubhashtxlock=tcp://127.0.0.1:3030 | |
zmqpubrawblock=tcp://127.0.0.1:3030 | |
zmqpubrawtx=tcp://127.0.0.1:3030 | |
zmqpubrawtxlock=tcp://127.0.0.1:3030 |
Around the line
sudo chmod +x /usr/local/bin/sentinel-ping
Maybe add chown root:root
and chmod 755
to sentinel-ping. In my case since I've set umask to 026, without these lines it causes sentinel-ping to be unreadable by user syscoin
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
RESOLVED_ADDRESS=$(curl -s ipinfo.io/ip)
like today it failed again (server error)
I prefer to use something like
hostname -I | cut -d ' ' -f 1
or for IP6
hostname -I | cut -d ' ' -f 2