Skip to content

Instantly share code, notes, and snippets.

@jordanmack
Last active September 20, 2017 10:00
Show Gist options
  • Save jordanmack/3c286d90b8bdfeeaa5e6e38b0a22de25 to your computer and use it in GitHub Desktop.
Save jordanmack/3c286d90b8bdfeeaa5e6e38b0a22de25 to your computer and use it in GitHub Desktop.
Configure Server and Install ZenCash
#!/usr/bin/env bash
# Quit on any error.
set -e
# Require superuser.
if [[ $EUID > 0 ]]; then
echo "This script requires root or sudo."
exit 1
fi
# Add a swapfile.
if [ $(cat /proc/swaps | wc -l) -lt 2 ]; then
echo "Configuring your swapfile..."
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap sw 0 0" >> /etc/fstab
else
echo "Swapfile exists. Skipping."
fi
# Install updates.
echo "Install Ubuntu updates..."
apt-get update && apt-get upgrade -y
# Install dependencies.
echo "Installing ZenCash dependencies..."
apt-get install -y build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake && apt-get autoremove -y
# Remove old builds.
if [ -d ~/zen ]; then
echo "Removing old ZenCash build..."
killall zend || true
rm -r ~/zen || true
fi
# Clone ZenCash from Git repo.
echo "Downloading ZenCash source..."
git clone https://github.com/ZencashOfficial/zen.git
# Download proving keys.
if [ ! -f ~/.zcash-params/sprout-proving.key ]; then
echo "Downloading ZenCash keys..."
~/zen/zcutil/fetch-params.sh
fi
# Create an empty config.
if [ ! -f ~/.zen/zen.conf ]; then
echo "Creating an empty ZenCash config..."
mkdir -p ~/.zen || true
touch ~/.zen/zen.conf
fi
# Compile source.
echo "Compiling ZenCash..."
cd ~/zen
./zcutil/build.sh
cd ~
# Done.
echo ""
echo ""
echo "ALL DONE! Now type \"~/zen/src/zend\" to launch ZenCash!"
echo ""
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment