Skip to content

shocknet/Lightning.Pub

Repository files navigation

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.

It may come as a surprise that the biggest hurdle to more Uncle Jim nodes hasn't been with Bitcoin/Lightning node management itself, as we've seen liquidity easily automated even in unreliable environments like mobile nodes.

It's the legacy baggage of traditional Client-Server web infrastructure, things like IP4, Reverse Proxies, DNS, Firewalls and SSL certificates, all of which 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. Bxlt12, being a re-implementation of Tor, appears destined for the same fate.

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 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.

Features:

  • Wrapper for LND that can serve accounts over LNURL and NOSTR
  • A growing number of methods
  • 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

  • A management dashboard is actively being integrated into ShockWallet
  • Nostr native "offers" (successor to LNURL-Pay, Lightning Address, Bxlt12)
  • Automated Channels
  • Bootstrap Peering (Passive "LSP")
  • Event Notifications
  • Swap integration
  • High-Availabilty / Clustering

Dashboard Wireframe:

Pub Dashboard

Important

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

License


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.

Umbrel Installation

Coming Soon

Desktop Installation

Coming Soon

Docker

docker pull ghcr.io/shocknet/lightning-pub:latest

Manual CLI Installation

Notes:

  • Use of a reverse proxy is only required if you wish to serve LNURLs
  • The service defaults to port 1776
  • Requires Node.js >=18.x
  • Commands for your specific OS may differ slightly, Ubuntu/Debian used for example

Steps:

  1. Run LND if you aren't already

Example mainnet startup:

./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

  2. Configure values to env file as desired

    • cp env.example .env && nano .env
  3. npm start

  • A default "wallet" application pool will be automatically created, if you wish to create other app pools:

    • curl -XPOST -H 'Authorization: Bearer defined_in_ADMIN_TOKEN_env' -H "Content-type: application/json" -d '{"name":"ExampleApplicationPoolName"}' 'http://localhost:8080/api/admin/app/add'
  1. Connect with wallet2 using the wallet nprofile that gets logged at startup.

Note

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