This application allows you to control your Lightning node or wallet over Nostr. Connect applications like Damus or Amethyst to your node.
Specification: NIP-47
- Alby (see: alby.go)
- LND (see: lnd.go)
- LNBITS (see lnbits.go, for now specific to this fork)
- want more? please open an issue.
The application has no runtime dependencies. (simple Go executable).
As data storage SQLite or PostgreSQL (recommended) can be used.
$ cp .env.example .env
# edit the config for your needs
vim .env
To get a new random Nostr key use openssl rand -hex 32
or similar.
go run .
or gow -e=go,mod,html,css run .
using gow
To build the CSS run:
npm install
npm run css
go test
NOSTR_PRIVKEY
: the private key of this service. Should be a securely randomly generated 32 byte hex string.CLIENT_NOSTR_PUBKEY
: if set, this service will only listen to events authored by this public key. You can set this to your own nostr public key.RELAY
: default: "wss://relay.getalby.com/v1"PUBLIC_RELAY
: optional relay URL to be used in connection strings ifRELAY
is an internal URLLN_BACKEND_TYPE
: ALBY or LNDALBY_CLIENT_SECRET
= Alby OAuth client secret (used with the Alby backend)ALBY_CLIENT_ID
= Alby OAuth client ID (used with the Alby backend)OAUTH_REDIRECT_URL
= OAuth redirect URL (e.g. http://localhost:8080/alby/callback) (used with the Alby backend)LND_ADDRESS
: the LND gRPC address, eg.localhost:10009
(used with the LND backend)LND_CERT_FILE
: the location where LND'stls.cert
file can be found (used with the LND backend)LND_MACAROON_FILE
: the location where LND'sadmin.macaroon
file can be found (used with the LND backend)COOKIE_SECRET
: a randomly generated secret string.DATABASE_URI
: a postgres connection string or sqlite filename. Default: nostr-wallet-connect.db (sqlite)PORT
: the port on which the app should listen on (default: 8080)
Clients can use a deeplink to allow the user to add a new connection. Depending on the client this URL has different query options:
The default option is that the NWC app creates a secret and the user uses the nostr wallet connect URL string to enable the client application.
name
: the name of the client app
Example:
/apps/new?name=myapp
If the client creates the secret the client only needs to share the public key of that secret for authorization. The user authorized that pubkey and no sensitivate data needs to be shared.
name
: the name of the client apppubkey
: the public key of the client's secret for the user to authorizereturn_to
: (optional) if areturn_to
URL is provided the user will be redirected to that URL after authorization. Thelud16
,relay
andpubkey
query parameters will be added to the URL.expires_at
(optional) connection cannot be used after this date. Unix timestamp in seconds.max_amount
(optional) maximum amount in sats that can be sent per renewal periodbudget_renewal
(optional) reset the budget at the end of the given budget renewal. Can benever
(default),daily
,weekly
,monthly
,yearly
request_methods
(optional) url encoded, space separated list of request types that you need permission for:pay_invoice
(default),get_balance
(see NIP47). For example:..&request_methods=pay_invoice%20get_balance
Example:
/apps/new?name=myapp&pubkey=47c5a21...&return_to=https://example.com
Web clients can open a new prompt popup to load the authorization page.
Once the user has authorized the app connection a nwc:success
message is sent to the opening page (using postMessage
) to indicate that the connection is authorized. See the initNWC()
function in the alby-js-sdk
Example:
import { webln } from "alby-js-sdk";
const nwc = new webln.NWC();
// initNWC opens a prompt with /apps/new?c=myapp&pubkey=xxxx
// the promise resolves once the user has authorized the connection (when the `nwc:success` message is received) and the popup is closed automatically
// the promise rejects if the user cancels by closing the prompt popup
await nwc.initNWC({name: 'myapp'});
If you need help contact support@getalby.com or reach out on Nostr: npub1getal6ykt05fsz5nqu4uld09nfj3y3qxmv8crys4aeut53unfvlqr80nfm You can also visit the chat of our Community on Telegram.
Want to support the work on Alby?
Support the Alby team ⚡️hello@getalby.com You can also contribute to our bounty program: ⚡️bounties@getalby.com
✅ NIP-47 info event
❌ expiration
tag in requests
✅ get_info
✅ get_balance
✅ pay_invoice
⚠️ amount not supported (for amountless invoices)
✅ pay_keysend
✅ make_invoice
✅ lookup_invoice
✅ list_transactions
⚠️ from and until in request not supported⚠️ failed payments will not be returned
❌ multi_pay_invoice
❌ multi_pay_keysend (TBC)
✅ get_info
⚠️ block_hash not supported⚠️ block_height not supported⚠️ pubkey not supported⚠️ color not supported⚠️ network is alwaysmainnet
✅ get_balance
✅ pay_invoice
⚠️ amount not supported (for amountless invoices)
✅ pay_keysend
⚠️ preimage in request not supported
✅ make_invoice
⚠️ expiry in request not supported
✅ lookup_invoice
⚠️ fees_paid in response not supported
✅ list_transactions
⚠️ offset and unpaid in request not supported⚠️ fees_paid in response not supported⚠️ unsettled and failed transactions will not be returned
❌ multi_pay_invoice
❌ multi_pay_keysend (TBC)