LNC Mailbox

Install your own Lightning Node Connect relay proxy server, the mailbox, which comes bundled in Aperture.

Lightning Node Connect (LNC) is a protocol that establishes a connection between your Lightning Network node (LND) and a remote application, such as Lightning Terminal or Zeus.

To traverse firewalls and Network Address Translation (NAT), LNC makes use of a mailbox proxy. This proxy is part of the open-source aperture and can be installed freely by anybody.

LNC is most useful when both the client and the Lightning node are behind a firewall or NAT, but it can also be useful when only the Lightning node is unreachable. In this case, aperture may be installed on the same machine as the client application.

Configure aperture

To configure aperture, we edit the configuration file.

nano ~/.aperture/aperture.yaml

You may use this template and don’t forget to swap the domain name with your own. This domain name should also point to the server on which you are setting up aperture!

listenaddr: "lnc.yourlightning.app:443"
debuglevel: "trace"
autocert: true
servername: lnc.yourlightning.app
authenticator:
  disable: true
hashmail:
  enabled: true
  messagerate: 1ms
  messageburstallowance: 99999999
prometheus:
  enabled: false

Run aperture

To run aperture, we only need to execute one command.

aperture

The logs may show that aperture is now listening for connections.

[INF] APER: Configuring autocert for server lnc.yourlightning.app with cache dir /root/.aperture/autocert [INF] APER: Starting the server, listening on lnc.yourlightning.app:443.

Connect to Terminal

We can now connect our LND node to Lightning Terminal using our own mailbox. You will need litd running alongside LND. Learn how to install litd here.

litcli sessions add --label="My own mailbox" --type admin --mailboxserveraddr lnc.yourlightningapp:443

Next we type the generated 10-word connection string into Lightning Terminal, together with the url and port number of our mailbox.

We can now connect, select and confirm a password and control our Lightning node remotely!

Troubleshooting

On some VPS providers, aperture fails to correctly bind to the address and port it listens on.

root@mailbox:~# aperture [INF] APER: Configuring autocert for server lnc.yourlightningapp.com with cache dir /home/ubuntu/.aperture/autocert [INF] APER: Starting the server, listening on lnc.yourlightningapp.com:443. [ERR] APER: Error while running aperture: listen tcp 172.81.180.188:443: bind: cannot assign requested address [INF] APER: Shutdown complete

Optional: Set up aperture with systemd

We navigate to the systemd directory and create a new service.

cd /etc/systemd/system sudo nano aperture.service

Here we may paste the following template

[Unit]
Description=LNC mailbox service

[Service]
User=ubuntu
WorkingDirectory=/home/ubuntu
ExecStart=/usr/local/bin/aperture
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

To reload the list of services

sudo systemctl daemon-reload

To start the aperture service

sudo systemctl start aperture.service

To check the status of the service

sudo systemctl status aperture.service

Last updated