⚡ The Lightning Network, Part #3: Connecting A Lightning Node to Zap From Your Mobile Phone

While staying secure using Tor

Ishaana Misra
Coinmonks
Published in
3 min readSep 17, 2021

--

Source

If you’re running a lightning network node and need to be able to access it to use your Sats for payments on the go, Zap is a simple solution which is relatively easy to set up. With Zap you can interact with your lightning node by opening channels, making payments, and settling balances. Using Zap you can interact with any node running LND(a lightning node implementation)

I decided to set up Zap on my iphone, so I downloaded its mobile app. In order for Zap to be able to connect to your node, it needs to know some key information about your node. To obtain this information from your node in a way that Zap can understand, we can use lndconnect to generate a QRCode which Zap will able to get the information from.

If you haven’t already, in order to run lndconnect you’ll need to have installed Go on your node. You can do so by going to the Go downloads page and following the directions. Make sure to choose the file corresponding to the correct computer architecture of your computer.

Once you’ve verified the installation of Go, it’s time to download lndconnect. At first I kept running into errors when trying to do this using the instructions in the repository’s README file but I soon found some alternative instructions by @sipsorcery on github:

~$ git clone <https://github.com/LN-Zap/lndconnect>
~/lndconnect$ go mod init github.com/lndconnect/v2
~/lndconnect$ go mod edit -require github.com/lightningnetwork/ lnd@v0.12.1-beta
~/lndconnect$ go build
~/lndconnect$ sudo cp lndconnect /usr/local/bin/lndconnect

Next, we need to create a Tor hidden service which lets Zap connect to LND REST service. We can do this by configuring Tor by modifying the torrc file. torrc is located in /etc/tor, and can be modified by running sudo nano /etc/tor/torrc. Under the section for location-hidden services, write the following:

HiddenServiceDir /var/lib/tor/lnd_rest/
HiddenServicePort 8080 127.0.0.1:8080

For these changes to take effect, we need to restart tor by running sudo systemctl stop tor.service. Also start up lnd if it isn’t already running on your node.

In order to create the right QRCode, we need to find out the onion address of the hidden service we just created. I did this by running sudo cat /var/lib/tor/lnd_rest/hostname. To generate the QR code, just run:

lndconnect --host=[onion address] --port=8080

Scan the qr code on Zap, and you’re done! You should now be able to interact with your lightning node from your phone! For extra security, it’s recommended to also run VPN on your phone.

Overall I found Zap fairly intuitive and easy to use once the lightning node was connected, though it did take a bit longer than expected to run lndconnect. As an additional bonus I found the user interface significantly better than other apps I checked out which can also be used to connect to your node. I had a lot of fun opening channels and sending Sats back and forth!

--

--

Ishaana Misra
Coinmonks

Student at Stuyvesant learning about cryptography and Bitcoin.