• Stars
    star
    148
  • Rank 249,983 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Your friendly Bitcoin Lightning ⚡ payment page ⚡





LnMe - your friendly payment page



LnMe is a personal Bitcoin Lightning payment page/widget and self-hosted Lightning Address server.

demo

See it in action: ln.michaelbumann.com - my lightning address: [email protected]

LnMe focusses on simplicity and ease of deployment. It connects to an existing lightning node (currently LND is supported).

LnMe is one simple executable file that can be deployed anywhere with no dependencies. (on your own node or for example with one click on Heroku)

Features

Installation

LnMe connects to your LND node, 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
  2. Run lnme
  3. Done.

Build from source

  1. $ git clone https://github.com/bumi/lnme.git && cd lnme
  2. $ go install
  3. $ go build
  4. $ ./lnme

Running in Docker

LnMe is now available in docker too. You can start LnMe like this: docker run -it --rm ghcr.io/bumi/lnme:master A list of existing tags is available here.

Configuration

LND configuration

To connect to the lnd node the cert, macaroon and address of the lnd node has to be configured. LnMe uses the LND defaults.

  • lnd-address: Host and port of the LND gRPC service. default: localhost:10009
  • lnd-cert-path: Path to the LND TLS cert file. default: ~/.lnd/tls.cert
  • lnd-macaroon-path: Path to the LND macaroon file. default: ~/.lnd/data/chain/bitcoin/mainnet/invoice.macaroon (invoice.macaroon is recommended)

Instead of the path to the macaroon and cert files you can also provide the hex strings:

  • lnd-cert: LND TLS cert as HEX string.
  • lnd-macaroon: LND macaroon HEX string. (invoice.macaroon is recommended)

Other configuration

  • static-path: Path to a folder that you want to serve with LnMe (e.g. /home/bitcoin/lnme/website). Use this if you want to customize your website. default: disabled
  • lnurlp-comment-allowed: Allowed length of LNURL-pay comments, maximum around ~2000 characters. (default: 210)
  • disable-website: Disable the default LnMe website. Disable the website if you only want to embed the LnMe widget on your existing website.
  • disable-cors: Disable CORS headers. (default: false)
  • disable-ln-address: Disable Lightning Address handling.
  • port: Port to listen on. (default: 1323)
  • listen: IP and port to listen to. Supersedes port. (default: :1323).
  • request-limit: Limit the allowed requests per second. (default: 5)

Depending on your deployment needs LnMe can be configured using the following options:

  1. Command line flags
  2. Environment variables
  3. Config TOML file

Examples:

Command line flags:
$ lnme --help
$ lnme --lnd-address=lndhost.com:10009 --port=4711
$ lnme --disable-website
TOML config file

See config.toml.example for an example file.

$ lnme --config=/path/to/config.toml
Environment variables

All environment variables must be prefixed by LNME_ use _ instead of -

$ LNME_LND_ADDRESS=127.0.0.1:10005 lnme

LND Permissions

LnMe needs the following LND permissions:

  • Read/Write permission for invoices
  • Write permission for address (if you want to use the onchain option)

Use the LND macaroon bakery to create a new macaroon for LnMe.

To get the HEX versions of the files use xxd -plain e.g. xxd -plain invoice.macaroon | tr -d '\n'

TOR

LnMe can connect to your lightning node through Tor. 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

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.

If you run LNMe on a different server you will need your LND address, the LND TLS certificate (HEX) and the macaroon (HEX). (see above)

When getting the HEX of the LND files use xxd -plain YOUR_FILE.cert | tr -d '\n'. For example for the TLS certificate, use xxd -plain tls.cert | tr -d '\n'.

The TLS cert is located in the lnd directory:

  • ~/umbrel/lnd/tls.cert on Umbrel
  • /mnt/hdd/lnd/tls.cert on Raspiblitz
  • /embassy-data/package-data/volumes/lnd/data/main/tls.cert on Start9 Embassy
  • Can also be located in ~/.lnd

You should find the macaroon files in the LND data dir (e.g. ~.lnd/data/chain/bitcoin/mainnet/) or see "LND Permissions" how to create a new one.

Heroku

One click deployment with Heroku:

Deploy on Heroku

Here is a Video Demo of the Heroku deployment

In order to run Tor on Heroku, the Heroku deployment includes a non-official buildpack: https://github.com/iamashks/heroku-buildpack-tor-proxy This buildpack can be disabled and removed if not needed or desired, through the Settings tab on the Heroku dashboard, or by editing app.json and removing the buildpack.

