Testing RTL web UI with LND and Bitcoin on Windows

Please help review and improve this guide. Constructive feedback is welcome.

When we started out developing Ride The Lightning (RTL) application for LND, we went through multiple iterations of setting up Bitcoin and LND test node infrastructure on Windows, as were doing our development on Windows environment. During this process we learnt a lot, and this is an attempt to share the knowledge gained from the experience.

We also have a vested interest in gaining some alpha testers for our application, so that we can improve the application, based on the feedback. :-)

Application stack for running RTL

The objective is to provide a basic guide on how to setup Lightning Network Daemon (LND) with a Bitcoin back-end for testing, on Windows platform. This guide assumes that you have some basic understanding of Bitcoin and Lightning Network. If you need to better understand Bitcoin and Lightning Network below are good introduction on these topics.

If you prefer to dig deeper and research more, you can refer to the below page by Jameson Lopp, which is the best compendium of topics on these subjects.

Lightning network is a layer two protocol for Bitcoin payments, which is built upon the underlying Bitcoin blockchain network. This guide focuses on Lightning Network Daemon (LND), which is one of the implementations of the protocol specs for Lightning Network. The protocol specs for lightning network are referred to as Basics of Lightning Technology or BOLT and can be found here.

Lightning network ecosystem requires LN node operators to provide liquidity and connectivity to the network so that the Bitcoin users can use the network to make payments. LN Node operators need to connect to the network peers, open channels with peers and lock Bitcoin funds in the channels so that payments can be routed over these channels. Efficient LN node management requires active monitoring of peers, channels, balances etc.

Ride The Lightning web UI is being developed to provide an easy to use interface on LND, for LN node operators so that they can perform node management functions efficiently and intuitively.

Testing LND with a RTL web UI, would require setup of three layers of software namely Bitcoin, LND and RTL.

Please note: This guide focuses on running all the software on testnet, to facilitate testing and familiarity with the all the infrastructure components.


A) Hardware requirements

Running Bitcoin and Lightning does not require advanced hardware. Any home computer running windows (7 or above) with 2+ GB of RAM is good enough. You need to ensure that you have ~35 GB of hard disk space for Bitcoin testnet + Lightning.

For internet connectivity, a broadband un-metered connection is required.

You can learn more about the hardware requirements for Bitcoin below:

Although the requirements listed on the core site is for mainnet. For testnet the internet connectivity and hard disk space requirements are much less, and your node need not be online all the time on testnet.


B) Bitcoin Setup

Step 1: Depending on the version of windows you are running, follow the instructions provided here to download and install Bitcoin core. The recommended version of Bitcoin core is 0.17.0 or above.

Step 2: After the installation is complete, run the Bitcoin Core testnet version.

Running Bitcoin Core — Testnet

Follow the directions provided on the Bitcoin.org website to setup the Bitcoin core. After the intial setup, Bitcoin core GUI will start downloading the blockchain from the network and will start syncing your testnet node.

Step 3: When the menu options are enabled on the GUI, click on the ‘Settings’ option in the menu and select ‘Options’. One the ‘Main’ tab, click on the ‘Open Configuration File’ button.

Opening Bitcoin Core Config file

Enter the following options, in the config file:

testnet=1
txindex=1
server=1
dbcache=6000
daemon=1
rpcuser=<user>
rpcpassword=<password>
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333

Replace the user and password values in the config file. Save and close the file.

Step 4: Close the Bitcoin core client and start again. Let it completely sync with the network. Testnet syncing can take anywhere from a couple of hours to a day depending on your computer configuration and internet bandwidth. The total disk space the Bitcoin testnet blockchain requires is about 28 GB.


C) Lightning Network Daemon Setup

Step 1: Access the latest release of LND here. Recommended version to download is ‘0.5-beta’ or above. Depending on the type of CPU on your computer, download:

lnd-windows-386-v0.5-beta.zip’ (Intel CPU)

or

lnd-windows-amd64-v0.5-beta.zip’ (AMD CPU)

Step 2: Unzip the files in a folder, which will give you two executable files, namely ‘lnd.exe’ and ‘lncli.exe’.

‘lnd.exe’ is a complete executable package, which you need to run LND. ‘lncli.exe’ provides a command line interface to control and query LND.

Before you run LND, you should ensure that Bitcoin core is completely synced on testnet.

Bitcoin Core Testnet — Synced

Step 3: Open windows command prompt and change directory to the folder location where LND files are unzipped. Run ‘lnd’ with the following command options:

lnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --bitcoin.node=bitcoind --bitcoind.rpcuser=<user> --bitcoind.rpcpass=<password> --bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332 --bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333

Ensure that the value passed for rpcuser and rpcpass is the same as specified in the bitcoin.conf file.

Running lnd from command prompt

Once LND is started, the process waits for the users to create the integrated LN Bitcoin wallet.

