Giter Club home page Giter Club logo

go-host-lnaddr's Introduction

⚡🖥️👾 Host your own Lightning Address on LND

Lighting Wallets like https://github.com/ZeusLN/zeus, https://blixtwallet.github.io and many more allow us to send sats to Lighting Addresses like [email protected]. We can hence pay without scanning the QR code of an invoice.

Pre-requisites

  • An existing Domain name and static ip address to express the lighting address(e.g. [email protected])
  • A public Lightning Network node with sufficient inbound liquidity to receive payments to your lightning address.
  • Golang installation
  • A Webserver and reverse proxy like Nginx or Caddy. (example setup instructions here)
  • Certbot to serve http over TLS. This is required since calls to the LNURLP are done via https. (example setup instructions here)

Features

  • Implements the LN address protocol to receive lightning payments to an email-like address.
  • Can host multiple lightning addresses on the same server instance.
  • Notification support for payment receipts via email, telegram, http and more to come.
  • Nostr NIP 05 style account verification, see https://github.com/nostr-protocol/nips/blob/master/05.md

Install and Setup

Clone & Build

go install github.com/hieblmi/go-host-lnaddr@latest

Configuration config.json

  • RPCHost: Your lnd's REST endpoint e.g. "https://localhost:8080"
  • InvoiceMacaroonPath: "/path/to/invoice.macaroon"
  • TLSCertPath: "/home/user/.lnd/tls.cert",
  • LightningAddresses: [ Array of preferred lightning addresses hosted by the server. Mine is: [email protected] :-). This resolves to https://satswellspent.com/.well-known/lnurlp/thats ]
  • MinSendable: 1000,
  • MaxSendable: 100000000,
  • CommentAllowed: If set to 0 the sender can't add a comment otherwise the number stands for the permitted number of characters.
  • Tag: "payRequest",
  • Metadata: [["text/plain","Welcome to satswellspent.com"],["text/identifier","[email protected]"]],
  • Thumbnail: "/path/to/thumbnail.[jpeg|png]",
  • SuccessMessage: "Thank you!",
  • InvoiceCallback: "https://[YOUR_DOMAIN].com/invoice/" - this is the endpoint that will create the invoice
  • AddressServerPort: 9990 - the port your reverse proxy points to
  • Nostr: { "names": {...}, "relays": {...} } - See https://github.com/nostr-protocol/nips/blob/master/05.md#example for details.
  • Notificators: [ { "Type": "mail", "Target": "[email protected]", "MinAmount": 1000, "Params": { "From": "[email protected]", "SmtpServer": "smtp.satswellspent.com:587", "Login": "[email protected]", "Password": "somerandompassword" } } ]

Run

$GOBIN/go-host-lnaddr --config /path/to/config.json

Notes

This stuff is experimental. I appreciate your comments and if you have questions please raise an issue. I just recently setup my own address this way so feel free to send me some sats if you think this has been helpful to you.

[email protected]

go-host-lnaddr's People

Contributors

filiprogrammer avatar guggero avatar hieblmi avatar rkfg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

go-host-lnaddr's Issues

Nostr zap support

Would be nice to have it. It's not straightforward, just setting a flag in the resulting JSON isn't enough. The program needs to also be able to sign and push nostr events.

Since it's not directly related to lnaddr it can be hidden behind a conditional compilation tag but I don't have any strong opinions about it.

See also: https://github.com/nostr-protocol/nips/blob/master/57.md

Invoice subscription via r_hash fails

Hi @rkfg,

I recently ran into an issue that seems to be preventing the invoice subscription via the invoice r_hash you added.
This prevents the notification code from being triggered. This issue seemingly appeared without code changes from my end.
When /v2/invoices/subscribe is run the invoice subscription response indicates &{Status:404 Not Found StatusCode:404......

If you got a minute could you confirm if notifications are working for you? I could send you test payments to your lightningaddress.

License

Without a license using this code is technically not legal. I suggest adding a MIT license since that's what used in Bitcoin Core and lnd.

Payment notifications

It's currently hard to find if you've been paid. The only way is listing all paid invoices and look for those you don't remember creating yourself. A simple abstract notification interface with few implementations would be great to have (I might implement it myself if I find time). For example, it could be e-mail notification and http hook. I like how lightningtip does it. Shouldn't be hard to do.

Prevent invoice spam

Right now nothing prevents someone from calling the callback https://site.com/invoice?amount=1000 unreasonably often and spam the system. @rkfg Do you think it would make sense to add a spam protection here like a Timeout/IPFilter etc.?

RPC error on invoice creation

The following RPC error occurs when trying to create an invoice:

2023-12-31 00:13:54.242 [INF] LNADDR: Handling invoice creation: {GET /invoice/?amount=10000&nonce=179879833238 HTTP/1.1 1 1 map[Accept:[/] User-Agent:[curl/7.88.1]] {} 0 [] false 127.0.0.1:8081 map[] map[] map[] 127.0.0.1:43232 /invoice/?amount=10000&nonce=179879833238 0xc0002733c0}

2023-12-31 00:13:54.242 [INF] LNADDR: Cannot create invoice: rpc error: code = Unavailable desc = connection error: desc = "error reading server preface: http2: frame too large"

This issue is present since commit 01b5d1a

Tested with lnd v0.16.0-beta

Tiered payment notifications

It would be nice to have tiered payment confirmation messages (0-10, 10-100, 100-1000, 1000-10000 sats etc.) instead of the generic "thank you" as well as notification templates using Go's text/template.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.