From d36f7a49f5ad0876ef845ad48fbe09dd5de5dd8d Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Mon, 30 Aug 2021 09:59:17 +0200 Subject: [PATCH 1/7] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 38a509a..c86dd49 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,22 @@ LnMe focusses on simplicity and ease of deployment. It connects to an existing l LnMe is one [simple executable](https://github.com/bumi/lnme/releases) file that can be deployed anywhere with no dependencies. (on your own node or for example with [one click on Heroku](#heroku)) +## Features + +- [x] Embeded payment page - customizable (see demo) +- [x] [Lightning Address](https://lightningaddress.com/) support +- [x] WebLN integration - if [WebLN](https://webln.dev/) is not available a QRcode and the invoice will be shown +- [x] [JavaScript widget](#javascript-widget-integration) for existing websites +- [x] [Invoice API](https://github.com/bumi/lnme/wiki/API) - simple REST API to create LN invoices from existing JS code +- [ ] [LNURL-pay](https://github.com/fiatjaf/lnurl-rfc/blob/luds/06.md) support ## Installation LnMe connects to your [LND node](https://github.com/lightningnetwork/lnd/blob/master/docs/INSTALL.md), so a running LND node is required. LnMe can easily run next to LND on the same system or any other hosting provider. +There are no other dependencies. Simply download the binary and run it! + 1. Download the latest [release](https://github.com/bumi/lnme/releases) 2. Run `lnme` 3. Done. From ced2d686308f9cf840beda92479226a6ba4fb360 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Mon, 30 Aug 2021 10:03:02 +0200 Subject: [PATCH 2/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c86dd49..527ee16 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ You will need your LND address, the LND tls certificate (HEX) and the macaroon ( Here is a [Video Demo of the Heroku deployment](https://www.youtube.com/watch?v=hSFXhnLp_Rc) -#### Notes +#### Deployment Notes To run LnMe as systemd service have a look at the [systemd service example config](https://github.com/bumi/lnme/blob/master/examples/lnme.service) From 9756507514b94726c2dabf1068e8d41a4511e49d Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Mon, 30 Aug 2021 10:04:59 +0200 Subject: [PATCH 3/7] Update README.md --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 527ee16..e25136e 100644 --- a/README.md +++ b/README.md @@ -101,11 +101,11 @@ Use the LND [macaroon bakery](http://macaroon-bakery.freedomnode.com/) to create To get the HEX versions of the files use `xxd -plain` e.g. `xxd -plain invoice.macaroon | tr -d '\n'` -### Deployment +## Deployment -It is the easiest to run LnMe on the same node as LND. But you can run it anywhere as long as your LND node is accessible. +It is the easiest to run LnMe on the same node as LND. But you can run it anywhere as long as your LND node is accessible. Simply run the binary and make sure the PORT is accessible. -#### Heroku +### Heroku One click deployment with Heroku: You will need your LND address, the LND tls certificate (HEX) and the macaroon (HEX). @@ -114,7 +114,7 @@ You will need your LND address, the LND tls certificate (HEX) and the macaroon ( Here is a [Video Demo of the Heroku deployment](https://www.youtube.com/watch?v=hSFXhnLp_Rc) -#### Deployment Notes +### Deployment Notes To run LnMe as systemd service have a look at the [systemd service example config](https://github.com/bumi/lnme/blob/master/examples/lnme.service) @@ -129,6 +129,8 @@ lnme.michaelbumann.com { `$ caddy --config /etc/caddy/Caddyfile` +## Feature Usage + ### Lightning Address The Lightning Address is an Internet Identifier that allows anyone to send you Bitcoin over the Lightning Network. From 1292e5498f63248c49b2e5bc7be7a5a175f5d918 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Thu, 2 Sep 2021 17:17:42 +0200 Subject: [PATCH 4/7] Create .lndonate --- .lndonate | 1 + 1 file changed, 1 insertion(+) create mode 100644 .lndonate diff --git a/.lndonate b/.lndonate new file mode 100644 index 0000000..306b1ef --- /dev/null +++ b/.lndonate @@ -0,0 +1 @@ +lnurlp=https://ln.michaelbumann.com/.well-known/lnurlp/bumi From 148dfcba22e292596ce61b6fb3d255ac5a0521d6 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Thu, 2 Sep 2021 17:19:38 +0200 Subject: [PATCH 5/7] Update .lndonate --- .lndonate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.lndonate b/.lndonate index 306b1ef..77d39f8 100644 --- a/.lndonate +++ b/.lndonate @@ -1 +1 @@ -lnurlp=https://ln.michaelbumann.com/.well-known/lnurlp/bumi +lnurlp://https://ln.michaelbumann.com/.well-known/lnurlp/bumi From 492ffb2d3fac54677dced3501ff374a662f92c8a Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Thu, 2 Sep 2021 17:20:20 +0200 Subject: [PATCH 6/7] Update .lndonate --- .lndonate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.lndonate b/.lndonate index 77d39f8..c7377e9 100644 --- a/.lndonate +++ b/.lndonate @@ -1 +1 @@ -lnurlp://https://ln.michaelbumann.com/.well-known/lnurlp/bumi +lnurlp://ln.michaelbumann.com/.well-known/lnurlp/bumi From 4fb8fa9a737a228310b1f8e1b10d605681cfed6b Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Fri, 3 Sep 2021 01:39:06 +0200 Subject: [PATCH 7/7] Provide LNURL metadata hash as description_hash in the lightning pr --- ln/lnd.go | 9 +++++---- lnme.go | 6 ++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ln/lnd.go b/ln/lnd.go index 0263d7a..6cd389d 100644 --- a/ln/lnd.go +++ b/ln/lnd.go @@ -43,13 +43,14 @@ type LNDclient struct { } // AddInvoice generates an invoice with the given price and memo. -func (c LNDclient) AddInvoice(value int64, memo string) (Invoice, error) { +func (c LNDclient) AddInvoice(value int64, memo string, descriptionHash []byte) (Invoice, error) { result := Invoice{} - stdOutLogger.Printf("Adding invoice: memo=%s value=%v ", memo, value) + stdOutLogger.Printf("Adding invoice: memo=%s value=%v", memo, value) invoice := lnrpc.Invoice{ - Memo: memo, - Value: value, + Memo: memo, + DescriptionHash: descriptionHash, + Value: value, } res, err := c.lndClient.AddInvoice(c.ctx, &invoice) if err != nil { diff --git a/lnme.go b/lnme.go index 4be8cf0..2910a0f 100644 --- a/lnme.go +++ b/lnme.go @@ -2,7 +2,6 @@ package main import ( "crypto/sha256" - "encoding/hex" "flag" "fmt" "log" @@ -110,7 +109,7 @@ func main() { return c.JSON(http.StatusBadRequest, "Bad request") } - invoice, err := lnClient.AddInvoice(i.Value, i.Memo) + invoice, err := lnClient.AddInvoice(i.Value, i.Memo, nil) if err != nil { stdOutLogger.Printf("Error creating invoice: %s", err) return c.JSON(http.StatusInternalServerError, "Error adding invoice") @@ -167,8 +166,7 @@ func main() { } sats := msats / 1000 // we need sats metadataHash := sha256.Sum256([]byte(lnurlMetadata)) - memo := hex.EncodeToString(metadataHash[:]) - invoice, err := lnClient.AddInvoice(sats, memo) + invoice, err := lnClient.AddInvoice(sats, lightningAddress, metadataHash[:]) lnurlPayResponse2 := lnurl.LNURLPayResponse2{ LNURLResponse: lnurl.LNURLResponse{Status: "OK"}, PR: invoice.PaymentRequest,