Select Page

up Litecoin Node on AWS Ubuntu 16.04

Launch an EC2 instance
●Login on AWS Console.
●In the top-right corner of the AWS Management Console, choose the AWS Region in which you want to create the DB instance. This example uses the US East (N. Virginia) region.
●Select EC2 from the Services dropdown (top-left), click on Launch Instance.
●Search for Ubuntu 16.04 AMI, & Select Ubuntu 16.04 AMI.
●On the next screen, select instance type c4.xlarge, select public subnet.
●Add root storage 30 GiB, Additionally add 50 GiB GP2 storage to keep ltc blocks data, Permanent mount it on /home/crypto
●Select Security Group, Create and download key pair.
●Allow SSH port 22 for your public IP Address in security group.
●More instruction to launch an EC2 here.

SSH into your Instance and required softwares

●Connect to the EC2 instance using public IP Address and pem key which you launched earlier.
●Update/Upgrade OS using sudo apt-get update; sudo apt-get upgrade -y; sudo apt-get dist-upgrade -y;
●Install Development Tools and it’s dependencies using following commands

sudo apt-get install libboost-all-dev libboost-dev htop git curl wget zip build-essential unzip -y
sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils -y
sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev -y
sudo apt-get install libminiupnpc-dev -y
sudo apt-get install libzmq3-dev -y

Now let’s go ahead and get the files we’ll need to build Litecoin from the Litecoin Project git.

cd /home/crypto
git clone https://github.com/litecoin-project/litecoin.git
cd litecoin/
Let’s also setup a convenience constant for the absolute path to Litecoin Core, which is recommended during the build process.
LITECOIN_ROOT=$(pwd)

Since Litecoin Core requires a legacy version of Berkeley DB for it’s wallet files, we’ll need to manually build it. This step is only necessary if you plan on having wallets. If you just want a node with no private keys, you can use the –disable-wallet option at a later point, and you can skip the following section:
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
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 let’s make sure we’re in the correct directory for the next step.
cd $LITECOIN_ROOT
Now let’s get our build configuration ready with some basic options. To be honest, I haven’t had the time to explore all of the many configuration options for the build, but these are the ones you’ll need at a minimum.
./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  

Now we can build:
make
sudo make install
Let’s strip out the unnecessary debug symbols:
cd src
strip litecoind
And now let’s secure the Litecoin Daemon by making it accessible only to a dedicated user account.
sudo chmod 0701 /home/crypto/litecoin
sudo mkdir /home/crypto/litecoin/bin
sudo cp /home/crypto/litecoin/src/litecoind /home/crypto/litecoin/bin/litecoind
sudo cp /home/crypto/litecoin/src/litecoin-cli /home/crypto/litecoin/bin/litecoin-cli
sudo chown -R ubuntu:ubuntu /home/crypto/litecoin/bin
sudo ln -s /home/crypto/litecoin/bin/litecoin-cli /usr/bin/litecoin-cli
sudo ln -s /home/crypto/litecoin/bin/litecoind /usr/bin/litecoind

We’ll need to setup a basic config file with the RPC setup.

mkdir /home/crypto/litecoin_data
mkdir ~/.litecoin
cd ~/.litecoin
vim litecoin.conf

daemon=1
datadir=/home/crypto/litecoin_data
rpcuser=litecoin
rpcpassword=enterpasswordhere
rpcallowip=App_Server_IP/CIDR

Make sure to replace the enterpasswordhere text with a strong password and rpcallowip with your application server IP Address, especially if you’d like to make RPC calls to this full node from a remote client.

Now set the permissions of the config file:
chmod 0600 litecoin.conf

And at last we’re ready to start up the daemon.

litecoind -daemon

You’ll see “litecoin server starting” and your node will begin to download the blockchain. During this process, you’ll notice your CPU usage will peak to 99%, but that will stop once the blockchain has been fully synced.
To check on the progress of your sync, run this:
litecoin-cli getblockchaininfo

Allow occupied port for application server from security group

Below ports will be occupied by LTC daemon:

9332 => MainNet RPC (App Instances)
9333 => MainNet P2P (Public)

Please note, It can take 10-12 hours to fully sync with latest block.
And compare the number of blocks in the output with the current height of the blockchain at a site like this: http://explorer.litecoin.net/