Skip to content

Daemon Client Deployment on Ubuntu 20.04

StealthSend edited this page May 17, 2022 · 3 revisions

Purpose

These instructions show how to build and deploy the XST client on Ubuntu 20.04. These instructions may work for other versions of Ubuntu, with or without slight modifications.

Preliminary Advice

  • The recommended way to synchronize the client is through bootstrap. It is possible to sync much more quickly using a snapshot. Snapshot instructions are elsewhere.
  • All commands assume the bash shell, which is the default for Ubuntu. Commands are meant to be copy-pastable.
  • For security and stability, we recommend using LTS releases of Ubuntu, of which Ubuntu 20.04 is one. See https://wiki.ubuntu.com/Releases.

Build the Daemon

First, begin with a fresh Ubuntu 20.04 install. A good service provider with a great price is OVH. The minimum memory requirement as of March 2020 is 3 GB, but 4 GB is recommended.

Update Apt

sudo locale-gen "en_US.UTF-8"

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo reboot

You will get logged out here, just log back in after a couple of minutes

Install Bulk of Dependencies

This step installs all dependencies except for bdb, boost, and libevent.

sudo apt-get install wget git cmake autoconf build-essential \
                     openssl libssl-dev doxygen libncurses5-dev \
                     libreadline-dev zlib1g-dev \
                     tcsh libbz2-dev python-dev libtool \
                     libssl-dev libprotobuf-dev \
                     protobuf-compiler pkg-config p7zip-full \
                     libcurl4-openssl-dev unzip curl python-dev \
                     libxml2-dev libxslt1-dev libkrb5-dev

Install BDB and LibEvent

cd
mkdir -p ~/Deps/bdb
cd ~/Deps/bdb
wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
echo '12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz' | sha256sum -c
tar xvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix/
# fix atomic.h for newer compilers
sed -i 's/__atomic_compare_exchange/__atomic_compare_exchange_db/g' ../dbinc/atomic.h
../dist/configure --disable-shared --enable-cxx --with-pic --prefix=/usr/local
make -j2
sudo make install

# libevent
sudo apt-get install libevent-dev

Set Key Environment Variables

The two steps following the present step install the boost libraries and also build the Stealth client. This step and the next two should all be executed within the same shell session, meaning it is critical to set the following environment variables first. Note that these instructions build the qpos-3.0 branch, which is suitable for both mainnet and testnet, but is not stable. The stable branch is master, suitable only for mainnet at this time.

DEPS=${HOME}/Deps
XSTDIR=${DEPS}/stealth
XST_BRANCH=qpos-3.0

Build Boost

Unfortunately the boost dependency has periodic updates that break backwards compatibility. For this reason, it is necessary to build a specific version of boost to build the Stealth client, forgoing the boost libraries supplied by the Apt package manager.

# there is no need to modify the following environment variables
BOOSTR=1
BOOSTS=72
BOOSTM=0
BOOSTP=${BOOSTR}_${BOOSTS}_${BOOSTM}
BOOSTV=${BOOSTR}.${BOOSTS}.${BOOSTM}
BUILDDIR=build-xst
BOOST_ROOT=${DEPS}/boost/boost-xst

mkdir -p ${DEPS}/boost
cd ${DEPS}/boost
wget https://sourceforge.net/projects/boost/files/boost/${BOOSTV}/boost_${BOOSTP}.tar.bz2
tar xvf boost_${BOOSTP}.tar.bz2
mkdir -p ${BOOST_ROOT}
cd boost_${BOOSTP}
./bootstrap.sh
./b2 --prefix=$BOOST_ROOT --build-dir=${BUILDDIR} link=static install

Build The Stealth Client

The following commands also install the Stealth client into /usr/local/bin, the recommended location for system-wide accessibility to the executable.

mkdir -p ${XSTDIR}
cd ${XSTDIR}
git clone https://github.com/StealthSend/Stealth.git
cd Stealth/src
git checkout ${XST_BRANCH}
export BOOST_LIB_PATH=$BOOST_ROOT/lib
export BOOST_INCLUDE_PATH=$BOOST_ROOT/include
export BOOST_LIB_SUFFIX=
make -f makefile.unix
sudo cp StealthCoind /usr/local/bin/StealthCoind

The daemon is now in /usr/local/bin. To ensure it is in your path, log out and back in again or start a new shell, etc.

Initialize the .StealthCoin Directory

The command is

StealthCoind

This starts the client and prints some instructions in the shell. Follow the instructions to create the ~/.StealthCoin/StealthCoin.conf file then add to this file the following lines:

daemon=1
server=1
rescan=1

These commands allow you to run a server node on the network, to which other clients can connect. The last command rescan=1 will cause your wallet to be rescanned for transactions. For long-term members of the community who have been staking for years, it will take a long time to rescan the wallet. New users will not notice a rescan.

Download and Decompress the Bootstrap

cd
BOOTSTRAP_ID=0B8rWObF4xz1YRzd1VVNXM0JrWEE
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id='${BOOTSTRAP_ID} -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=${BOOTSTRAP_ID}" -O xst-bootstrap.7z && rm -rf /tmp/cookies.txt
cd ~/.StealthCoin
7z x ~/xst-bootstrap.7z

Run the Bootstrap

Start the client with the command

StealthCoind

Allow it to bootstrap. With a 4 GB VPS, bootstrap should take 3 - 4 hours. Compare your block count to that found at https://www.stealthmonitor.org/.

Your block count can be obtained with

StealthCoind getblockcount

Once synced, stop the client with the command

StealthCoind stop

Place wallet.dat and Start

If you are a new StealthCoin user, you can skip this section.

If you are not a new user and are migrating to Ubuntu, you will need to copy your wallet.dat file from your existing instance to this new server. The wallet.dat file can be found in your existing StealthCoin application data directory. It is found in these locations on the following platforms

  • Mac: ${HOME}/Library/Application Support/StealthCoin
  • Linux: ${HOME}/.StealthCoin
  • Windows: %appdata%\StealthCoin

To get the %appdata% folder on Windows, find the "Run" command either in the windows menu (Windows 7 and below) or by using the search feature to find the command named "Run". In the dialog, type %appdata% to open the %appdata% folder (Windows 8 and above).

On OS X, find the Application Support folder by going to the Finder:

  • Click "Go"
  • Click on "Go To Folder"
  • Enter ~/Library/Application Support/ in the dialog

From here, you should copy your wallet.dat file to your new Ubuntu VPS. On windows this can be done with the third-party Putty program. On OS X, this can be done with the Terminal programs (/Applications/Utilities/Terminal) or using CyberDuck or similar program.

The wallet.dat file must go in the ~/.StealthCoin directory on your new Ubuntu server.

Once copied start the client with the command

StealthCoind

Clean Up

While the client is getting started, it is recommended to remove the xst-bootstrap.7z file and to remove the line rescan=1 from the config.