Lightning Network is growing in popularity and many believe it is the answer to bitcoin scalability. In order to understand Lightning Network more, I recently set out to build and run a lightning node from scratch on my spare Linux machine.
To start, I downloaded the LND source code from github. I had some local environment issues to fix such as installing Go and a series of other dependencies. I saw the docker distribution and tried that rather than worry about my local environment.
Unfortunately I had issues with docker that proved even more difficult so I went back to configuring my local environment, setting environment variables, configuration files in ~/.lnd/, admin.macaroon, etc.
Rather than download the entire blockchain, I configured LND to use neutrino. Finally got it working and ran ./lnd from the command line. Opened another terminal.
Then I used lncli to set up a wallet and generate a bitcoin receive address. Deposited some bitcoin to the node. Spent some time studying the various endpoints that could be called with lncli and the API signatures. Tested out a bunch of lncli commands to get a feeling for interacting with the node endpoints.
I decided to open an initial channel of 200,000 sats. I picked a well-connected and well-known node to open a channel with, fulmo.org. I noticed there was an option in the command to open a new channel which allowed for pushing a balance to the remote node.
I decided to retain 100,000 in local balance and push 100,000 to the remote node. I thought this would be a good idea to start out with some inbound capacity but I soon after learned this was a mistake. (When the channel is closed, that amount will go to the remote node. A small cost for a big education…)
Once this channel was open, after a few hours I decided to search the internet for my node. I googled the public key of my node and found a result on 1ML. I went through the process to claim my node. This process involved opening a channel in a specific amount to 1ML. This would be my node’s second channel of 278,171 sats.
My lightning node 1ML profile page: https://1ml.com/node/030f59c7ce0a35969c114f8818b7cd151e00e34ba3601f370e53d5a86dc6221c73
With two channels open, it was time to test sending and receiving some payments.
While doing some additional research I heard about RTL, a front-end to the same functionality available through lncli. After resolving a number of nodejs dependencies (including gratuitous use of the ‘--force’ modifier), and setting few configuration flags, I got RTL running and navigated to localhost:3000
RTL dashboard for LND node 030f59c7ce0a35969c11
I used the RTL interface to update the fee policy on my channels to 0 mSat base (as suggested by lightning researcher René Pickhardt), 1 mSat fee rate
Observations so far:
- Payments over 70,000 sats consistently cannot find a route
- Payments between 20,000 and 50,000 sats work most of the time but not always
- In the typical case payments have 4-5 hops
- In the worst cases there are 15 hops or no route at all
- No receive routes found for Blue Wallet or LNTXBOT invoices
- Gossip messages are being broadcast
- Increase capacity to 0.1 BTC (10 well-connected channels 0.01 BTC each)
- Retest sending 100,000+ sat payments
- Retest receiving in any amount
My take-away is this:
Lightning Network circa 2022 reminds me of the 1995-1999 era web. It’s fun, it’s confusing. It sort of works, well enough that everyone sees massive potential. It feels inevitable, like it is only a matter of time until this is everywhere.
In the meantime, there is much work to do. What a time to be alive!