Author Topic: Step-By-Step: Creating a Spreadcoin Node  (Read 3510 times)

xojex

  • Newbie
  • *
  • Posts: 11
    • View Profile
Step-By-Step: Creating a Spreadcoin Node
« on: May 07, 2015, 06:37:20 pm »
Spreadcoin Node Guide

This guide shows how to compile the Spreadcoin binary daemon to run a full Spreadcoin node from scratch on a clean Ubuntu VPS system or Ubuntu desktop environment.

The method for installing Spreadcoin daemon described here requires that you enter text-based commands. Generally you would use a Secure Shell (SSH) client for logging into a remote machine and for executing commands on a remote machine. Installation on a desktop environment would use a Terminal shell window.



Compile and Installation

Ubuntu uses a package manager to simplify the downloading and installation of software components. To ensure that your version of Ubuntu has the latest package information with the following command. Enter your login password when prompted.

Code: [Select]
sudo apt-get update


We'll use Git to access the Spreadcoin source code. In addition to providing the current version of Spreadcoin code, Git gives ready access to all past and future versions. Enter your login password when prompted.

Code: [Select]
sudo apt-get install git


Next, create a source directory and clone the Spreadcoin source repository.

Code: [Select]
mkdir -p src && cd src


Code: [Select]
git clone https://github.com/spreadcoin/spreadcoin.git


After a short time, all files should be ready. To confirm, use the ls command.

Code: [Select]
ls spreadcoin


The Spreadcoin core requires many software libraries that don't come packaged by default with the Ubuntu distribution. We must install these dependencies. The first one, build-essential, enables software to be compiled from source.

Code: [Select]
sudo apt-get install build-essential


The remaining dependencies can be installed with a single command.

Code: [Select]
sudo apt-get install autoconf libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libqt4-dev libqrencode-dev libdb-dev libdb++-dev libminiupnpc-dev


To compile the Spreadcoin daemon, move into the previously-cloned git repository, checkout the current release tag, and finally make the executable binary.

Code: [Select]
cd spreadcoin/src


Code: [Select]
git checkout master


Code: [Select]
make -j $(nproc) -f makefile.unix



After the build process has completed with no errors, you should end up with a spreadcoind binary located at spreadcoin/src.

If you encounter errors during the build process, verify that you have all the required dependencies. Check the Dependency Build Instructions located at the Spreadcoin github repo. These can change over time. If make encounters a memory error, creating a swapfile should allow make to complete the build.

Create a hidden directory containing a spreadcoin.conf file.

Code: [Select]
mkdir -p ~/.spreadcoin


Code: [Select]
cat > ~/.spreadcoin/spreadcoin.conf <<EOF


Code: [Select]
rpcuser=SOMETHING
rpcpassword=UNIQUE # change this, create a strong password
maxconnections=1000
timeout=20000
port=41678
txindex=1
EOF



 *EOF (end of line) is known as a "Here Tag" in this use. Basically it tells the shell that you are going to enter a multi-line string until the second "EOF".

Move the binary.

Code: [Select]
sudo cp spreadcoind /usr/local/bin/spreadcoind


Create a symlink to the binary.

Code: [Select]
sudo ln -s /usr/local/bin/spreadcoind /usr/bin/spreadcoind


Spreadcoin daemon can now be run from the command line.

Code: [Select]
spreadcoind & disown


("& disown" allows you to close a Terminal on a local machine or terminate SSH session without killing the command running in it)

To ensure that the daemon can be reached by other nodes, port 41678 needs to be opened in your firewall.

To view info about your spreadcoind instance enter the following:

Code: [Select]
spreadcoind getinfo


To safely stop your node, run the following command:

Code: [Select]
spreadcoind stop
Optional: Start Your Node At Boot

Starting your Spreadcoin node automatically each time your computer boots makes it easy for you to contribute to the network. The easiest way to do this is to start Spreadcoin daemon from your crontab.To edit your crontab, run the following command:

Code: [Select]
crontab -e
Scroll to the bottom of the file displayed and add the following line:

Code: [Select]
@reboot spreadcoind -daemon
Save the file and exit; the updated crontab file will be installed for you. Now Spreadcoin daemon will be automatically started each time your reboot the server.

You can also setup a cron job to be executed periodically to make sure the daemon is running.

Code: [Select]
crontab - e
Code: [Select]
0 * * * * /usr/bin/spreadcoind -daemon
This will check every hour to make sure the daemon is running.


stonehedge

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Step-By-Step: Creating a Spreadcoin Node
« Reply #1 on: May 26, 2015, 11:50:21 am »
This worked perfectly for me.

When I followed these instructions on a clean VPS I didn't need a swap file but when I followed them on a VPS with bitcoind running (probably should have stopped it!) I had to add the following step. I also assume that this will be necessary if you are following these instructions on a low spec VPS.

Code: [Select]
sudo mkdir -p /var/cache/swap/   # create a driectory that holds the swap file
sudo dd if=/dev/zero of=/var/cache/swap/myswap bs=1M count=1024 # for 1 GB
sudo mkswap /var/cache/swap/myswap # format as swap
sudo swapon /var/cache/swap/myswap # announce to system

Then you need to insert a line into fstab to make sure the new swap file persists after reboot:

Code: [Select]
nano /etc/fstab # Opens fstab in text editor.
/var/cache/swap/myswap    none    swap    sw    0   0 #Copy and paste into fstab
CTRL+o to write file
CTRL+x to exit nano