Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
shocknet-justin committed Apr 29, 2024
1 parent 5f65a74 commit c73ca22
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 49 deletions.
36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@

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

"Pub" is a `nostr` native account system that makes connecting your node to apps and websites super easy.
"Pub" is a `nostr` native account system, the goal of the project is to make running Lightning infrastructure for your friends/family/customers easier than previously thought possible.

Using Nostr relays as transport for encrypted RPCs, Pub eliminates the complexity of WebServer and SSL configurations.
It may come as a surprise that the biggest hurdle to more Uncle Jim's nodes hasn't been with Bitcoin/Lightning node management itself, that's easily automated as illustrated by bad patterns, like mobile nodes and unreliable Tor connections.

By solving the networking and programability hurdles, Pub enables node-runners and Uncle Jim's to bring their Friends, Family and Customers into Bitcoin's permissionless circular economy. All while keeping the Lightning Network decentralized, and custodial scaling free of fiat shitcoin rails and large banks.
It's the legacy baggage of traditional web infrastructure, things like IP4, reverse proxies, DNS, Firewalls and SSL certificates, all which require a personal configuration that is a hurdle for most.

Pub solves these challenges with a [Nostr](https://nostr.info/)-native RPC. Being Nostr-native eliminates the complexity of legacy server configuration using completely commoditized and trustless Nostr relays. Additionally, some optional services are integrated for backward compatibility with LNURL and Lightning Address.

By solving the networking and programability hurdles, Pub enables node-runners and Uncle Jim's to bring their personal network into Bitcoin's permissionless circular economy. All while keeping the Lightning Network decentralized, and custodial scaling free of fiat rails, large banks, and other forms of high-time preference shitcoinery.

#### Features:

Expand All @@ -27,32 +31,40 @@ By solving the networking and programability hurdles, Pub enables node-runners a
- [ ] Management Dashboard is being integrated into [ShockWallet](https://github.com/shocknet/wallet2)
- [ ] Nostr native "offers"
- [ ] Channel Automation
- [ ] Bootstarp Peering (Passive "LSP")
- [ ] Bootstrap Peering (Passive "LSP")
- [ ] Subscriptions / Notifications
- [ ] Submarine Swaps
- [ ] High-Availabilty / Clustering

Dashboard:
Dashboard Wireframe:

<img src="https://shockwallet.b-cdn.net/pub_home_ss.png" alt="Pub Dashboard" width="240">

#### ShockWallet and Lightning.Pub are free software. If you would like to see continued development, please show your [support](https://github.com/sponsors/shocknet) :)


> **WARNING:** While this software has been used in production for many months, it is still bleeding edge and security or reliabilty is not guaranteed.
> **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

## Automatic Installation

Coming Soon

## Manual Installation

#### Notes:
* The service defaults to port `8080`
* Use of a reverse proxy is only required if you wish to serve LNURLs
* The service defaults to port `8080`
* Requires [Node.js](https://nodejs.org) >=18.x

#### Steps:
1) Run [LND](https://github.com/lightningnetwork/lnd/releases) - *Example mainnet startup*:

```
./lnd --bitcoin.active --bitcoin.mainnet --bitcoin.node=neutrino --neutrino.connect=neutrino.shock.network --routing.assumechanvalid --accept-keysend --allow-circular-route --feeurl=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json
./lnd --bitcoin.active --bitcoin.mainnet --bitcoin.node=neutrino --neutrino.connect=neutrino.shock.network --accept-keysend --allow-circular-route --feeurl=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json
```


Expand All @@ -65,18 +77,16 @@ cd Lightning.Pub && npm i

3) `cp env.example .env`

4) Add values to env file
4) Configure values to env file as desired

5) `npm start`

6) Create an Application Pool

A default "wallet" pool will be automatically created and keys generated automatically, if you wish to create something other:
A default "wallet" pool will be automatically created, if you wish to create something other:

```
curl -XPOST -H 'Authorization: Bearer defined_in_constants.ts' -H "Content-type: application/json" -d '{"name":"ExampleApplicationPoolName"}' 'http://localhost:8080/api/admin/app/add'
```

