It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
###############################################################################
# Prerequisites
###############################################################################
#
# Before you run this, do the following:
# * Log in as root
# * Be in your home directory
# * The parent of home directories has to be specified below (e.g., if user home directories are like /home/user1, then HOME_ROOT must be set to /home).
#
# * (Optional but recommended) Create a file with the name specified below in REGULAR_USER_PUBLIC_KEY_FILE that contains your SSH public key. This should be in the copy/paste format you get from PuttyGen, not the saved public key file.
# Assumptions:
# * Running on a relatively recent version of Ubuntu (12.04 or later) -- not tested with anything else, but it might work anyway!
# * Python is already installed. If not, the script attempts to install Python, but right now I can't guarantee if you'll get Python 2.7 or 3.x. P2Pool doesn't work with 3.x.
# * This script was designed for use on a VM or VPS that's basically empty, and only has the root user created.
###############################################################################
# This section has to be run as root
###############################################################################
PrintStatus()
{
echo
echo "----- STATUS: $*"
echo
}
#############
# Script settings - EdIT THESE before running.
#############
HOME_ROOT=/home
# These are general script settings. Edit these before running the script.
REGULAR_USER_NAME=heybrother # Randomly inspired by the song on the radio as I wrote this!
REGULAR_USER_PUBLIC_KEY_FILE=$REGULAR_USER_NAME.pub
# @TODO: Prompt the user for these two values.
#############
# System updates and patches
#############
# @TODO: Maybe create a swap file? For now, the script assumes the host system either has enough memory or has swap already set up.
# For a sample command, see:
# https://raw.github.com/XertroV/BitcoinAutoNode/master/bitcoinAutoNode.sh
PrintStatus "Updating the system"
# Update your packages and package list
apt-get update
apt-get -y dist-upgrade # This does the functions of upgrade as well.
PrintStatus "Installing system tools"
# @TODO: To get the add-apt-repository command, we may need to install one of the following, as per:
# https://stackoverflow.com/questions/13018626/add-apt-repository-not-found
# for Ubuntu <= 12.04
# sudo apt-get install python-software-properties
# for Ubuntu >= 12.10
# sudo apt-get install software-properties-common
#
# At some point I'll have to figure out how to distinguish versions and load only the needed one, but for now, just load both.
apt-get -y install python-software-properties software-properties-common
# Add the bitcoin repository - used for some bitcoind dependencies
# So it seems this is an official bitcoin-core repository, or at least, official enough that the devs endorse downloads from it in their readme file.
#So, I'll trust the binary download from here, rather than try to muddle through the insane mess required to build bitcoind cleanly from source on multiple arbitrary target systems.
PrintStatus "Adding bitcoin repository"
add-apt-repository -y ppa:bitcoin/bitcoin
apt-get update
# Install some useful utilities and the pre-reqs for P2Pool and bitcoin
PrintStatus "Installing utilities"
apt-get -y install nano htop ufw monit git p7zip-full screen
#############
# Python & P2Pool dependencies
#############
# Make sure Python is installed
PYTHON="$(which python)"
if [ -z "$PYTHON" ] ; then
PrintStatus "Installing Python."
apt-get -y install python
# @TODO: review this; make sure we don't install Python3 by mistake.
PYTHON="$(which python)"
fi
if [ -z "$PYTHON" ] ; then
PrintStatus "WARNING! Failed to install Python. P2Pool may not run."
# @TODO: Any special handling here for the error?
else
PYTHON_VERSION="$("$PYTHON" -V 2>&1)"
PYTHON_26=$(awk 'BEGIN { if ("'"$PYTHON_VERSION"'" ~ /Python 2.6.*/) print "YES";}')
#PYTHON_27=$(awk 'BEGIN { if ("'"$PYTHON_VERSION"'" ~ /Python 2.7.*/) print "YES";}') # Just for testing
PYTHON_3x=$(awk 'BEGIN { if ("'"$PYTHON_VERSION"'" ~ /Python 3.*/) print "YES";}')
if [ -n "$PYTHON_26" ] ; then
PrintStatus "Python 2.6.* requires an additional dependency, installing."
apt-get -y install python-argparse
elif [ -n "$PYTHON_3x" ] ; then
PrintStatus "WARNING! Python 3.x detected. This may not work with P2Pool."
# @TODO: Any special handling here for the error?
elif [ -n "$PYTHON_27" ] ; then
PrintStatus "Python 2.7 detected, all ok!"
fi
fi
# Install the pre-reqs for P2Pool
PrintStatus "Installing P2Pool dependencies"
apt-get -y install python-zope.interface python-twisted python-twisted-web
#############
# bitcoind
#############
# For the UI, not strictly needed, but nice to have
PrintStatus "Installing Bitcoin dependencies"
apt-get -y install libqtgui4
# Side note - this installs a metric crapton of dependencies...
# Download and install bitcoind
PrintStatus "Installing bitcoind"
apt-get -y install bitcoind
#############
# User creation
#############
# @TODO: Check if user already exists and skip this step if needed
# Create your regular user
PrintStatus "Creating your regular user $REGULAR_USER_NAME"
useradd $REGULAR_USER_NAME
# Grant your user sudo permission
usermod -a -G sudo $REGULAR_USER_NAME
# Make the user's SSH directory and add the private key
if [ -s "$REGULAR_USER_PUBLIC_KEY_FILE" ] ; then
PrintStatus "Setting up SSH keys for your user"
# First ensure the .ssh directory exists.
if [ ! -d $HOME_ROOT/$REGULAR_USER_NAME/.ssh ] ; then
mkdir -p $HOME_ROOT/$REGULAR_USER_NAME/.ssh
chown $REGULAR_USER_NAME $HOME_ROOT/$REGULAR_USER_NAME
chown $REGULAR_USER_NAME $HOME_ROOT/$REGULAR_USER_NAME/.ssh
chmod 700 $HOME_ROOT/$REGULAR_USER_NAME/.ssh
fi
# Add the key and assign ownership of the file.
cat ~/$REGULAR_USER_PUBLIC_KEY_FILE >> $HOME_ROOT/$REGULAR_USER_NAME/.ssh/authorized_keys
chown $REGULAR_USER_NAME $HOME_ROOT/$REGULAR_USER_NAME/.ssh/authorized_keys
chmod 600 $HOME_ROOT/$REGULAR_USER_NAME/.ssh/authorized_keys
rm ~/$REGULAR_USER_PUBLIC_KEY_FILE # don't need it any more.
else
PrintStatus "SSH key NOT found for user $REGULAR_USER_NAME. Please enter a login password."
passwd $REGULAR_USER_NAME
fi
# PrintStatus "Locking out root password."
# @TODO
#############
# Firewall setup
#############
# Next, let's set up a firewall
PrintStatus "Setting up the firewall"
ufw default deny # Deny everything unless expressly permitted
ufw allow 22/tcp # SSH
ufw allow 8333/tcp # Bitcoind peer to peer
# Note that we do NOT enable the Bitcoind RPC port!
ufw allow 9333/tcp # P2pool peer to peer
ufw allow 9332/tcp # P2Pool connections and Web interface
ufw --force enable # Turn it on
#############
# Monit setup
#############
# set up monit, a monitoring tool.
PrintStatus "Configuring Monit"
# @TODO
# @TODO: Also check out Zabbix as per:
# https://bitcointalk.org/index.php?topic=153232.0
# http://www.zabbix.com/
#############
# Ideas for future growth:
#############
# Log rotation: http://manpages.ubuntu.com/manpages/jaunty/man8/logrotate.8.html
# Also https://bitcoin.stackexchange.com/questions/18857/how-to-limit-the-debug-log-file-while-running-bitcoind
###############################################################################
# This section has to be run as your regular user
###############################################################################
# @TODO: Maybe run this directly as the user?
# http://www.cyberciti.biz/open-source/command-line-hacks/linux-run-command-as-different-user/
PrintStatus()
{
echo
echo "----- STATUS: $*"
echo
}
#############
# Bitcoind setup
#############
# Create the bitcoind configuration file
PrintStatus "Creating the bitcoind configuration file"
mkdir -p $HOME/.bitcoin
config="$HOME/.bitcoin/bitcoin.conf"
randUser=`< /dev/urandom tr -dc A-Za-z0-9 | head -c40`
randPass=`< /dev/urandom tr -dc A-Za-z0-9 | head -c40`
cat <$config
server=1
daemon=1
rpcuser=$randUser
rpcpassword=$randPass
connections=40
blockmaxsize=1000000
mintxfee=0.00001
minrelaytxfee=0.00001
EOF
# Download the bitcoin bootstrap file. This saves a massive amount of time when starting bitcoind the first time - literally days.
# The right way to do this is via bittorrent - the seed file is at:
# Torrent info hash: 2d4e6c1f96c5d5fb260dff92aea4e600227f1aea
# Torrent magnet link:
# magnet:?xt=urn:btih:2d4e6c1f96c5d5fb260dff92aea4e600227f1aea&dn=bootstrap.dat&tr=udp://tracker.openbittorrent.com:80&tr=udp://tracker.publicbt.com:80&tr=udp://tracker.ccc.de:80&tr=udp://tracker.istole.it:80
# Details: https://bitcointalk.org/index.php?topic=145386.0 (Check here for more recent versions every few months.)
# However, most VPS providers don't allow torrents. So alternately, we'll download using http. Not nearly as efficient, but still faster than syncing with the network.
PrintStatus "Downloading Bitcoin bootstrap.dat file. This could take a while..."
cd $HOME/.bitcoin
#wget https://bitfetch.com/static/bootstrap.7z
# Note: as of this writing, the SSL certificate for bitfetch.com has expired.
# If you just try to wget the file, wget will fail, complaining about it.
# So, we have to force wget to ignore the expired certificate. Once the
# certificate on the site has been properly renewed, delete the line below
# and uncomment the line above.
wget --no-check-certificate https://bitfetch.com/static/bootstrap.7z
PrintStatus "Uncompressing Bitcoin bootstrap.dat file."
7z x bootstrap.7z
# Start bitcoind so that it can begin processing the bootstrap and syncing with the network
# actually don't do this; instead force a reboot at the end of the script.
# PrintStatus "Starting bitcoind"
# bitcoind -daemon
#############
# P2Pool setup
#############
# Download and install p2pool
cd
git clone https://github.com/forrestv/p2pool.git
# no actual install needed
# Start P2pool in the background.
# Note that if you enable this in this script, P2Pool will spit out a few hundred errors until bitcoind is caught up.
# So, disabling this here.
# nohup python $HOME/p2pool/run_p2pool.py &
#############
# cron setup
#############
# Add the entries for the cron jobs
PrintStatus "Setting up cron jobs"
crontab -l > $HOME/Old_cron.txt
echo "@reboot bitcoind -daemon" >> $HOME/Old_cron.txt
echo "@reboot python $HOME/p2pool/run_p2pool.py" >> $HOME/Old_cron.txt
crontab $HOME/Old_cron.txt
rm $HOME/Old_cron.txt
# @TODO: Auto update and restart P2Pool (may or may not be desirable)
# http://pastebin.com/HtD0uku4