Skip to content

The Nostr Native Lightning node, share your node with nostr accounts and connect easily to webapps.

License

Notifications You must be signed in to change notification settings

shocknet/Lightning.Pub

Repository files navigation

Lightning.Pub

Lightning.Pub

GitHub last commit PRs Welcome Chat X (formerly Twitter) Follow

Don't just run a Lightning Node, run a Lightning Pub.

"Pub" is a Nostr-native account system designed to make running Lightning infrastructure for your friends/family/customers easier than previously thought possible.

Lightning payments open the door to a new internet, but because of UX challenges with sovereignty we've seen a much slower uptake than we should for something so amazing.

It may come as a surprise that the biggest hurdle to more adoption via Family and SMB Lightning nodes hasn't been with Bitcoin/Lightning node management itself, as we've seen that liquidity is easily automated, but rather the legacy baggage of traditional Client-Server web infrastructure. Things like IP4, Reverse Proxies, DNS, Firewalls and SSL certificates, all require a personal configuration that is a hurdle for most.

Tor as a workaround has proven too slow and unreliable, and a dead-end for clearnet-web usecases. Mobile node are easy but channels for every device is expensive and unscalable, and the UX that suffers from the limitations of the node not being an always-online server.

Pub solves these challenges with a P2P-like design that is also web-friendly, by implementing a full RPC that is Nostr-native. Being Nostr-native eliminates the complexity of configuring your node like a server by using commodity Nostr relays. These relays, unlike LNURL proxies, are trustless by nature of Nostr's own encryption spec (NIP44).

Additionally, support for optional services are integrated into Pub for operators seeking backward compatibility with legacy LNURLs and Lightning Addresses.

By solving the networking and programability hurdles, Pub provides Lightning with a 3rd Layer that enables node-runners, Busineses, and Uncle Jims to more easily bring their personal network into Bitcoin's permissionless economy. In doing so, Pub runners can keep the Lightning Network decentralized, with custodial scaling that is free of fiat rails, large banks, and other forms of high-time-preference shitcoinery.

Table of Contents

Features

  • Wrapper for LND that can serve accounts over LNURL and NOSTR
  • A growing number of methods
  • Automated Channels
    • Receives quotes from multiple LSPs including Zeus, Voltage, and Flashsats
  • Bootstrap Peering
    • A pub node may trust another pub node until it can afford a channel
  • Accounting SubLayers for Application Pools and Users
    • A fee regime allows applications owners to monetize users, or node operators to host distinctly monetized applications.

Accounts

  • Connecting via ShockWallet is as easy as pasting an nprofile
  • Or use a link to share your nprofile with friends and family

Connect Wallet Invite Guests

Planned Features

  • A management dashboard is actively being integrated into ShockWallet
  • NIP-69 Nostr native "offers"
  • P2P "LSP" coordination for channel batching over Nostr
  • Event Notifications
  • Swap integration
  • High-Availabilty / Clustering

Dashboard Wireframe:

Pub Dashboard

Installation

One-Line Deployment

Paste one-line and have a Pub node in under 2 minutes. It uses neutrino so you can run it on a $5 VPS or old laptop.

This method installs all dependencies and creates systemd entries. It has been tested only in Ubuntu/Debian x64 environments, but is general enough that it should work on any linux system with systemd.

Mac support is rough'd in, but completely untested. Help wanted.

To start, run the following command:

sudo wget -qO- https://deploy.lightning.pub | sudo bash

It should look like this in a minute or so

One-Line Deployment

Please report any issues to the issue tracker.

Automatic updates

These are controversial to push by default and we're leaning against it. You can however add the line to cron to run it periodically and it will handle updating.

Docker Installation

  1. Pull the Docker image:
docker pull ghcr.io/shocknet/lightning-pub:latest
  1. Run the Docker container:
docker run -d \
  --name lightning-pub \
  --network host \
  -p 1776:1776 \
  -p 1777:1777 \
  -v /path/to/local/data:/app/data \
  -v $HOME/.lnd:/root/.lnd \
  ghcr.io/shocknet/lightning-pub:latest

Network host is used so the service can reach a local LND via localhost. LND is assumed to be under the users home folder, update this location as needed.

Manual CLI Installation

  1. Run LND if you aren't already:
./lnd --bitcoin.active --bitcoin.mainnet --bitcoin.node=neutrino --neutrino.addpeer=neutrino.shock.network --feeurl=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json
  1. Download and Install Lightning.Pub:
git clone https://github.com/shocknet/Lightning.Pub && cd Lightning.Pub && npm i
  1. Configure values in the env file:
cp env.example .env && nano .env
  1. Start the service:
npm start

Usage Notes

Connect with wallet2 using the wallet admin string that gets logged at startup. The nprofile of the node can also be used to send invitation links to guests.

Note that connecting with wallet will create an account on the node, it will not show or have access to the full LND balance.

Additional docs are WIP at docs.shock.network

Support Development

Important

ShockWallet and Lightning.Pub are free software. If you would like to see continued development, please show your support 😊

License

Warning

Warning

While this software has been used in a high-profile production environment for over a year, it should still be considered bleeding edge. Special care has been taken to mitigate the risk of drainage attacks, which is a common risk to all Lightning API's. An integrated Watchdog service will terminate spends if it detects a discrepency between LND and the database, for this reason IT IS NOT RECOMMENDED TO USE PUB ALONGSIDE OTHER ACCOUNT SYSTEMS. While we give the utmost care and attention to security, the internet is an adversarial environment and SECURITY/RELIABILITY ARE NOT GUARANTEED- USE AT YOUR OWN RISK.