Lightning Donation Plugin Tutorial

A self hosted Lightning Network donation plugin has been released by Developer brndnhrbrt. The plugin allows users to quickly and safely host a Lightning invoice generator in QR Code or text format. It is based on Node.js and LND REST’s API.

The self hosted node app allows the user to quickly embed an image tag displaying the qrcode and an optional iframe to allow text copy via clipborad.

Quick setup guide

Requirements
  1. Your node must be running lighting with LND

  2. The node’s LND REST service must be enabled

  3. The app server must be able to connect to your node’s LND REST service

Installing and running the node.js app
git clone https://github.com/brndnhrbrt/ln-donate-node.git
cd ./ln-donate-node
npm install
// create config file (see sample config below)
npm start
Sample config file
module.exports = {
          macaroon: '<insert your macaroon in string format here>',
          lndHost: '<insert your LND ip here>:<insert your LND REST port here>',
          port: process.env.PORT || 3000,
          requestAmount: 100,
          minRequestAmount: 15,
          maxRequestAmount: 10000,
          memo: 'Thanks for donating!',
          errorImage: '<see config.sample.js>'
};
Getting the macaroon

You must copy and paste the output of this command into your config file

xxd -ps -u -c 1000 PATH_TO_MACAROON/admin.macaroon
Using the LN donation plugin
  • Serve as image:
// Preset amount
<img src="http://YOUR_URL/">
// Custom
<img src="http://YOUR_URL/ln/REQUEST_AMOUNT/MESSAGE">
  • Serve as text:
// Preset amount
<iframe src="http://YOUR_URL/ln/text" width="300" height="40" frameBorder="0">Browser not compatible.</iframe>
// Request 500 satoshi with memo 'Beer'
<iframe src="http://YOUR_URL/ln/text/500/Beer" width="300" height="40" frameBorder="0">Browser not compatible.</iframe>

Support us and the authors of this article by donating to the following address:

33PdFEe9hNczN1d8wFWbNvG1R8kGREWYKv

Comments powered by Talkyard.