LNbits - The Swiss Army Knife of Infrastructure

5. LNbits

With the network services configured through LIT, in this chapter we configure LNbits, the infrastructure's funds management layer. We will see how to initialize the service, create wallets, manage extensions, and make backups.

LNbits is a wallet solution and account system that runs on top of an LND node, allowing us to segment funds and enable extended functionalities through extensions. It is the engine that processes transactions for the other services. It can be described as the Lightning Swiss Army knife. Learn more at the official LNbits website.

5.1 Initializing LNbits

The first thing we do is access the website configured in the NPM chapter: https://lnbits.cashu4community.xyz. Since it is the first time, a page will be shown that allows us to create the superuser account, which has maximum privileges. We only need to enter a username and password (twice).

Image 1: Creating superuser account in LNbits.

LNbits First Install
  1. We enter the username.
  2. We enter the account password twice. A password with at least 12 characters, combining uppercase, lowercase, and special characters is recommended.
  3. We press LOGIN to create the account.

Image 2: Login Page.

LNbits Login Page
  1. We enter the username created in the previous step.
  2. We do the same with the password.
  3. We click LOGIN.

After logging in, the LNbits settings page loads. We can navigate through different sections; this chapter will cover the most important ones.

Image 3: LNbits settings page.

LNbits Funding Page

5.1.1 Funding Settings (LNbits Lightning Backend)

Image 4: Settings Page (Funding).

LNbits Setting Funding Page
  1. Shows the total balance in LNbits accounts and the Node balance.
  2. The backend for LNbits in the infrastructure is Lightning Network Daemon (LND). This configuration is defined in the .env file located in the app-data/lnbits/ directory.

5.1.2 Payment Settings

Image 5: Settings Page (Payments).

LNbits Payment Page
  1. We select the fiat currencies that will be available in LNbits.
  2. We select the default currency that will display the value of sats in the account.
  3. We select the fee that will be charged for outgoing transactions (only if we want to obtain a small profit).
  4. If we assign a value to the transaction fee, we must add the ID of the wallet that will receive the fees. In the following steps we explain how to obtain the wallet ID.
  5. We disable fees for internal transactions.
Note: After making changes we must click SAVE and finally RESTART SERVER. If we do not, the changes will not be applied.

5.1.3 Extension Settings

From this page we can select the extensions that will load by default, both in administrative sections and in standard user (non-privileged) sections.

Image 6: Settings Page (Extensions).

LNbits Settings Extensions
  1. We select extensions for administrator users.
  2. We select extensions for the rest of the users.
Note: Only extensions that are enabled will appear here. To add other extensions, go to the Extensions section in the options menu on the left side of the page.

5.2 Creating a Wallet for Transaction Fees

When we log in to LNbits, a default wallet is created. We will rename it and use it to receive transaction fees.

Image 7: Renaming the default wallet.

LNbits Wallet Rename
  1. We select the wallet.
  2. We click on Wallet Config in the right panel.
  3. We change the wallet name to Service fees.
  4. We click the UPDATE NAME button.

This way we have changed the wallet name to identify its purpose.

Image 8: Getting the Service fees wallet ID.

LNbits Wallet ID
  1. We click on Node URL, API Key and API docs in the right panel.
  2. We copy the Wallet ID field.

Then we go to the Payment settings (section 5.1.2) and paste the wallet ID in the field from point 12.

5.3 LNbits Extensions

LNbits extensions are plugins that add specific functionalities. They allow everything from creating wallets with custom rules (limits, expiration) to integrating payment systems, e-commerce, tickets, games, crowdfunding, or mechanisms like LNURL. Being modular, we install only what we need without bloating the system.

Now we will see how to add and remove extensions.

Image 9: Extensions.

LNbits Extension Page
  1. We click on the extension view to list the available extensions.

By default, only a couple of extensions are available to users, so the rest must be installed. In the following step we explain how to install them.

Image 10: Selecting the extension to install.

LNbits Select Extension to Install
  1. We select the extension to install.

In the example we select the LndHub extension, very useful if we want to use wallets like BlueWallet or Zeus to manage funds, pay, and receive payments in our account.

Image 11: Selecting version to install.

LNbits Extension Select Version
  1. We expand the version list.
  2. We select the available one by clicking INSTALL.

After a few seconds, the extension will appear in the installed view.

Image 12: Installed extensions.

LNbits Installed Extensions

To start, we recommend installing the LNURLp, Withdraw Links, and LndHub extensions. Then we can go to the Extension settings and enable them for all users, as seen in section 5.1.3, point 15.

5.4 Other Options

In the main view we can find other options that give us broader control over what happens in our LNbits instance.

Image 13: Advanced Administration Options for the LNbits instance.

LNbits Advanced Options
  1. LNbits Settings.
  2. User and wallet administration.
  3. Real-time requests to the LNbits API.
  4. View of payments made, with useful information for searches.
  5. Extension administration.

5.5 Backing Up the LNbits Database and Configurations

LNbits allows performing a backup of the database, extensions, and logs from the web interface. If we want to do a manual backup, we go to settings and click DOWNLOAD DATABASE BACKUP as shown in the following image.

Image 14: Downloading the database backup from settings.

LNbits Download Database Backup
  1. We download the database.