Lastly, using the Heroku deployment, you can link the app to your own domain by following the directions here: https://help.heroku.com/MTG1BIA7/how-do-i-connect-a-domain-to-my-heroku-app

Fly.io

0. Clone the repo

$ git clone https://github.com/bumi/lnme.git
$ cd lnme

1. Create a new app

$ flyctl launch --generate-name  // or set a custom app name: flyctl launch --name lnme-test-1

You will be asked a few things:

  • Copy the configuration to the new app
  • You do NOT need to create a Postgresql Database
  • Do NOT deploy it directly, we first need to set some configs

2. Set the configuration using environment variables:

The LND config variablse are required. Others are optional:

$ flyctl secrets set LNME_LND_ADDRESS="xxx.xxx.xxx.xxx:10009" LNME_LND_CERT=xxx LNME_LND_MACAROON=xxx
$ flyctl secrets set DISABLE_WEBSITE=1 // etc.

3. Launch the app:

$ flyctl deploy

4.Configure your domain

To configure a custom domain check the fly.io guides

Custom deployment notes

To run LnMe as systemd service have a look at the systemd service example config

I am running LnMe behind a reverse proxy using caddy which comes with fully-managed HTTPS via letsencrypt.

Example Caddyfile:

lnme.michaelbumann.com {
  reverse_proxy 127.0.0.1:1323
}

$ 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. Lightning Address builds on LNURL-pay LnMe handles the necessary requests for you.

For more information check out the website: lightningaddress.com

Your Lightning Address: {anything}@{your domain}

LNURL

if you got the Lightning Address enabled you also get a LNURL-pay URL:

https://{your domain}/lnurlp/{anything}

If you need an bech32 encoded version you can use this online tool: https://lnurl.fiatjaf.com/codec/

Customize your ⚡ website

LnMe comes with a default website but you can easily configure and build your own using the the LnMe JavaScript widget or JSON API.

