Getting started with LNbits
A guide for new LNbits users / admins, on how to start and manage the LN node behind each LNbits instance.
This guide is dedicated to those who want to implement LNbits into their business but do not have experience with running a Lightning node behind LNbits.
At the end of the guide, you will find more documentation to study. This article is only meant to give you some “first guidance”. This is NOT the ultimate guide for your node liquidity, is just enough to put you, the new LN user on the right path. After reading this guide, you will have to do a lot of homework.
I will try to explain it in easy terms so it could be assimilated by any type of user, that is not so familiar with technical details and let alone running a LN node, but want to start using LNbits for various business and personal scenarios.
IMPORTANT ASPECT
LNbits is an accounting system on top of your LN node.
It is NOT a node management software!
Think of LNbits like a “wordpress modular framework” for your node. An easy to manage platform, based on extensions that you can combine for numerous use cases.
Think of LNbits as your own bank financial management software. Your node offers channels to pay through and LNbits extends you node to be able to run more than one lightning wallet your node comes with. These wallets to not necessarily need to belong to yourself. Let’s say you, as the LN node runner, already have enough channel liquidity and funds and now you want to offer some bitcoin banking services to your friends, family, own shop or other regular merchants.
You will offer a simple way to them to open a “banking account” on your node without having access to other wallets on your node and to all your node liquidity, but only their part. Your node (the bank) only acts as a transport provider for their payments (in/out).
NOTE: all funds that your “customers” deposit into their LNbits bank accounts on your node, will go straight into your node LN channels. That means YOU are actually the real owner of those funds. You will have a big responsibility for their funds. Don’t be evil and run away with the funds, don’t be evil and charge high fees. We want to fuck the fiat banksters, not to fuck each others (bitcoin users).
A - Node (bank) liquidity management
This is a very important part, where many new users are getting a bit lost, not knowing the basics on how the Lightning Network works and what is needed in order to provide good liquidity for inbound and outbound payments.
The learning curve is not easy, but also not that hard. With some patience and reading, anybody can do it. But please, do not start offering services with your LNbits bank to others before you prepared your LN node properly.
The most regular use cases for a node like this (LNBits merchant bank, regular users, specific backend for a web app), would need some pre-requisites for a smooth sailing:
enough inbound and outbound liquidity in your node’s LN channels
low fees to zero fees between your LNbits accounts
reliable hardware and setup, always online, fast connection, clearnet (preferred) and/or Tor (for those who want a different tunneled access, but keep in mind that Tor is really slow).
What is Inbound liquidity ? The capacity a LN node has to receive payments. Not just in total, but also for each payment.
What is Outbound liquidity? Means the total capacity your node is able to send.
Think about payments through your node like glasses of water that, filled with water, through a small or big straw or pipe. The glass (the recipient), is the LN channel, can at a time only transport a certain amount of water and your glass can in total not send more than you own in your glass.
I will not enter now in details, explaining how LN works. I wrote extensive guides on my substack and here I put together a list of LN resources to be studied, with documentations, tutorials, tools, links, services etc.
Preparing a LN node liquidity takes patience, time, studying and selecting good peers, especially if you will run it for commercial purpose. Here, I will give you some advice about how to get started, so your new LNbits can start receiving and sending sats, for all your additional accounts and users. You will find your own way to fine tune your node, once you learned more about liquidity management.
Let’s consider you have a brand new node ready, but no LN channels yet. In this moment your LNbits could not receive or send any payment outside your “bank”, into the wild LN (Lightning Network).
As main tool to check and study LN nodes peers, I recommend using Amboss explorer page, where you can learn about many details of a node, including your own.
Important aspects when looking for a good peer node / channel partner:
number of channels, more are better (node with only 5-10 channels will not provide you too much routes)
longevity, longer is better (states the commitment to provide a good service)
total capacity, bigger is better (indicates the total amount of sats that can route to / from your node)
size of channels, bigger is better (presumably a longer time until channels get dried and also shows the maximum size of a payment that can be routed)
do not consider your peer as a “facebook friend”. LN is not about friends but about good routing peers. So connecting to a node just because the owner is your friend will not help you or the network at all if that node does not have good routes itself. Yes, if your node is already a good positioned node and you want to help your noob friend to get started with a new node, could and should be an exception.
Notice the details on Amboss page, that gives you a deep understanding about how that node is managing its channels: channel size, base fee, rate fee, TimeLock etc.
These aspects are very important when it’s about time to choose your first peers.
a. Channel size
Don’t open small channels that are less than 3M sats. Stay however beneath of max 10-21M sats.
All depends on your usage per payment. I you are confident in using very big channels you can have also a 21M sats channel for example, but limit the amount of sats per single payment to 1M, using the min/max HTLC option, per channel. I wrote here an extensive guide about the result of using this method.
b. Total node capacity
Your node should be able to have enough capacity for all your “bank’s” customers.
In this screenshot from Thunderhub (node management app), you can see the total inbound and outbound capacity and also the max size of incoming and outgoing amounts per transaction.
It is recommended to keep this balanced, I mean to have almost the same capacity for receiving and also for sending. Any expansive drains into one direction could end up in failed payments.
It doesn’t really matter if a a channel is not perfectly balanced 50-50.
Your node LN channels, will look like this, after a while, one side that is your sats and the other side that represent your peer’s sats, always juggling back and forth while wallets on your node use it and payments from others are routed.
Also what will enter through one channel can possibly go out through another one, which in time in time will balance them overall.
Yes, in the beginning, it is good to start with balanced channels, so you can have and provide directly in and out payments. This can be achieved with circular rebalancing, using a swap service to move out sats from your LN channels back into your onchain address and use them again to open more channels. I will explain in the next chapter how that works.
c. Liquidity
A good strategy would be to open 2-3-4-5 channels with some good LSP (Liquidity Service Providers), to have good routes right from the start. Preferably those with wallet provider nodes where many other users are connected and that have good connections.
Examples: Blixt | WoS | Acinq | OBW | LNBig | Breez | Alby | Deezy
Then expand your connections with more Bitcoin companies nodes (services, exchanges, LSP, Rings of Fire etc). Amboss page is very good to find ones.
I could show you my personal list of good peers that I accumulated in time, but they might not be 100% suitable for your own needs and also in time these peers are changing their policies or even shut down their nodes. So please take it only as an example. Some of the nodes there maybe are not even online anymore.
Each node operator should keep his own list of peers, update them if possible and adjusted for own needs.
You open a first channel, let’s say of 10M sats with one of these peers. Then you use a swap service to move half of the sats (5M more or less) out of the channel. In this way you can re-use those sats to open the next channel and also get inbound liquidity. See the dedicated guide about submarine swaps I wrote here.
Repeat the process for the next 3-4 new channels and you will have a nice liquidity to start. By time you can expand your number of peers using the LightningNetworkPlus Satoshi Radio Rings of Fire or manually adding other selected nodes using specific tools to analyze your peers before you connect to them: LN Router, LN Node Insight, NodeMatch, others more.
d. Longevity
Try to keep your LN channels open as much as possible. Especially those ones that are showing more traffic. You will need to observe your node’s behavior almost every day if you want to provide good routes for your customers. Observe where and from where your node receives funds, where are most of the sats going to, try to find the best routes for those destinations.
If some other “young nodes” will connect to you but they do not do much traffic and also are mostly offline you should close those useless channels. The only generate garbage requests and load your node with useless timeouts. A good tool for this to observe is LNTop. I explained in this another guide some warnings.
In general a LN channel should be closed only in a few cases otherwise keep it online:
peer is mostly offline
peer is having really bad ping (response access time), most of Tor nodes have this
is a very small channel; anything below 3M is considered small
peer does not provide any traffic during a certain period (2-3 months)
peer had his node crashed and all channels need to be closed (they informed you)
OK, now you have a good node with good liquidity, you are more than ready to offer payment services to others. Let’s dive a bit into managing your LNbits server.
B. LNbits Bank Management
Installation procedure
First step: Where to install ? Own machine or hosted solution ?
As I explained in this dedicated guide, you can install it on your bundle node, but could as well install it standalone on ANY other regular PC machine.
My personal take on this aspect is to run a dedicated LN node machine (be it a home bundle, a VPS, a Voltage node in the cloud) and the LNbits instance on a separate machine. This makes both better manageable, more accessible and I can switch the funding source at any time.
Yes, is nice to have it “all-in-one” but what about your business depends too much on that LNbits instance and your LN node crashes? Having it on the same machine as your LN node could end-up in losses. But if you have both on separate machines, you can easily just change the funding source with another LN node and be ready to continue receiving or making payments immediately.
The installation manual is very simple and in 5-10 min you have a running LNbits. I would suggest to use the Caddy proxy, is very easy and fast to install and configure. With Caddy you connect your LNbits instance to a domain which could e.g. host your online-shop. Please note that this is essential if you want to offer banking services to others.
Setting up the funding sources are basically modifying few lines in the .env config file and done. Start the lnbits service and … happy lightning.
Regularly backup your LNbits database
If you respect your “bank’s” customers, you should make regular backups of your LNbits database. Is not hard to do it. Just a copy of the lnbits/data folder.
Soon, when the new admin extension will be ready and released, there will be more automatic and webUI options to do that backup/ restore.
This database contain ONLY: users wallet IDs and access, transaction history, balance, personal settings etc.
Keep in mind that, this database (an sqfile) is just like an excel file IT IS NOT a wallet, channel or xpub. So if you want to move the LNbits bank to another source of funding (another node in case of disaster) you can easily just point your LNbits instance to another LN node and done, the customer’s balances are there, but you’ve just switched to another “vault”, another liquidity transport provider.
If you want to move your LNbits instance into another server, you could also just copy paste that database and start LNbits again.
LNbits can run on top of various funding sources as described in the installation guide here. So even if you previously had it running with a LND node and want to switch to a CLN node for example a simple change in the .env file is enough and restart the LNbits service.
Open up your LNbits bank to clearnet access
Having a LNbits only behind Tor is NOT reliable. Yes, today everybody can start a bundle node like Umbrel, Citadel, myNode, Raspiblitz, Embassy etc that by default is running behind Tor. Yes, you can use one of those for your LNbits, that is already integrated, easy to start with one click.
But the fun part comes when your bank’s customers don’t know what Tor is and what it is mainly for. And also not all services and functionalities works well behind Tor. Let alone browser compatibility and connection.
So here, in this dedicated guide I wrote about several scenarios how you could build a LNbits app server and be accessible on clearnet (https, IP/domain). Please pay attention to all details and scenarios.
Explore the large number of LNbits extensions
Yes, LNbits already has almost 30 extensions, for all kind of applications, merchants use cases, swaps, offline use, music, split payments, hardware projects, home automation, woocommerce plugin for your regular online shop, just waiting for you to try them and mix them to your needs.
Even if you do not find the right extension for your use case scenario, drop a question into the LNbits Telegram group and the “LNbits gurus” will help you out.
Read more LNbits documentation
Here is a list with more links about LNbits, use case scenarios, examples, documentation, for you to read and inspire you for your own use cases and scenarios:
LNbits webpage | Github page
LNbits Telegram group
LNbits installation guide
LNbits Youtube video tutorials
Powered by LNbits - collection of projects using LNbits
Awesome LNbits - collection of all info about LNbits
Lightning Network resources - TO READ MORE AND LEARN
“Lightning Node Operator” is the most important job title of this decade
Operating with LN as a merchant - advanced guide
NOTE: If you consider that this guide is not enough explained, please send me your questions / suggestions on how to improve it or even write another one for a specific case.
If you read this guide, but your knowledge level is not so technical (is understandable) please share this article with your “Uncle Jim” friend that is more tech savy and can help you setting up your own LNbits or who even can run it for you.
MAY THE ₿ITCOIN BE WITH YOU!
If you appreciate DarthCoin work, you can send some satoshis to darthcoin@getalby.com or darthcoin@stacker.news or darthcoin.blink.sv
or using Cashu Address darthcoin@minibits.cash
If you do not want to subscribe on substack, all DarthCoin Bitcoin guides are also announced on this dedicated Telegram Channel, for easy search and keep track.
To subscribe on substack, click here: