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.
- We enter the username.
- We enter the account password twice. A password with at least 12 characters, combining uppercase, lowercase, and special characters is recommended.
- We press
LOGINto create the account.
Image 2: Login Page.
- We enter the username created in the previous step.
- We do the same with the password.
- 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.
5.1.1 Funding Settings (LNbits Lightning Backend)
Image 4: Settings Page (Funding).
- Shows the total balance in LNbits accounts and the Node balance.
- 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).
- We select the fiat currencies that will be available in LNbits.
- We select the default currency that will display the value of sats in the account.
- We select the fee that will be charged for outgoing transactions (only if we want to obtain a small profit).
- 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.
- We disable fees for internal transactions.
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).
- We select extensions for administrator users.
- We select extensions for the rest of the users.
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.
- We select the wallet.
- We click on
Wallet Configin the right panel. - We change the wallet name to
Service fees. - We click the
UPDATE NAMEbutton.
This way we have changed the wallet name to identify its purpose.
Image 8: Getting the Service fees wallet ID.
- We click on
Node URL, API Key and API docsin the right panel. - We copy the
Wallet IDfield.
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.
- 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.
- 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.
- We expand the version list.
- We select the available one by clicking
INSTALL.
After a few seconds, the extension will appear in the installed view.
Image 12: 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 Settings.
- User and wallet administration.
- Real-time requests to the LNbits API.
- View of payments made, with useful information for searches.
- 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.
- We download the database.