Let’s get started!

Step 0: Get a dedicated Linux VPS — The happy medium

There are many setups possible for running your own Litecoin super node. As I alluded to in my intro, the simplest setup for those not technically inclined is to use a desktop machine running Windows or Mac and download & install one of the official binary images available from Litecoin.org. However, not everyone has a spare computer lying around, or one they’re willing to leave on 24/7 (fan noise anyone?). Another option, which could cost less in hardware (depending on if you already have some peripherals and external storage) and definitely have lower electricity costs, is to use one of the all-in-one computers-on-a-chip, such as the Raspberry Pi. Unfortunately, this option is at the other end of the technical complexity spectrum, not recommended unless you are up for a challenge; here’s a guide if you are!

If you don’t mind doing a little bit of work, don’t like the idea of letting something run 24/7 at home, and are looking for the most economical option, my recommendation is to get a VPS (a virtual private server); a virtual server sold by the month or by the year by hosting companies around the world.

I’m not going to recommend any hosting company in particular, but suggest you do as I did and consult websites that compile the latest deals on “low end” VPS, such as this one, this one, or that one. You’re looking for a Linux-based VPS with:

a minimum of 2 GB of RAM

at least 25 GB of hard disk storage (operating system + the current whole Litecoin blockchain will use up 16ish GB; this will leave some space for the blockchain to grow in the coming few years)

at least one standard (IPv4) IP address (to be easily connectable by other nodes)

The network bandwidth allocation provided by most hosts is typically in the terabytes (TB), which is more than sufficient for the initial blockchain download and a year of block synchronization and verification (we’ll deal with how not to surpass this data transfer limit later, in Step 5). Also, don’t worry about the type of “virtualization” — OpenVZ, KVM, etc. — for our purposes, the performance difference won’t matter much. Likewise for the number of CPU cores.

You should be able to find a suitable VPS for around $20 to $25 USD per year; with any luck the hosting company will even accept Bitcoin (many do) or Litecoin (sadly, still a bit more rare). If possible, pick a host providing a VPS in a less-common location (most are US-based); adding geographic diversity is important to robust decentralization.

When you fill out the signup/purchase forms, be sure to select as initial Linux OS image: Debian 8 Minimal (64-bit). As the name implies, this is a clean, minimal operating system, without any superfluous software included.

Step 1: Connecting to your VPS for the first time

After signing up, your hosting company will typically provide you with an email summarizing the details of your virtual server. The most important things to note are the server’s IP address (it will look like x.x.x.x) and the “root” user’s password.

Generally, they will also provide some basic background information on how to connect to your server via the ssh (secure shell) protocol, so that you can interact with it by “command line interface” (aka CLI; as opposed to a graphical user interface, a GUI). In short, if you’re on a machine running Windows you’ll need some free software, such as PuTTY. If you’re on a machine running OSX/macOS or some flavor of Linux, just open a terminal window (hint: On a Mac search for “Terminal” in the Spotlight Search).

Mac Terminal app (default “Basic” color scheme)

Let’s connect to your VPS for the first time. In the terminal window type the following command and press Enter/Return:

ssh root@x.x.x.x (where x.x.x.x is your new server’s IP address)

As this is the first time connecting to the server, you should be prompted by your system with a warning that it doesn’t recognize the remote server and whether to accept to continue connecting. Enter yes!

If your are not able to establish an ssh connection to your VPS and you receive an error message telling you that the host is “unreachable”, it is likely that the IP address was not correctly assigned to your server. (This happened to me!) You’ll need to open a support ticket with the hosting company and ask them to fix this!

If, however, the connection to the VPS is established, you’ll be asked to login with the “root” user’s password. Go ahead and do so.

Step 2: Basic system security and installation of required software

Now that you are logged in as the user “root”, the super-administrative user with rights to do anything on the server, let’s quickly change its password. In the command-line interface, enter:

passwd

Follow the prompts and select a new password. It is generally accepted that several words, a punctuation mark or two, and some numbers would constitute a decent password.