7) Connect with [wallet2](https://github.com/shocknet/wallet2) using the npub response in step 6 or the the wallet application nprofile logged at startup.
7) Connect with [wallet2](https://github.com/shocknet/wallet2) using the wallet nprofile that was logged at startup.


102 changes: 66 additions & 36 deletions env.example
Original file line number Diff line number Diff line change
@@ -1,52 +1,82 @@
#LND
LND_ADDRESS=127.0.0.1:10009
LND_CERT_PATH=/root/.lnd/tls.cert
LND_MACAROON_PATH=/root/.lnd/data/chain/bitcoin/mainnet/admin.macaroon
# Example configuration for Lightning.Pub
# Copy this file as .env in the Pub folder and uncomment the desired settings to override defaults
# Alternatively, these settings can be passed as environment variables at startup

#LND_CONNECTION
# Defaults typical for straight Linux
# Containers, Mac and Windows may need more detailed paths
#LND_ADDRESS=127.0.0.1:10009
#LND_CERT_PATH=~/.lnd/tls.cert
#LND_MACAROON_PATH=~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon

#DB
DATABASE_FILE=db.sqlite
METRICS_DATABASE_FILE=metrics.sqlite
#DATABASE_FILE=db.sqlite
#METRICS_DATABASE_FILE=metrics.sqlite

#LOCAL
ADMIN_TOKEN=
PORT=8080
JWT_SECRET=bigsecrethere
#LOCALHOST
#ADMIN_TOKEN=
#PORT=8080
#JWT_SECRET=

#LIGHTNING
OUTBOUND_MAX_FEE_BPS=60
OUTBOUND_MAX_FEE_EXTRA_SATS=100
# Maximum amount in network fees passed to LND when it pays an external invoice
# BPS are basis points, 100 BPS = 1%
#OUTBOUND_MAX_FEE_BPS=60
#OUTBOUND_MAX_FEE_EXTRA_SATS=100

#ROOT_FEES
INCOMING_CHAIN_FEE_ROOT_BPS=0
INCOMING_INVOICE_FEE_ROOT_BPS=0
OUTGOING_CHAIN_FEE_ROOT_BPS=60 #applied to application debits
OUTGOING_INVOICE_FEE_ROOT_BPS=60 #applied to application debits
TX_FEE_INTERNAL_ROOT_BPS=60 #applied to inter-application txns
#ROOT_FEES
# Applied to either debits or credits and sent to an admin account
# BPS are basis points, 100 BPS = 1%
#INCOMING_CHAIN_FEE_ROOT_BPS=0
#INCOMING_INVOICE_FEE_ROOT_BPS=0
# Chain spends are currently unstable and thus disabled, do not use until further notice
#OUTGOING_CHAIN_FEE_ROOT_BPS=60
# Outgoing Invoice Fee must be >= Lightning Outbound Max Fee so admins don't incur losses on spends
#OUTGOING_INVOICE_FEE_ROOT_BPS=60
# Internal user fees bugged, do not use until further notice
#TX_FEE_INTERNAL_ROOT_BPS=0 #applied to inter-application txns

#APP_FEES
INCOMING_INVOICE_FEE_USER_BPS=0 #app default
OUTGOING_INVOICE_FEE_USER_BPS=60 #app default
TX_FEE_INTERNAL_USER_BPS=60 #intra-application tx default
# An extra fee applied at the app level and sent to the application owner
#INCOMING_INVOICE_FEE_USER_BPS=0
#OUTGOING_INVOICE_FEE_USER_BPS=0
#TX_FEE_INTERNAL_USER_BPS=0

#NOSTR
NOSTR_RELAYS=wss://strfry.shock.network
# Default relay may become rate-limited without a paid subscription
#NOSTR_RELAYS=wss://strfry.shock.network

#LNURL
#Note that a reachable https endpoint for the service to handle lnurl requests is required for lightning address bridges
SERVICE_URL=https://test.lightning.pub
# Optional
# If undefined, LNURLs (including Lightning Address) will be disabled
# To enable, add a reachable https endpoint for requests (or purchase a subscription)
# You also need an SSL reverse proxy from the domain to this local host
# Read more at https://docs.shock.network
#SERVICE_URL=https://yourdomainhere.xyz

#DEV
MOCK_LND=false
ALLOW_BALANCE_MIGRATION=false
MIGRATE_DB=false
#SUBSCRIPTION_SERVICES
# Opt-in to cloud relays for LNURL and Nostr
# A small monthly fee supports the developers
# Read more at https://docs.shock.network
#SUBSCRIBER=1

#METRICS
RECORD_PERFORMANCE=true
SKIP_SANITY_CHECK=false
DISABLE_EXTERNAL_PAYMENTS=false
#DEV_OPTS
#MOCK_LND=false
#ALLOW_BALANCE_MIGRATION=false
#MIGRATE_DB=false

# Max difference between users balance and LND balance since beginning of app execution
WATCHDOG_MAX_DIFF_SATS=10000
#METRICS
#RECORD_PERFORMANCE=true
#SKIP_SANITY_CHECK=false
# A read-only token that can be used with dashboard to view reports
#METRICS_TOKEN=
# Disable outbound payments aka honeypot mode
#DISABLE_EXTERNAL_PAYMENTS=false

# Max difference between users balance and LND balance after each payment
WATCHDOG_MAX_UPDATE_DIFF_SATS=1000
#WATCHDOG SECURITY
# A last line of defense against 0-day drainage attacks
# This will monitor LND separately and terminate sends if a balance discrepency is detected
# This setting defaults to 0 meaning no discrepency will be tolerated
# Increase this values to add a spending buffer for non-Pub services sharing LND
# Max difference between users balance and LND balance at Pub startup
#WATCHDOG_MAX_DIFF_SATS=0

0 comments on commit c73ca22

Please sign in to comment.