Skip to content

Simple server for your personal Lightning Address

Notifications You must be signed in to change notification settings

mefatbear/lightning-address-nodejs

Repository files navigation

LND Lightning Address

A dead simple Lightning Address server for your personal Lightning Node!

This will allow your to receive lightning address payments. It's like an email address but for sats!

What you need

  • LND Server
  • Domain Name

Usage

Setup Environment Variables

  • Create a .env file
  • Find your LND REST Endpoint
  • Generate a Macaroon with Create Invoice permissions
  • Set your LND config. See .env.sample for example values
  • Set your domain name

Start Server

  • docker compose up

Config

Env Var Required Description
LNADDR_LND_REST_BASE_URL true Your LND REST URL e.g. https://xxxx.onion:8080 address
LNADDR_LND_REST_MACAROON_HEX true Create Invoice Macaroon
LNADDR_DOMAIN true Your domain name e.g. fatbear.me
LNADDR_NOTIFICATION_WEBHOOK false Webhook URL to receive notifications when invoices are created. e.g. https://hookb.in/xxxx

Endpoints

Endpoint Description
/ Basic welcome page
/healthz Health Check
/.well-known/lnurlp/:username Lightning Address

Deploy

Render

Deploy to Render

Deploy on Render free tier. You will need to configure you Custom Domain after it deploys.

Services on free plan are automatically spun down after 15 minutes of inactivity. When a new request for a free service comes in, Render spins it up again so it can process the request. This can cause a response delay of up to 30 seconds for the first request that comes in after a period of inactivity.

Fatbear Pro Tip: You could setup a cron job on your umbrel to curl the /healthz endpoint every ~15 minutes.

Umbrel

There are a few additional setups required for this to work on your Umbrel node. That is until Issue 1082 has been resolved.

STEPS:

  1. SSH to your umbrel server ssh [email protected] you will need your umbrel password
  2. Find your LND REST browser URL cat umbrel/tor/data/lnd-rest/hostname. It have a bunch of characters and end with .onion. Prepend https:// and append :8080 to this values to get LNADDR_LND_REST_BASE_URL env variable.
  3. Open your LND Config File vim umbrel/lnd/lnd.conf
  4. Under Application Options add an additional tlsextradomain line with your hostname from step 2.
  5. Restart your Umbrel. Can be done from your Umbrel's settings UI.

Your lnd.config should have two tlsextradomain lines. e.g.

tlsextradomain=umbrel.local
tlsextradomain=xxxxxx.onion

Create Invoice Macaroon

You will need a HEX encoded macaroon for the LNADDR_LND_REST_MACAROON_HEX env variable. I highly recommend generating a macaroon with only create invoice permissions. You can use Thunderhub to do this easily.

  1. Open Thunderhub
  2. Go to Tools in sidebar
  3. Bakery -> Bake Macaroon
  4. Give Create Invoice permissions
  5. Hit Bake new macaroon button.
  6. Copy the HEX encoded value