Let’s now install some basic software prerequisites that were not included in the minimal version of Debian Linux. First, we need to get a list of approved software sources.

N.B. Enter each listed command line, one at a time, waiting for them to complete before entering the next one. This is applicable to all following blocks listing commands in this guide.

apt-get update apt-get upgrade

Now we’ll install a basic text editor (nano), a tool to get software from remote source code repositories (git), and a system utility to schedule tasks (cron):

apt-get install nano apt-get install git apt-get install cron

Next, we’ll install a bunch of software libraries that the Litecoin system will need to compile:

apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev apt-get install libminiupnpc-dev apt-get install libzmq3-dev

Step 3: Get and compile the latest Litecoin software

It’s time to download the open source software that powers the Litecoin digital currency! We’re going to get the full source code for the project. In addition, we’re getting the open source database software used to store the details of Litecoin wallets. (Though we aren’t actually going to be using this node to hold any wallets, I had problems compiling the Litecoin source code using the “no wallet” option.)

git clone https://github.com/litecoin-project/litecoin.git LITECOIN_ROOT=$(pwd)/litecoin BDB_PREFIX="${LITECOIN_ROOT}/db4" mkdir -p $BDB_PREFIX 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

The last command is simply to verify the integrity of the database software. If it fails, it either means that the download was corrupted (try again) or that the archive was modified at the source, potentially for malicious purposes. Assuming it’s a pass, let’s compile the database software:

tar -xzvf db-4.8.30.NC.tar.gz cd db-4.8.30.NC/build_unix/ ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX make install

Now it’s time to compile the Litecoin system from all this source code!

Note that the make command may take quite a while to complete its execution. Feel free to do something else on your machine during the delay; this would also be an opportune time to get a cup of coffee. ☕️

cd $LITECOIN_ROOT ./autogen.sh ./configure LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/" CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768" --enable-upnp-default --without-gui make make install cd src strip litecoind

Step 4: Create a new user that will run the Litecoin node

So far we have been doing everything as the “root” user. It’s not a good idea to have the Litecoin node run by this super-user, so we’re going to create a new user on your server (with no administrative rights) who’s only job will be to run the Litecoin software. Let’s call this user “litecoin”:

adduser litecoin

You will be prompted to pick a password for this user. Create a different password than the one you used for the “root” user! You will also be prompted to enter more details about the user (full name, office, telephone number); all this is not applicable, as this user will not be used by a human, and in any case these details are always optional; simply press Enter/Return at each of those prompts.

Now for some housekeeping on the new user’s user group, and the user’s home directory. We’re also going to copy over the compiled Litecoin node software, litecoind (the Litecoin “daemon”), to the new user’s home directory:

usermod -g users litecoin delgroup litecoin chmod 0701 /home/litecoin mkdir /home/litecoin/bin cp ~/litecoin/src/litecoind /home/litecoin/bin/litecoind chown -R litecoin:users /home/litecoin/bin

Step 5: Configure the Litecoin daemon and run it for the first time

Let’s login as the “litecoin” user for the first time.

su litecoin

The last thing we need to do before running the Litecoin daemon is to create a basic configuration file.

cd $HOME mkdir .litecoin cd .litecoin nano litecoin.conf

That last command should have opened the nano text editor with an empty file (called litecoin.conf), which should fill your terminal window. Enter the following 5 lines of text, using anything you wish for the two REPLACE-THIS parts (this user and password are a local security mechanism ensuring that only the “litecoin” user, with this configuration file, can interact with the Litecoin node that will be running on the server).

daemon=1

rpcuser=REPLACE-THIS-WITH-ANY-USERNAME-YOU-WANT

rpcpassword=REPLACE-THIS-WITH-ANY-PASSWORD-YOU-WANT

disablewallet=1

maxuploadtarget=7500

