mirror of https://github.com/bumi/lntip
Merge branch 'master' into tor-support
* master: Provide LNURL metadata hash as description_hash in the lightning pr Update .lndonate Update .lndonate Create .lndonate Update README.md Update README.md Update README.md
This commit is contained in:
commit
2a4b943887
|
@ -0,0 +1 @@
|
|||
lnurlp://ln.michaelbumann.com/.well-known/lnurlp/bumi
|
12
README.md
12
README.md
|
@ -24,7 +24,7 @@ LnMe is one [simple executable](https://github.com/bumi/lnme/releases) file that
|
|||
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!
|
||||
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`
|
||||
|
@ -105,11 +105,11 @@ To get the HEX versions of the files use `xxd -plain` e.g. `xxd -plain invoice.m
|
|||
LnMe can connect to your lightning node through [Tor](https://www.torproject.org/). You need to have Tor installed on your system and then simply provide your LND `.onion` address (don't forget to specify the port).
|
||||
|
||||
|
||||
### 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).
|
||||
|
@ -118,7 +118,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)
|
||||
|
||||
|
@ -133,6 +133,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.
|
||||
|
|
|
@ -46,13 +46,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 {
|
||||
|
|
6
lnme.go
6
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,
|
||||
|
|
Loading…
Reference in New Issue