A simple guide to Lightning Network on Litecoin

This guide is intended for Debian/Ubuntu users. And has been tested to work correctly on a fresh install of Ubuntu 17.04. If you are unfamiliar with terminal command formatting, please remove the $ sign before copy & pasting the commands into terminal.

Preliminary

Click on the Software & Updates app. Inside of the application, check “community maintained free and open-source software (universe)”. Open Terminal form the search bar.

First update your system:

$ sudo apt upgrade
$ sudo apt update

Install dependencies

  1. Install git:
$ apt install git

2. Install golang-go which is required to build ltcd and lnd:

$ apt install golang-go

3. Install npm & nodejs through the Node Version Manager (nvm):

But first you need to install nvm through the install script:

$ curl -o https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
$ source ~/.bashrc
$ export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"

Now you can install nodejs v8.4.0!

$ nvm install v8.4.0
$ nvm alias default 8.4.0

Last thing left to do is to setup your dev environment.

$ export GOPATH=~/projects/lightning
$ export PATH=$PATH:$GOPATH/bin
$ source ~/.bashrc

Installing ltcd

$ go get -u github.com/Masterminds/glide
$ git clone https://github.com/ltcsuite/ltcd $GOPATH/src/github.com/ltcsuite/ltcd
$ cd $GOPATH/src/github.com/ltcsuite/ltcd
$ glide install
$ go install . ./cmd/...

As simple as copying the above!

Installing lnd

$ git clone https://github.com/lightningnetwork/lnd $GOPATH/src/github.com/lightningnetwork/lnd
$ cd $GOPATH/src/github.com/lightningnetwork/lnd
$ glide install
$ go install . ./cmd/...

Let’s now test lnd:

$ go install; go test -v -p 1 $(go list ./... | grep -v '/vendor/')

Setting up ltcd

$ touch ~/.ltcd/ltcd.conf

Now edit the ltcd.conf file by:

$ nano ~/.ltcd/ltcd.conf

Then insert and match the following:

rpcuser=username
rpcpass=password

Make sure to change username and password to random characters. And write this information down somewhere. To save, ctrl+o and then ctrl+x .

Start syncing ltcd

ltcd now needs to sync with the Litecoin Blockchain. This process will likely take a few hours. And requires minimum space of 9GB.

$ ltcd --txindex --testnet --rpcuser=username --rpcpass=password

Make sure to change username and password to the characters that you previously wrote down in the above step.

Keep this process running in a terminal window. The next few steps require ltcd to be up to date. Please now create a new terminal window shift+ctrl+n or switch to a new terminal tab shift+ctrl+t .

Installing Zap

$ git clone https://github.com/LN-Zap/zap-desktop.git
$ mkdir ~/.lnd
$ cd ~/.lnd

Now generate certificates required for Zap:

$ openssl ecparam -genkey -name prime256v1 -out tls.key
$ openssl req -new -sha256 -key tls.key -out csr.csr -subj '/CN=localhost/O=lnd'
$ openssl req -x509 -sha256 -days 3650 -key tls.key -in csr.csr -out tls.cert
$ rm csr.csr

You know need to remember the result of the following command — this lists the directory in which the cert files you just created exists within.

$ pwd

Once you’ve created the node.js compatible certificate, paste the path to your cert in app/lnd/config/index.js :

$ nano app/lnd/config/index.js

You’ve now opened index.js in the text editor nano. Modify index.js to match the following:

// Cert will be located depending on your machine
// Mac OS X: /Users/user/Library/Application Support/Lnd/tls.cert
// Linux: ~/.lnd/tls.cert
// Windows: TODO find out where cert is located for windows machine
export default {
lightningRpc: `${__dirname}/rpc.proto`,
lightningHost: 'localhost:10009',
cert: '/path/to/directory/tls.cert'
}

Replace /path/to/directory with the result of the pwd command which your previously entered. It might look like this:/home/loshan/.lnd/tls.cert . To save your changes, press ctrl+o then ENTER/RETURN and then ctrl+x .

Finally install zap-desktop!

$ cd zap-desktop
$ yarn

$ ./node_modules/.bin/electron-rebuild

Setting up lnd

$ touch ~/.lnd/lnd.conf

Now edit the lnd.conf file by:

$ nano ~/.lnd/lnd.conf

Then insert using and match the following:

[Application Options]
debuglevel = debug
externalip = MY_IP
no-macaroons = true
[Litecoin]
litecoin.active = 1

Replace MY_IP with your external IP address — which you can find by Googling what’s my ip address. To save, ctrl+o and then ctrl+x .

Starting up lnd

$ lnd --litecoin.active --debuglevel=debug --bitcoin.rpcuser=losh11 --bitcoin.rpcpass=password --bitcoin.testnet --externalip=MY_IP

Make sure to replace MY_IP with your external IP address, which you found previously.

Running Zap

If everything went well, from a new terminal window, we can then navigate to the zap directory:

$ cd ~/zap-desktop

And finally run Zap!

$ npm run dev

Thank you to Charlie Lee, Jack Mallers & Franklyn for testing and producing the instructions above. Special thanks to the numerous persons in IRC freenode #litecoin-dev for helping with reviewing and testing.

On a final note, Zap is still not ready for public release. And you can help Zap get deployed by contributing to the development effort at: https://github.com/LN-Zap/zap-desktop.