The maxuploadtarget value is a number in megabytes (MB), per day, and should be set to protect you from going over the yearly network bandwidth limit set by your hosting company. For example, if your VPS was allocated 3 TB (3000 GB) of data transfers per year, a conservative estimate would be to presume, at most, 0.25 TB (250 GB) will be needed by your node to communicate and download new blocks during the year, leaving 2.75 TB (2750 GB) of bandwidth for listening, relaying transactional data, and uploading blockchain history to other nodes. This works out to roughly 7.5 GB per day (2750 divided by 365 days), or 7500 MB per day.

The file should look something like this:

Press Control+O (^O) to save the file, then Control+X (^X) to exit the text editor.

That’s it, we’re ready for lift-off! We’re going to change the permissions on the litecoin.conf configuration file, and fire up the Litecoin node daemon for the first time!

chmod 0600 litecoin.conf cd ../bin litecoind -daemon

Just as its name implies, litecoind, is a daemon, i.e., software that runs in the background. The last command above initiated its execution, but you should be back to the interactive command line prompt. To confirm that the Litecoin daemon is indeed running, use the command top to see all the currently running processes. Within a few seconds you should see litecoind at the top taking up 98% or more of the % CPU. When you are satisfied that it’s running, type q to quite from the top display.

Step 6: Make sure the Litecoin node restarts automatically if the system crashes or if the server reboots

In theory, the Litecoin daemon we started should keep running forever, even after we logout from the interactive ssh session the server. But reality is a bit messier. Things can go wrong: The server could run out of memory, causing the daemon software to crash, the server could be rebooted by accident or because of some power outage at the hosting company, etc… You don’t want to have to keep monitoring your Litecoin node to see if it’s gone down, so let’s program the system to try to restart it automatically, every hour. If it’s already running, nothing will happen (the command will fail, but that’s OK).

crontab -e

This command will open the text editor with a special type of file that Linux systems use to schedule tasks automatically. Scroll to the bottom of the text file and enter the following line of text:

@hourly /home/litecoin/bin/litecoind -daemon

It should look something like this:

Press Control+O (^O) to save the file, then Control+X (^X) to exit the text editor.

Step 7: Monitoring your node as it syncs up with the existing Litecoin blockchain

Before we logout, let’s keep an eye on your new Litecoin node’s progress, as it gets up to speed, discovering and downloading the whole Litecoin blockchain — yes, that’s the full history of all Litecoin transactions since October 2011!

litecoin-cli getblockchaininfo

You can run this command as many times as you want. Each time it will return the latest information.

What to focus on are the two entries near the top of the returned data structure: “blocks” and “headers”. During the first hour or two after starting the Litecoin node, the number of blocks will remain 0 and the number of headers should be increasing each time you run the command. As soon as the headers count reaches the last (most recent) block on the Litecoin blockchain (you can find the most recent block number, aka as the current “height” of the blockchain, here: http://explorer.litecoin.net) the number of blocks will then start to increase until, several hours later, the number of blocks will equal the number of headers; this is when your node will be fully synced and have a local copy of the full Litecoin blockchain. When I started my Litecoin node, this initial synchronization and verification process took about 8 hours to complete.

You don’t need to stay connected and logged in as the “litecoin” user while this initial synchronization is happening. Feel free to logout with the exit command (you will need to exit twice to completely disconnect from the server; if you followed the instructions of this guide precisely, you will also have been logged in to the “root” user before connecting to the “litecoin” user). You can always connect again, later in the day, or at any time in the future, by opening a terminal window on your computer and entering the command: ssh litecoin@x.x.x.x (where x.x.x.x is your server’s IP address).

If you do decide to login again at a later date, an interesting number to keep an eye on is the number of current connections to other Litecoin nodes. In a quite elegant process, other nodes will soon find your node automatically; there is no manual sharing or publicizing that needs to be done by you. To check this number, run the following command and look for the “connections” entry in the displayed output:

litecoin-cli getnetworkinfo

Step 8: Be proud!

Smile and feel free to pat yourself on the back. You’ve just made a small contribution to the smooth operation of a decentralized cryptocurrency!