9

I'm trying to build a small website that takes payments using a lightning invoice. I want to do this without running a full node (or pruned node if possible) on my server to keep costs down. I'd be happy with any of three types of solutions:

  1. Install a custodial lightning wallet on my server with a CLI or REST API to generate and check the status of a lightning invoice. Electrum could work, but I didn't see invoice generation in the docs.
  2. I already run a full node on Umbrel, but I'm not sure how to securely expose lnd's http api to the internet.
  3. Use someone else's full bitcoin node to back lnd on my server, or use a custodial lightning wallet with an api.

I'm open to suggestions, I'm very new to the space and learning lots all the time.

Ongoing research:

  • lightning-charge uses c-lightning, which requires a full node.
  • FeatherLight looks like it would do what I want as a standalone service, but again, I'd have to host a full node.
  • LightningHub API Seems like it could work if I set up a BlueWallet.
  • LND Hub provides multiple users access to a single lnd instance.
1
  • I can suggest also the following tools github.com/clightning4j where you can run c-lightning on a machine of 30 $ for a month. This is a demo bruce.bublina.eu.org. The idea is to use the rest API with Nginx on docker so you can hide the API from the public, and talk with your website. A microservices architecture. P.S: it can support BOLT 12 Commented Sep 9, 2021 at 23:00

2 Answers 2

4

The approach I've ended up taking for this project is to expose my Umbrel's LND gRPC REST API.

My home network doesn't accept incoming requests, and I don't want that for my entire Umbrel anyway, so I'm using ngrok to proxy requests to LND. LND only accepts TLS connections, so bind_tls has to be true, and proto should be set to tls. Ngrok has its own tls setup, so it doesn't bother to check the validity of LND's self-signed cert, and so doesn't need the path to the certfile.

I'm also using a restrictive macaroon for authentication — this is essential for security, since if the admin macaroon were leaked you'd be up a creek. In my case, all I had to do was generate and check invoices; ./umbrel/bin/lncli bakemacaroon uri:/lnrpc.Lightning/AddInvoice uri:/lnrpc.Lightning/LookupInvoice was sufficient for that.

To make requests against my lightning node, all I have to do is something along the lines of curl -X POST https://my-app.ngrok.io/v1/invoices -H "Grpc-Metadata-macaroon: my-macaroon" -d '{"amount":1000,"memo":"my-memo"}'. This translates nicely to a python requests invocation from my application server.

2

I will try to explain my comment in an answer. There is no clear way to host a lite ln client only to revive payment and show it, without hosting an ln node on the server, with the bitcoin core backend. Maybe with lnd you can do some things (or rust-lightning), but I'm not an expert of both implementation.

However, I worked on this problem in the last months, because I was searching for some things to make my c-lightning node a little bit more lite. With c-lightning, there is the opportunity to run custom code inside it, and I override the bitcoin backend with a custom plugin called btcli4j that is able to run c-lightning with the pruning mode, and also with rest API compatible with esplora API by default it uses Blockstream API.

There are a couple of tools that I developed to run c-lightning in a lite way for business and all the code is under the repository clightning4j.

There is also a docker image that packs all together (include also a rest API documented with open API)

I think it is a really lite way solution because it can be run in raspberry with a default config (without 1TB of space). Off curse, the tools are under dev, but there is a open discussion where you can make a feature request.

A demo available here

Running over enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.