Files
lnbits/docs/guide/wallets.md
T
27b9e8254c feat: NWC Funding source #2579 (#2631)
* feat: nwc funding source

* implement paid_invoices_stream, fix for unsettled invoices where settled_at is present but None

* cancel pending_payments_lookup_task on cleanup

* Rename subscription_timeout_task to timeout_task

* ensure preimage is not None

* Improve readability, return failed status on expiration in get_payment_status, ensure result_type is checked after error (some implementations might not set a result_type on error)

* fetch account info when possible

* workaround possible race condition on some nwc service providers, improve performance of fallback by using payment_hash from bolt11 invoice

* fundle

* make format

* fix formatting

* fix C901 `_on_message` is too complex (21 > 16)

* format

* fix lint

* format

* fix tests/wallets/test_nwc_wallets.py:80:11: C901 `run` is too complex (17 > 16)

* fix padding

* fix documentation for _verify_event method

* refactoring and fixes

* Split NWCWallet - NWCConnection

* refactor class methods into helpers

* update bundle

* format

* catch NWCError failure codes

* format and fix

* chore: bundle

* add example

* typos

---------

Co-authored-by: Riccardo Balbo <riccardo0blb@gmail.com>
Co-authored-by: benarc <ben@arc.wales>
Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
2024-08-07 09:56:53 +02:00

5.0 KiB

layout, title, nav_order
layout title nav_order
default Backend wallets 3

Backend wallets

LNbits can run on top of many Lightning Network funding sources with more being added regularly.

A backend wallet can be configured using the following LNbits environment variables:

CoreLightning

  • LNBITS_BACKEND_WALLET_CLASS: CoreLightningWallet
  • CORELIGHTNING_RPC: /file/path/lightning-rpc

CoreLightning REST

  • LNBITS_BACKEND_WALLET_CLASS: CoreLightningRestWallet
  • CORELIGHTNING_REST_URL: http://127.0.0.1:8185/
  • CORELIGHTNING_REST_MACAROON: /file/path/admin.macaroon or Base64/Hex
  • CORELIGHTNING_REST_CERT: /home/lightning/clnrest/tls.cert

Spark (Core Lightning)

LND (REST)

  • LNBITS_BACKEND_WALLET_CLASS: LndRestWallet
  • LND_REST_ENDPOINT: http://10.147.17.230:8080/
  • LND_REST_CERT: /file/path/tls.cert
  • LND_REST_MACAROON: /file/path/admin.macaroon or Base64/Hex

or

  • LND_REST_MACAROON_ENCRYPTED: eNcRyPtEdMaCaRoOn

LND (gRPC)

  • LNBITS_BACKEND_WALLET_CLASS: LndWallet
  • LND_GRPC_ENDPOINT: ip_address
  • LND_GRPC_PORT: port
  • LND_GRPC_CERT: /file/path/tls.cert
  • LND_GRPC_MACAROON: /file/path/admin.macaroon or Base64/Hex

You can also use an AES-encrypted macaroon (more info) instead by using

  • LND_GRPC_MACAROON_ENCRYPTED: eNcRyPtEdMaCaRoOn

To encrypt your macaroon, run poetry run python lnbits/wallets/macaroon/macaroon.py.

LNbits

  • LNBITS_BACKEND_WALLET_CLASS: LNbitsWallet
  • LNBITS_ENDPOINT: e.g. https://lnbits.com
  • LNBITS_KEY: lnbitsAdminKey

LNPay

For the invoice listener to work you have a publicly accessible URL in your LNbits and must set up LNPay webhooks pointing to <your LNbits host>/wallet/webhook with the "Wallet Receive" event and no secret. For example, https://mylnbits/wallet/webhook will be the Endpoint Url that gets notified about the payment.

  • LNBITS_BACKEND_WALLET_CLASS: LNPayWallet
  • LNPAY_API_ENDPOINT: https://api.lnpay.co/v1/
  • LNPAY_API_KEY: sak_apiKey
  • LNPAY_WALLET_KEY: waka_apiKey

OpenNode

For the invoice to work you must have a publicly accessible URL in your LNbits. No manual webhook setting is necessary.

  • LNBITS_BACKEND_WALLET_CLASS: OpenNodeWallet
  • OPENNODE_API_ENDPOINT: https://api.opennode.com/
  • OPENNODE_KEY: opennodeAdminApiKey

For the invoice to work you must have a publicly accessible URL in your LNbits. No manual webhook setting is necessary. You can generate a Blink API key after logging in or creating a new Blink account at: https://dashboard.blink.sv. For more info visit: https://dev.blink.sv/api/auth#create-an-api-key```

  • LNBITS_BACKEND_WALLET_CLASS: BlinkWallet
  • BLINK_API_ENDPOINT: https://api.blink.sv/graphql
  • BLINK_WS_ENDPOINT: wss://ws.blink.sv/graphql
  • BLINK_TOKEN: BlinkToken

Alby

For the invoice to work you must have a publicly accessible URL in your LNbits. No manual webhook setting is necessary. You can generate an alby access token here: https://getalby.com/developer/access_tokens/new

  • LNBITS_BACKEND_WALLET_CLASS: AlbyWallet
  • ALBY_API_ENDPOINT: https://api.getalby.com/
  • ALBY_ACCESS_TOKEN: AlbyAccessToken

ZBD

For the invoice to work you must have a publicly accessible URL in your LNbits. No manual webhook setting is necessary. You can generate an ZBD API Key here: https://zbd.dev/docs/dashboard/projects/api

Phoenixd

For the invoice to work you must have a publicly accessible URL in your LNbits. You can get a phoenixd API key from the install ~/.phoenix/phoenix.conf, also see the documentation for phoenixd.

  • LNBITS_BACKEND_WALLET_CLASS: PhoenixdWallet
  • PHOENIXD_API_ENDPOINT: http://localhost:9740/
  • PHOENIXD_API_PASSWORD: PhoenixdApiPassword

Breez SDK

A Greenlight invite code or Greenlight partner certificate/key can be used to register a new node with Greenlight. If the Greenlight node already exists, neither are required.

  • LNBITS_BACKEND_WALLET_CLASS: BreezSdkWallet
  • BREEZ_API_KEY: ...
  • BREEZ_GREENLIGHT_SEED: ...
  • BREEZ_GREENLIGHT_INVITE_CODE: ...
  • BREEZ_GREENLIGHT_DEVICE_KEY: /path/to/breezsdk/device.pem or Base64/Hex
  • BREEZ_GREENLIGHT_DEVICE_CERT: /path/to/breezsdk/device.crt or Base64/Hex

Cliche Wallet

  • CLICHE_ENDPOINT: ws://127.0.0.1:12000

Nostr Wallet Connect (NWC)

To use NWC as funding source in LNbits you'll need a pairing URL (also known as pairing secret) from a NWC service provider. You can find a list of providers here.

You can configure Nostr Wallet Connect in the admin ui or using the following environment variables:

  • LNBITS_BACKEND_WALLET_CLASS: NWCWallet
  • NWC_PAIRING_URL: nostr+walletconnect://...your...pairing...secret...