From 8e93cdba3e62151f71f820c2c6cbf20784fcf65a Mon Sep 17 00:00:00 2001 From: "Justin (shocknet)" Date: Mon, 29 Apr 2024 12:07:47 -0400 Subject: [PATCH 1/8] docs --- README.md | 36 ++++++++++++------- env.example | 102 +++++++++++++++++++++++++++++++++------------------- 2 files changed, 89 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 1bbabcb7..475727a5 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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: Pub Dashboard #### 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 ``` @@ -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. diff --git a/env.example b/env.example index 4a709cd8..c3e6e57c 100644 --- a/env.example +++ b/env.example @@ -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 + +#DEV_OPTS +#MOCK_LND=false +#ALLOW_BALANCE_MIGRATION=false +#MIGRATE_DB=false #METRICS -RECORD_PERFORMANCE=true -SKIP_SANITY_CHECK=false -DISABLE_EXTERNAL_PAYMENTS=false +#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 since beginning of app execution -WATCHDOG_MAX_DIFF_SATS=10000 - -# Max difference between users balance and LND balance after each payment -WATCHDOG_MAX_UPDATE_DIFF_SATS=1000 \ No newline at end of file +#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 From 040dfdb839b17d5812f33e31e568ac1051b82d03 Mon Sep 17 00:00:00 2001 From: "Justin (shocknet)" Date: Mon, 29 Apr 2024 12:25:14 -0400 Subject: [PATCH 2/8] docs --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 475727a5..18e4025c 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,15 @@ ### Don't just run a Lightning Node, run a Lightning Pub. -"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. +"Pub" is a [Nostr](https://nostr.info/)-native account system, the goal of which is 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'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. +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. -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. +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. The slow and unreliable nature Tor as proven to be a dead-end. Bolt12 is a re-implementation of Tor that destined for the same fate. -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. +Pub solves these network challenges with a Full and Nostr-native RPC. Being Nostr-native eliminates the complexity of legacy server configuration by 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. +By solving the networking and programability hurdles, Pub's provides a 3rd Lightning Layer that enables node-runners and Uncle Jim's to more easily bring their personal network into Bitcoin's permissionless economy. Pub does so while keeping the Lightning Network decentralized, and custodial scaling free of fiat rails, large banks, and other forms of high-time preference shitcoinery. #### Features: @@ -28,9 +28,9 @@ By solving the networking and programability hurdles, Pub enables node-runners a ![Accounts](https://github.com/shocknet/Lightning.Pub/raw/master/accounting_layers.png) #### Planned -- [ ] Management Dashboard is being integrated into [ShockWallet](https://github.com/shocknet/wallet2) +- [ ] Management Dashboard is actively being integrated into [ShockWallet](https://github.com/shocknet/wallet2) - [ ] Nostr native "offers" -- [ ] Channel Automation +- [ ] Automated Channel Management - [ ] Bootstrap Peering (Passive "LSP") - [ ] Subscriptions / Notifications - [ ] Submarine Swaps @@ -53,7 +53,7 @@ Coming Soon Coming Soon -## Manual Installation +## Manual CLI Installation #### Notes: * Use of a reverse proxy is only required if you wish to serve LNURLs @@ -64,7 +64,7 @@ Coming Soon 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 --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.addpeer=neutrino.shock.network --feeurl=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json ``` @@ -81,7 +81,7 @@ cd Lightning.Pub && npm i 5) `npm start` -A default "wallet" pool will be automatically created, if you wish to create something other: +A default "wallet" application pool will be automatically created, if you wish to create other app pools: ``` curl -XPOST -H 'Authorization: Bearer defined_in_constants.ts' -H "Content-type: application/json" -d '{"name":"ExampleApplicationPoolName"}' 'http://localhost:8080/api/admin/app/add' From 98a1cfd2d739b4fe0f1c912d5105aa05a34b3845 Mon Sep 17 00:00:00 2001 From: "Justin (shocknet)" <34176400+shocknet-justin@users.noreply.github.com> Date: Mon, 29 Apr 2024 12:26:32 -0400 Subject: [PATCH 3/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 18e4025c..12ac8caf 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ 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. -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. The slow and unreliable nature Tor as proven to be a dead-end. Bolt12 is a re-implementation of Tor that destined for the same fate. +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. The slow and unreliable nature Tor as proven to be a dead-end. Bolt12 is a re-implementation of Tor that is destined for the same fate. Pub solves these network challenges with a Full and Nostr-native RPC. Being Nostr-native eliminates the complexity of legacy server configuration by using completely commoditized and trustless Nostr relays. Additionally, some optional services are integrated for backward compatibility with LNURL and Lightning Address. From 4ae2554e5bdfce66b4915ac7cb06544d8272004b Mon Sep 17 00:00:00 2001 From: "Justin (shocknet)" <34176400+shocknet-justin@users.noreply.github.com> Date: Mon, 29 Apr 2024 12:51:20 -0400 Subject: [PATCH 4/8] Update README.md --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 12ac8caf..8358090e 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,15 @@ ### Don't just run a Lightning Node, run a Lightning Pub. -"Pub" is a [Nostr](https://nostr.info/)-native account system, the goal of which is to make running Lightning infrastructure for your friends/family/customers easier than previously thought possible. +"Pub" is a [Nostr](https://nostr.info)-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's nodes hasn't been with Bitcoin/Lightning node management itself, that's easily automated as illustrated by bad patterns like mobile nodes. -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. The slow and unreliable nature Tor as proven to be a dead-end. Bolt12 is a re-implementation of Tor that is destined for the same fate. +It's the legacy baggage of traditional 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. The slow and unreliable nature of things like Tor have proven to be a dead-end. Bolt12 as a re-implementation of Tor is destined for the same fate. -Pub solves these network challenges with a Full and Nostr-native RPC. Being Nostr-native eliminates the complexity of legacy server configuration by using completely commoditized and trustless Nostr relays. Additionally, some optional services are integrated for backward compatibility with LNURL and Lightning Address. +Pub solves these network challenges with a Full RPC that is Nostr-native. Being Nostr-native eliminates the complexity of legacy server configuration by 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's provides a 3rd Lightning Layer that enables node-runners and Uncle Jim's to more easily bring their personal network into Bitcoin's permissionless economy. Pub does so while keeping the Lightning Network decentralized, and custodial scaling free of fiat rails, large banks, and other forms of high-time preference shitcoinery. +By solving the networking and programability hurdles, Pub's provide a 3rd Lightning Layer that enables node-runners and Uncle Jims to more easily bring their personal network into Bitcoin's permissionless economy. In doing so, Pub can keep the Lightning Network decentralized, with custodial scaling free of fiat rails, large banks, and other forms of high-time-preference shitcoinery. #### Features: @@ -49,7 +49,7 @@ Dashboard Wireframe: Coming Soon -## Automatic Installation +## Desktop Installation Coming Soon @@ -59,9 +59,12 @@ Coming Soon * 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 +* Commands for your specific OS may differe slightly, Ubuntu/Debian used for example #### Steps: -1) Run [LND](https://github.com/lightningnetwork/lnd/releases) - *Example mainnet startup*: +1) Run [LND](https://github.com/lightningnetwork/lnd/releases) 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 @@ -75,18 +78,15 @@ git clone https://github.com/shocknet/Lightning.Pub cd Lightning.Pub && npm i ``` -3) `cp env.example .env` - -4) Configure values to env file as desired +3) Configure values to env file as desired `cp env.example .env && nano .env` 5) `npm start` -A default "wallet" application pool will be automatically created, if you wish to create other app pools: +- 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'` -``` -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 wallet nprofile that was logged at startup. +6) Connect with [wallet2](https://github.com/shocknet/wallet2) using the wallet nprofile that gets logged at startup. +> Note that connecting with wallet will create an account on the node, it will not show or have access to the full LND balance From 0115f4b85a095b25ac2018d9fdce91010c9961db Mon Sep 17 00:00:00 2001 From: Mothana Date: Mon, 29 Apr 2024 21:32:56 +0400 Subject: [PATCH 5/8] service_url --- src/services/main/paymentManager.ts | 23 +++++++++++++++++++++++ src/services/main/settings.ts | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/services/main/paymentManager.ts b/src/services/main/paymentManager.ts index 7e629fb0..729b22a5 100644 --- a/src/services/main/paymentManager.ts +++ b/src/services/main/paymentManager.ts @@ -285,7 +285,21 @@ export default class { return `${this.settings.serviceUrl}/api/guest/lnurl_withdraw/info?k1=${k1}` } + isDefaultServiceUrl(): boolean { + if ( + this.settings.serviceUrl.includes("localhost") + || + this.settings.serviceUrl.includes("127.0.0.1") + ) { + return true + } + return false; + } + async GetLnurlWithdrawLink(ctx: Types.UserContext): Promise { + if(this.isDefaultServiceUrl()) { + throw new Error("Lnurl not enabled. Make sure to set SERVICE_URL env variable") + } const app = await this.storage.applicationStorage.GetApplication(ctx.app_id) const key = await this.storage.paymentStorage.AddUserEphemeralKey(ctx.user_id, 'balanceCheck', app) return { @@ -331,6 +345,9 @@ export default class { } async GetLnurlPayLink(ctx: Types.UserContext): Promise { + if(this.isDefaultServiceUrl()) { + throw new Error("Lnurl not enabled. Make sure to set SERVICE_URL env variable") + } getLogger({})("getting lnurl pay link") const app = await this.storage.applicationStorage.GetApplication(ctx.app_id) const key = await this.storage.paymentStorage.AddUserEphemeralKey(ctx.user_id, 'pay', app) @@ -343,6 +360,9 @@ export default class { } async GetLnurlPayInfoFromUser(userId: string, linkedApplication: Application, baseUrl?: string): Promise { + if(this.isDefaultServiceUrl()) { + throw new Error("Lnurl not enabled. Make sure to set SERVICE_URL env variable") + } const payK1 = await this.storage.paymentStorage.AddUserEphemeralKey(userId, 'pay', linkedApplication) const url = baseUrl ? baseUrl : `${this.settings.serviceUrl}/api/guest/lnurl_pay/handle` const { remote } = await this.lnd.ChannelBalance() @@ -358,6 +378,9 @@ export default class { } async GetLnurlPayInfo(payInfoK1: string): Promise { + if(this.isDefaultServiceUrl()) { + throw new Error("Lnurl not enabled. Make sure to set SERVICE_URL env variable") + } const key = await this.storage.paymentStorage.UseUserEphemeralKey(payInfoK1, 'pay', true) if (!key.linkedApplication) { throw new Error("invalid lnurl request") diff --git a/src/services/main/settings.ts b/src/services/main/settings.ts index e7164967..0a02d632 100644 --- a/src/services/main/settings.ts +++ b/src/services/main/settings.ts @@ -42,7 +42,7 @@ export const LoadMainSettingsFromEnv = (): MainSettings => { outgoingAppUserInvoiceFee: EnvMustBeInteger("OUTGOING_INVOICE_FEE_USER_BPS") / 10000, userToUserFee: EnvMustBeInteger("TX_FEE_INTERNAL_USER_BPS") / 10000, appToUserFee: EnvMustBeInteger("TX_FEE_INTERNAL_ROOT_BPS") / 10000, - serviceUrl: EnvMustBeNonEmptyString("SERVICE_URL"), + serviceUrl: process.env.SERVICE_URL || `http://localhost:${EnvMustBeInteger("PORT")}`, servicePort: EnvMustBeInteger("PORT"), recordPerformance: process.env.RECORD_PERFORMANCE === 'true' || false, skipSanityCheck: process.env.SKIP_SANITY_CHECK === 'true' || false, From 2083f4bebf897ead241a7b968b8281193915276e Mon Sep 17 00:00:00 2001 From: "Justin (shocknet)" <34176400+shocknet-justin@users.noreply.github.com> Date: Mon, 29 Apr 2024 14:15:43 -0400 Subject: [PATCH 6/8] Update env.example --- env.example | 3 +++ 1 file changed, 3 insertions(+) diff --git a/env.example b/env.example index c3e6e57c..9c01f0d9 100644 --- a/env.example +++ b/env.example @@ -23,6 +23,9 @@ # BPS are basis points, 100 BPS = 1% #OUTBOUND_MAX_FEE_BPS=60 #OUTBOUND_MAX_FEE_EXTRA_SATS=100 +# If the back-end doesn't have adequate channel capacity, buy one from an LSP +# Will execute when it costs less than 1% of balance and uses a trusted peer +#BOOTSTRAP=1 #ROOT_FEES # Applied to either debits or credits and sent to an admin account From 9e7b7194ff6c11fb891c23cd8d0d02df9d0dd6ec Mon Sep 17 00:00:00 2001 From: "Justin (shocknet)" <34176400+shocknet-justin@users.noreply.github.com> Date: Mon, 29 Apr 2024 22:48:27 -0400 Subject: [PATCH 7/8] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8358090e..eaa70d5e 100644 --- a/README.md +++ b/README.md @@ -42,8 +42,8 @@ Dashboard Wireframe: #### 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 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. +> [!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 @@ -59,7 +59,7 @@ Coming Soon * 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 -* Commands for your specific OS may differe slightly, Ubuntu/Debian used for example +* Commands for your specific OS may differ slightly, Ubuntu/Debian used for example #### Steps: 1) Run [LND](https://github.com/lightningnetwork/lnd/releases) if you aren't already @@ -80,13 +80,13 @@ cd Lightning.Pub && npm i 3) Configure values to env file as desired `cp env.example .env && nano .env` -5) `npm start` +4) `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'` -6) Connect with [wallet2](https://github.com/shocknet/wallet2) using the wallet nprofile that gets logged at startup. +5) Connect with [wallet2](https://github.com/shocknet/wallet2) using the wallet nprofile that gets logged at startup. > Note that connecting with wallet will create an account on the node, it will not show or have access to the full LND balance From a4905715db7ff88db52ceb9bc6a5328cd4a3541a Mon Sep 17 00:00:00 2001 From: "Justin (shocknet)" <34176400+shocknet-justin@users.noreply.github.com> Date: Mon, 29 Apr 2024 23:15:40 -0400 Subject: [PATCH 8/8] Update README.md --- README.md | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index eaa70d5e..c16dbbb8 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@ "Pub" is a [Nostr](https://nostr.info)-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's nodes hasn't been with Bitcoin/Lightning node management itself, that's easily automated as illustrated by bad patterns like mobile nodes. +It may come as a surprise that the biggest hurdle to more Uncle Jim nodes hasn't been with Bitcoin/Lightning node management itself, since even in bad patterns like mobile nodes, that is easily automated. -It's the legacy baggage of traditional 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. The slow and unreliable nature of things like Tor have proven to be a dead-end. Bolt12 as a re-implementation of Tor is destined for the same fate. +It's the legacy baggage of traditional 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. The slow and unreliable nature of things like Tor have proven to be dead-ends, and Bolt12 being a re-implementation of Tor is destined for the same fate. Pub solves these network challenges with a Full RPC that is Nostr-native. Being Nostr-native eliminates the complexity of legacy server configuration by using completely commoditized and trustless Nostr relays. Additionally, some optional services are integrated for backward compatibility with LNURL and Lightning Address. @@ -30,9 +30,9 @@ By solving the networking and programability hurdles, Pub's provide a 3rd Lightn #### Planned - [ ] Management Dashboard is actively being integrated into [ShockWallet](https://github.com/shocknet/wallet2) - [ ] Nostr native "offers" -- [ ] Automated Channel Management +- [ ] Automated Channels - [ ] Bootstrap Peering (Passive "LSP") -- [ ] Subscriptions / Notifications +- [ ] Event Notifications - [ ] Submarine Swaps - [ ] High-Availabilty / Clustering @@ -40,7 +40,8 @@ Dashboard Wireframe: Pub Dashboard -#### ShockWallet and Lightning.Pub are free software. If you would like to see continued development, please show your [support](https://github.com/sponsors/shocknet) :) +> [!IMPORTANT] +> 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 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**. @@ -73,20 +74,23 @@ Coming Soon 2) Download and Install Lightning.Pub -``` -git clone https://github.com/shocknet/Lightning.Pub -cd Lightning.Pub && npm i -``` -3) Configure values to env file as desired `cp env.example .env && nano .env` + * `git clone https://github.com/shocknet/Lightning.Pub` -4) `npm start` + * `cd Lightning.Pub && npm i` + + +3) Configure values to env file as desired + * `cp env.example .env && nano .env` + +5) `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'` + * `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'` 5) Connect with [wallet2](https://github.com/shocknet/wallet2) using the wallet nprofile that gets logged at startup. -> Note that connecting with wallet will create an account on the node, it will not show or have access to the full LND balance +> [!NOTE] +> Connecting with wallet will create an account on the node, it will not show or have access to the full LND balance