Installing Lightning Network part 2: Here We Go Again

Ronald Mannak
Aug 10, 2018 · 7 min read

In part 1 I installed a Lightning node on a Digital Ocean droplet. The goal was to explore the Lightning Network, and to see if it’s possible to generate passive income. Money can be made by running a Lightning node 24/7 on a server and forwarding payments from nodes to other nodes. The better connected your node is, the higher the changes payments will be routed through your node. So how did the first month go?

One month in

While other nodes have made up to 5% a week, at least for a short amount of time, I noticed I wasn’t making any money all. None. I had about 85 channels to other nodes, but not a single transaction was routed through my node.

A second issue I ran into was that I wasn’t able to connect to some other nodes. Lastly, I noticed that some channels I created were in stuck in a state, for which I opened an issue on GitHub.

So I created a second node to double check if my node was working correctly. Given that I had no problems creating and funding channels, I didn’t expect any major issues. However, it turned out my node had severe issues. It took me almost to solve (most of) the issues. It was a both exciting and frustrating journey.

The main issue I found after setting up the second node was that my two nodes were not able to connect to each other, even though they ran exactly the same software. I opened a separate GitHub issue for the connection problem.

Long story short: the Lightning ports were not set up correctly, and the Lightning software is not able to detect the issue. To make matters worse, the example setup configuration on the C-Lightning readme contained exactly the same error: The Lightning port wasn’t forwarding incoming data to the Lightning Docker container.

The good news is that I did find a much easier way to install a Lightning node using Docker Compose. I also corrected the Lightning readme and created a pull request. Here’s how to correctly set up Lightning node:

Upgrading from Part 1

If you followed the instructions in part 1 to install your Lightning node, you will need to remove the docker containers and remove the config files.

  1. Remove the existing docker containers
  2. Remove the bitcond and clightning config files
  3. Remove the convenience access scripts

You don’t need to (and don’t want to) erase the droplet, since that would force you to restore a backup, which is a difficult and risky procedure (see part 1 for details).

First, log in on your droplet.

Next, remove the existing con

Next, we’ll delete the bitcoin and lighting config files

And delete the convenience scripts.

You’re now ready to reinstall Bitcoin and Lightning. Skip A Fresh Install chapter and continue to chapter (Re-)installing Bitcoin and Lightning.

A Fresh Install

If you didn’t install a Lightning node using the steps explained in part 1, you’ll need set up your node using the following chapter in part 1:

  • Setup Digital Ocean

Then, log in on your droplet.

Next, we’ll create the working directories for bitcoind and clightning:

(Re-)installing Bitcoin and Lightning

So there is a

  1. Set up the firewall
  2. Create Docker containers using docker-compose
  3. Create convenience access scripts

The Digital Ocean droplet comes with a firewall, called ufw. We’re going to open ports 8333 (bitcoin) and 9735 (lightning) for both incoming and outgoing traffic.

If all is well, ufw will report something similar to the list below (plus any other ports that are open).

Next we’ll create the bitcoind and clightning container. Unlike part 1, we’ll use a much easier to use docker-compose script this time.

The content of docker-compose.yml is shown below. Set alias to the chosen name of your node, set announce-addr to the ip-address of the droplet, and optionally set the rgb value to a color that will be used to show your node in Lightning explorers.

Note: the docker-compose.yml file is based on the example in the C-Lightning readme file. Unfortunately, the original readme file contained an error: the containers did not expose the ports. I’ve created pull request #1816 that contains a fix.

Create and run the containers by using docker-compose:

Docker will create and run two containers. The bitcoind container should immediately beging downloading the blockchain. For a clean install, this will take hours.

Since the script will not exit, open a new terminal window or tab and log into your droplet again.

Add a convenience script to access the bitcoind container:

In Nano (step 3 above), edit the bitcoin-cli script as follows:

Add a convenience script for Lightning

In Nano (step 2 above), edit the lightning-cli script as follows:

And that’s it. Enjoy your fully functioning Lightning node!

Well, actually, not quite. You’ll see that the bitcoin-cli script doesn’t work. Since you won’t use it that often, I’m going to keep the broken script here. If you see what’s wrong, please leave a comment and I’ll update the post.

More and Better Connections

In part 1, I listed a few ways to find nodes to connect to. After I posted the article, I came across Moneni, which finds good highly connected nodes your node isn’t connected to.

Errors and Solutions

Although I solved the biggest issue of other nodes not able to connect to my node, there are still major issues I mentioned in part 1 that I haven’t been able to solve yet:

CHANNELD_AWAITING_LOCKIN and CHANNELD_SHUTTING_DOWN

Even after a month, some channels are still stuck in either awaiting lockin or shutting down state. I’ve opened an issue (issue #1776) that hasn’t received any feedback of comments yet. The bitcoins in these channels has been inaccessible for over a month.

Finally

I am going to run the server for a few weeks and will share if running a Lightning node is actually profitable at this point.

If you’re running a Lightning node, please considering creating a channel to me and funding the channel. I appreciate it!

Thanks

Big thanks to Ricky Kazuo Miller, Arsenie Yeremin, David Carter, Chang Li, and the C-Lightning team.

Need a Digital Ocean Account? Follow this referral link to create an account on Digital Ocean and receive $10 (I will receive $25).

If you enjoyed this article, and want to read more or show your appreciation, bitcoin is always appreciated at: 3BADHnwyuK54ZVa1dRtRj6Jj8H2BJz63Rc

Coinmonks

Coinmonks is a non-profit Crypto educational publication.

Sign up for Cryptoanarchy

By Coinmonks

A newsletter that brings you week's best crypto and blockchain stories and trending news directly in your inbox, by CoinCodeCap.com Learn more

Create a free Medium account to get Cryptoanarchy in your inbox.

Ronald Mannak

Written by

Open source blockchain developer.

Coinmonks

Coinmonks

Coinmonks is a non-profit Crypto educational publication. Follow us on Twitter @coinmonks Our other project — https://coincodecap.com

Ronald Mannak

Written by

Open source blockchain developer.

Coinmonks

Coinmonks

Coinmonks is a non-profit Crypto educational publication. Follow us on Twitter @coinmonks Our other project — https://coincodecap.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store