This is Part 3 in the Cryptocurrency series:

  • PART 1 - We look at setting up a Bitcoin full node connected to TestNet3
  • PART 2 - We put in place some hardening strategies to protect against common attack
  • PART 3 - We look at setting up a Litecoin full node connected to TestNet4

Since this article is a continuation from Part 1 and 2, it is assumed that you have a Bitcoin TestNet node (Part 1) running already and you’ve made your server secure (Part 2).

Setting up a Litecoin full node connected to TestNet is pretty much the same as setting up a BTC node, so if you’ve been through Part 1, this will all look very familiar.

You will notice that the documentation for litecoind and litecoin-cli is very lite-on/non-existent (pardon the pun), this is because the Litecoin source code was forked from the Bitcoin source, and the Litecoin development team has been applying Bitcoin source updates/changes to the Litecoin source over time. So even though Litecoin and Bitcoin have different ‘configuration’ (block times, address prefix, PoW algorithm, …) the tools are the same - namely bitcoind/litecoind & bitcoin-cli/litecoin-cli, so we can refer to the Bitcoin documentation where there is a gap in the Litecoin documentation.


Begin by SSH-ing to the server - as root:

# where is the IP address or host name of the server

Make sure all packages are up to date:

pacman -Syu

This next step differs from the Bitcoin node setup, we are not going to use the official Litecoin package from an Arch Linux mirror - that’s because, one does not exist. We can either install the Litecoin daemon manually or because we are using Arch Linux, the Arch Linux User Repository (AUR) might have a package we can use.

Arch Linux User Repository (AUR)

The closest AUR I could find was litecoin-bin (AUR) but this AUR included all the QT (Cross platform UI framework) dependencies. We don’t need or want the QT dependencies as we are running a headless server. So I repurposed an out-of-date and abandoned AUR to our needs, meet litecoin-daemon (AUR)

WARNING Do NOT TRUST AURs - check out the PKGBUILD file before installing, and make sure it does what the label says it does, even though this AUR is authored by me - so check it out!

The easiest way to install/update/remove AURs is to use yaourt. If you don’t have yaourt installed, he’s how to do it:

# Check it's not already installed
# If it's not installed you should get this message: "yaourt: command not found"

# edit the pacman configuration file
nano /etc/pacman.conf
# paste '[archlinuxfr]' block, at the end of the file  - [see below]

Add this at the end of /etc/pacman.conf

 SigLevel = Never
 Server =$arch

Now we can install yaourt:

# Force update the package databases
pacman -Syyu
# install yaourt
pacman -S yaourt

Note: Yaourt does not allow installation of packages when you are root, so this is a good time to create our ltc service user.

Let’s now create the user account that our litecoin daemon will use:

useradd ltc
passwd ltc
# enter password twice

# create a home directory
mkhomedir_helper ltc

Next we’ll need somewhere for the Litecoin daemon to store the blockchain and other data:

# Create directory /ltc
mkdir /ltc
# Change owner of directory /ltc to ltc (user)
chown ltc: /ltc
# Modify permission of directory /ltc for owner to have write access
sudo chmod u+w /ltc

Now, we’ll switch to the ltc user and setup the daemon configuration and setup some bash aliases:

# switch to ltc service account
su - ltc
# Create the directory that the Litecoin daemon searches for a configuration file (if not specified)
mkdir .litecoin

nano ~/.litecoin/litecoin.conf
# paste config [See below]
nano ~/.bashrc
# paste aliases [See below]

Let’s now install the litecoin-daemon AUR

yaourt litecoin-daemon
# Only one package should be show with the name `litecoin-daemon`, so press '1'
# Then follow the prompts. 
# The final step will require you to provide the root password.

That’s all we need to do with the ltc user.

# exit back to root

Open Litecoin TestNet port on UFW (See Part 2 of this series if you don’t know what this means)

ufw allow 19335
ufw status

We now want to create a new systemd service, that starts automatically when the VM starts:

# the ltc.service file doesn't exist yet, but nano will create it with the contents we paste into it
nano /etc/systemd/system/ltc.service
# paste ltc service definition [See below]

# enable at system startup
systemctl enable ltc
# start the Litecoin service now
systemctl start ltc

# Check it's running
systemctl status ltc

The Litecoin daemon is running now, so let’s query it with the CLI:

# switch to ltc service account
su - ltc
# Display network details
# Display block details (index, blocks, ..)

NOTE: It may take up to a minute before the daemon will allow requests on startup, whether it’s the first time or after it’s been running for days. This message indicates it’s loading the index, try again in a few moments:

error code: -28
error message:
Loading block index...

NOTE: It took about 30 minutes for the node to catchup to the current height. And you’ll need about 500MB of storage (as of the 15th December 2017):

[ltc@localhost ~]$ du /ltc -h
16M     /ltc/testnet4/chainstate
70M     /ltc/testnet4/blocks/index
409M    /ltc/testnet4/blocks
455M    /ltc/testnet4
455M    /ltc

Contents of files


All litecoind configuration options are defined (same as bitcoind): here

## litecoin.conf configuration file. Lines beginning with # are comments.

# IMPORTANT: do not use the daemon's wallet


# Network-related settings:

# Run on the test network instead of the real lite network.

# Listening mode, enabled by default except when 'connect' is being used. Port 19335 (TestNet4)

# JSON-RPC options (for controlling a running Litecoin/litecoind process)

# server=1 tells litecoind to accept JSON-RPC commands
# Accept public REST requests (default: 0)
# RPC username or password is not specified, so a cookie is written to the /ltc/testnet4 directory for the CLI to use for auth


All litecoin-cli options are the same as the bitcoin-cli, defined: here

alias ltc-start='litecoind -daemon'
alias ltc-stop='litecoin-cli stop'
alias ltc-block='litecoin-cli getblockchaininfo'
alias ltc-net='litecoin-cli getnetworkinfo'
alias ltc-mempool='litecoin-cli getrawmempool'
alias ltc-mempoolall='litecoin-cli getrawmempool true'


# To edit use:
# $ systemctl edit litecoind.service
# See "man systemd.service" for details.

Description=Litecoin TestNet daemon

ExecStart=/bin/litecoind -daemon
# Creates /run/litecoind owned by ltc
# user can be a service account