Take a look at the embedded default website for an example and use the --static-path option to configure LnMe to serve your static file.

  1. Create a new folder (e.g. /home/satoshi/my-ln-page)
  2. Create your index.html
  3. Run lnme: `lnme --static-path=/home/satoshi/my-ln-page

Usage with 21 Payment Widgets

widgets.twentyuno.net is a beautiful embeddable payment widget for any existing website. You can use your LnMe instance with the widget by using your LnMe LNURL with the widget.

Use your bech32 encoded LNURL as Receiver in the widget configuration

JavaScript Widget integration

You can integrate the LnMe widget in your existing website.

1. Add the LnMe JavaScript files

<script
  data-lnme-base-url="https://your-lnme-host.com:1323"
  src="https://your-lnme-host.com/lnme/lnme.js"
></script>

2. Usage

To request a lightning payment simply call request() on a new LnMe({value: value, memo: memo}):

var lnme = new LnMe({ value: 1000, memo: "high5" });
lnme.request();

Use it from a plain HTML link:

<a
  href="#"
  onclick="javascript:new LnMe({ value: 1000, memo: 'high5' }).request();return false;"
  >Tip me</a
>
More advanced JS API:
let lnme = new LnMe({ value: 1000, memo: "high5" });

// get a new invoice and watch for a payment
// promise resolves if the invoice is settled
lnme.requestPayment().then((invoice) => {
  alert("YAY, thanks!");
});

// create a new invoice
lnme.addInvoice().then((invoice) => {
  console.log(invoice.PaymentRequest);
});

// periodically watch if an invoice is settled
lnme.watchPayment().then((invoice) => {
  alert("YAY, thanks!");
});

Motivation

I wanted a simple way for people to send Lightning payments using my own lightning node. BTCPay Server is too big and hard to run for that and I do not need most of its features.

Development

Use go run to run the service locally:

$ go run lnme.go --address=127.0.0.1:10009 --cert=/home/bitcoin/lightning/tls.cert --macaroon=/home/bitcoin/lightning/invoice.macaroon

Build

$ go build

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/bumi/lnme

Support

If you like this software and it is valuable for you, you can send sats to ⚡️[email protected]

License

Available as open source under the terms of the MIT License.

More Repositories

1

find_by_param

(deprecated) Find_by_param is a nice and easy way to handle permalinks and dealing with searching for to_param values
Ruby
30
star
2

webln-demo

CSS
27
star
3

lnrpc

a gRPC client for the Lightning Network Daemin (LND) packed as rubygem
Ruby
17
star
4

tokenizer

OLD, OLD Tokenizer allows you to create Mail.app like autocompletion fields - like facebook "compose message" "to" field
JavaScript
17
star
5

rack-lightning

Rack middleware to request lightning payments
Ruby
15
star
6

api-payments-example

Example server and client implementation showing how Bitcoin based API payments can be done
Java
13
star
7

listmonk-heroku

Heroku deploy button for listmonk
HTML
9
star
8

github-tagger

Do you miss tagging github repositories? I do. So I've developed a github tagger user script.
JavaScript
8
star
9

validation_rage

Ruby
7
star
10

ubiquity-commands

remember? https://wiki.mozilla.org/Labs/Ubiquity Railslove Ubiquity Commands
JavaScript
7
star
11

chainbook.bit

A namecoin and remote storage based social network.
JavaScript
5
star
12

campaignmonitor

Simple CampaignMonitor.com class to add/remove subscribers to/from subscriber lists
Ruby
5
star
13

lnurl-ruby

LNURL tools for Ruby
Ruby
5
star
14

stacking-sats-binance

Stacking Sats with Binance and save yourself some Bitcoin
Go
5
star
15

resizer

Resizer helps you generate iPhoto like resizing effects
JavaScript
5
star
16

bip70-example

This is an example of a BIP70 Bitcoin payment protocol implementation (client/server)
Ruby
5
star
17

bundler-thankyou

bundle thankyou - a Bitcoin lightning based donation system for rubygems
Ruby
5
star
18

history-logger

DO NOT USE! - OLD! Easy (User)Action logging.
4
star
19

lnd-native-companion

JavaScript
4
star
20

awesome_bot_factory

laboratory equipment to create skills for your awersomebotfactory
Ruby
4
star
21

awesomebots_basic

some basic hackish bots for the awesomebotfactory
Ruby
4
star
22

blockstream_satellite

ruby gem for the Blockstream Satellite API
Ruby
4
star
23

openalias-web

Crypto-currency tipping websites for OpenAlias DNS entries
CSS
4
star
24

nestedutils

Some lovely utils to work with nested resources
Ruby
4
star
25

ln-markdown-to-pdf

An example for machine to machine payments using the bitcoin lightning network
Ruby
4
star
26

kredits-deployer

UI to deploy a new Kredits DAO
JavaScript
3
star
27

mailman

A little man who helps you getting emails from your imap account...
Ruby
3
star
28

serializefu

OLD DO NOT USE! - Adds to_json and to_xml methods to your ActiveRecord models
Ruby
3
star
29

httparty_sober

HTTParties sober. - APICache for httparty
Ruby
3
star
30

ongair

a ruby wrapper for the ongair API
Ruby
3
star
31

osx-cookbooks

OS X Chef Cookbooks
Ruby
3
star
32

dotfiles

my dotfiles
Shell
3
star
33

decent-organizations

A collection of resources for decent organizations
Ruby
3
star
34

luftpost

just an experment, ignore ;)
Ruby
2
star
35

gettext2db

replaces the default gettext methods to write your gettext keys into the DB. This allows easy translation of your app
Ruby
2
star
36

params_required

Rails plugin to validate if certain params are present.
2
star
37

travels

my travel log as git commits
HTML
2
star
38

area402-widget

JavaScript
2
star
39

actsaslove

ActsAsLove show your user some (rails)LOVE
Ruby
2
star
40

bundler-thankyou-legacy

simple donation system for ruby gems (and other package managers)
Java
2
star
41

lightning.ws-ruby

Example ruby client for the lightning.ws webservices
Ruby
2
star
42

lnd-php-rest

PHP helper to talk to the LND REST API
PHP
1
star
43

wekb-reminder

your friendly WEKB twitter reminder
Ruby
1
star
44

402-server-js

nothing to see here. just a tiny app to create an invoice and test a WebLN provider
EJS
1
star
45

dealbase_text

just an experment, ignore ;)
Ruby
1
star
46

eth-example

quick and dirty code minimal, home made code example for Ethereum development
HTML
1
star
47

snoop-recommends

JavaScript
1
star
48

sparkexample

Java
1
star
49

payme

HTML
1
star
50

presentations

HTML
1
star
51

phantomjs_driver

1
star
52

kitely-ruby

(prototype) API wrapper for the kite.ly API
Ruby
1
star
53

lnd-proxy

Local proxy for a remote LND node
JavaScript
1
star
54

mshauri

Questionnaire and Recommendations app currently providing information about software engineering best practices
Ruby
1
star