Step 4: Open another command prompt window and change directory to the folder where LND files are unzipped. Run ‘lncli’ with the following option:

lncli --n testnet create

To create a new wallet, enter your wallet password, select n regarding an existing seed and enter an optional password as a seed passphrase. A new cipher seed consisting of 24 words is created. Record this seed phrase, preferably on paper and keep it safe.

Step 5: Once the wallet is created, the lnd process will progress and start syncing with the bitcoin network. It may take a few hours to a day for it to completely sync with the bitcoin backend.

lnd syncing with Bitcoin Testnet

Step 6: Open the file explorer and go to the following location:

C:\Users\<windows user>\AppData\Local\Lnd

Open the ‘lnd.conf’ file and populate with the following options:

[Application Options]
alias=<NameyourNode>
color=#68F450
debuglevel=debug
externalip=<your IP address>
[Bitcoin]
# enable either testnet or mainnet
bitcoin.active=1
bitcoin.testnet=1
bitcoin.node=bitcoind
[Bitcoind]
bitcoind.rpcuser=<user>
bitcoind.rpcpass=<password>
bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332
bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333

Provide the appropriate values for alias, externalip, bitcoind.rpcuser and bitcoind.rpcpass. Save and close the file. Once you have your lnd.conf configured, running lnd would not require passing the command line arguments.

If you re-run LND, after the wallet has been created, you need to unlock the wallet with your password, before lnd can start re-syncing with the Bitcoin back-end and become functional. Use the below command to unlock lnd:

lncli unlock

You can check the status of the lnd by running the below command:

lncli -n testnet getinfo

Monitor the ‘synced_to_chain’ parameter, as long its not ‘true’, lnd is still syncing to Bitcoin.

getinfo output

You can learn more about the available functions to run for with ‘lncli’ below:


D) RTL setup

Step 1: Ride The Lightning web UI requires Node.js and Git. In case you don’t have it already, you can download and install these dependencies from the below locations:

Node.js — https://nodejs.org/en/download/

Git — https://git-scm.com/download/win

Step 2: Open up the command prompt enter the below commands:

> cd /
> git clone https://github.com/ShahanaFarooqui/RTL.git
> cd RTL
> npm install

Allow some time for the npm to complete the installation of RTL.

Step 3: After the npm install is complete, run the below command to initiate the RTL web server (Ensure that you are in the RTL folder, where npm install was run).

> node rtl --lndir <Path of admin.macroon file> 

The location for admin.macroon file for lnd v 0.5 running on testnet would be:

C:\Users\<windows user>\AppData\Local\Lnd\data\chain\bitcoin\testnet

If the RTL webserver initializes successfully, it should look like below:

RTL initializes successfully

Step 4: Open up the RTL web UI, by opening your browser with the below URL:

http://localhost:3000

And voila! Your ready for testing.

If your lnd node is unlocked, the home page of the app would look like below:

RTL home page with LND unlocked

If your lnd node is locked the UI will prompt for your node password, which can entered to unlock the node. Depending on how long the node was locked, it may take some time for it to sync after unlocking and the application to become usable.

Step 5: Now you are ready to test RTL with Lightning Network and Bitcoin. You can learn more about the available RTL features below:

https://github.com/ShahanaFarooqui/RTL/blob/master/Application_features.md


E) Fund Node

To work with lightning network, you would need fund you lnd node. You can fund you node on testnet by getting some testnet coins from faucets.I am listing some active faucet urls, which can be used to acquire testnet coins.

Once you are done with testing, be a good citizen and return the testnet coins, so that it becomes available to other developers and testers.


F) Testing RTL

The steps involved in testing lightning network with RTL UI are:

Step 1: Fund your node

LND Wallet Screen

Step 2: Connect with peers

Peer management screen

Step 3: Open channels with connected peers

Channel Management screen

Step 4: Verify and Send Payments

Verify and Send Payments screen

You can test verifying and sending payments on the below test sites:


G) Getting Help

For help regarding technical issues, its best to engage with the community.

Bitcoin

For Bitcoin, a good starting point is bitcoin.org, which lists the community urls with good traction and very large existing knowledge base.

Lightning

For Lightning, LND Developer Slack is great place to seek answers on LND or lightning in general as well as hang out and improve your knowledge.

Ride The Lightning (RTL)

The best avenue to get help on RTL would be to open an issue on Github and engage.

H) Credits

This section is reserved for credits to the people helping review and improve this guide. Thanks in advance! :-)

I) References


RTL Web UI is a work in progress, and we are working on adding more features and improving the usability of the application. Any feedback, review, code contribution etc. is welcome. If you would like to contribute as a developer Angular 5/6/7 and Node.js skills will come in handy. Pull requests are welcome on our development git repo.

This is it! Hoping this guide can help you along on your journey and discovery of the Bitcoin and Lightning Network. If you have any questions or feedback, please leave a comment or find me on twitter (@Sauby_k).