small_server_thingies/lnbits.md
2022-11-24 11:17:51 +01:00

2.9 KiB

LNBits

How to authorize a user

In the node, go to umbrel/apps/lnbits/docker-compose.yml and add the user in the env variable LNBITS_ALLOWED_USERS. This should be a string where each user is separated by a comma.

How to modify config of LNBits

Usually LNBits uses a .env file to be configured, but in Umbrel, you need to go to the file umbrel/apps/lnbits/docker-compose.yml and add whatever env var data you want to set up there. These are passed to LNBits on startup.

Can you transfer sats between the node and an LNBits account?

Yes, one way it's easy and the other way it's a hassle.

If you want to send money from the node to an LNBits account (or talking precisely, simply increase the balance of the LNBits account) you can:

  1. Create a regular invoice in the LNBits account.
  2. Pay that invoice from the node itself, like in Thunderhub.

Now, if you want to go the other way around (from LNBits to the node) this payment won't work. LNBits will complain that the self-payment is not allowed. The painful alternative is to edit manually the SQLite database of LNbits to make a charge on the LNBits account to lower its balance. The right database is in umbrel/app-data/lnbits/data/database.sqlite3. This must be done carefully to not corrupt it and break up LNBits. Do a backup first in case you fuck things up.

LNDHub

The LNDHub can only be done if the connection goes through HTTPS!!!! Connection through HTTP will fail.


NOTE: The notes below are from when I tried to run LNBits on a different machine than the Umbrel where LND was living. I gave up on that and instead simply used the VPS to redirect to the node with Tailscale + NGINX as a reverse proxy.

I want to setup an LNBits instance on Navaja that points to Banky. I want to run this on Docker.

According to the official docs, this is how you do it:

git clone https://github.com/lnbits/lnbits-legend.git
cd lnbits-legend
docker build -t lnbits-legend .
cp .env.example .env
mkdir data
docker run --detach --publish 5000:5000 --name lnbits-legend --volume ${PWD}/.env:/app/.env --volume ${PWD}/data/:/app/data lnbits-legend

I see this guide has some interesting bits on how to configure security and Nginx

Changes in the .env file

  • User control
    • Add only the desired users to LNBITS_ALLOWED_USERS
    • The users must be uuids in the format that LNBITS follow, no random stuff allowed.

Connecting to LND

  • Macaroon files are located in umbrel/lnd/data/chain/bitcoin/mainnet
  • The TLS cert is in umbrel/lnd/tls.cert
  • I placed both of those inside the data folder for lnbits and pointed to them from the .env file.
  • The default port for the rest api is 8080.
  • I was wondering if things would work with any macaroon with less privileges than the admin one, but I can't find any docs on that.

https://docs.lightning.engineering/lightning-network-tools/lnd/lnd.conf https://random.engen.priv.no/archives/574