Build your own LNbits app server
Scenarios of using your own bundle node with a separate LNbits machine
I saw many plebs running their bundle nodes (MyNode, Umbrel, Raspiblitz, Embassy etc).
Nothing against these software bundles!
But many of these plebs start discovering that with a simple node machine they can do also many other productive things with specialized apps like BTCPay Server, LNbits, LNDhub, Thunderhub, LN Address servers etc
Very good! This is the way you should use your node.
Considerations:
for more apps you add to your bundle, more complexity you add to your setup.
more apps on the same machine, require various updates, various configurations, various access.
redundancy - yes this is very important aspect.
If you decide to use your bundle node in a more public or commercial way and expose it to the public access and also offering services (like LNbits Bank), you will have a bigger responsibility for your users using your “bank”.
Do not ignore this aspect!
If you use your bundle node just to test, learn, develop apps, yes is just fine to use those apps as it is, over Tor, in a more private way and with limited access. In this case (testing/learning) you could use the LNbits ngrok extension, that converts a Tor onion address of your LNbits, into a ngrok clearnet address. Yes, it can’t be used with a specific domain, but for testing is more than enough.
So what I suggest you, is to think about this scenario:
You have a small business, and you decide to use LNbits for example (see here and here 2 scenarios I described for using LNbits). Ok all fine.
But you have a bundle node, behind Tor, limited access from public face, many problems accessing it, Tor is not connecting, you do not understand how these things works etc.
Some of you using MyNode that have LNbits as premium service, could not use it in the free version. MyNode also is not updating the latest LNbits version. Same with Umbrel, Citadel etc. you will always depend on their releases.
Also most of these bundles have specific deploy of the docker repositories, so if you are not so familiar with tinkering inside linux and docker, you better stay away.
What options do you have?
If you run a bundle node behind Tor, and you want to run also LNbits on the same machine, you will have to do some changes in your node machine.
Here is a guide to setup a Tor to IP tunnel for your LNbits node machine, but sometimes is not user friendly and will not understand all the technicalities of these setups and will just get frustrated.
Another way to use the same node machine, will be to use Tailscale. Here I wrote a guide about using your bundle node with Tailscale. But also in this case, you will have to configure a DNS name for that private IP that Tailscale is providing, in case you want to offer public access to your LNbits services.
Option A - your bundle node + separate LNbits
Just leave the node bundle as it is, with its LN node channels etc, basic stuff, don’t load it unnecessarily with shit load of apps that you do not use them.
Take a separate machine, could be whatever other 2nd hand laptop / PC, no need for super ultra computer. Install a Linux OS on it, whatever debian flavor I would say.
Then start installing LNbits as a regular app, following the install instructions and configure the env file to point to your local bundle node. It could be even in the same LAN, so no need for extra configurations over Tor or VPNs or whatever fancy stuff. So the communication between your node and LNbits will be ONLY through LAN. Secured and private. Nobody from outside could know about this connection.
Then configure your LNbits machine to be visible on internet FQDN (Full Qualify Domain Name). You will have to edit your domain DNS items to point a subdomain name to your public IP where you have located your LNbits machine, for example ln.mydomain.com or lnbits.mydomain.com or shop.mydomain.com.
Then configure your internet router to forward the port 443 (SSL, you will need this as face to the public) to the local IP of your LNbits machine. In linux also use ufw to open that port in local fiewall.
Get a valid certificate for that subdomain, you could use ZeroSSL or whatever other free SSL certificate, important is that your LNbits could respond securely through https.
To recap:
Create a subdomain entry in your DNS for that LNbits instance eg. lnbits.mydomain.com
Point your router to forward the port 443 to that local IP of your LNbits instance
Link your LNbits instance to your local LN node by local IP (no need through clearnet or Tor). You will need to add an entry in lnd.conf to listen for your node local IP. Then connect using the admin-macaroons for that node.
Configure Caddy on your LNbits machine to use the lnbits.mydomain.com. Caddy is creating all https certificates for you and also renew them.
Done, now your LNbits is accessible in public domain, using your own bundle node.
Now, why I was suggesting this scenario?
Remember when I said REDUNDANCY ?
Let’s say your bundle node have an issue, that is not related to your LNbits instance: channels forced closed, corrupted data, is not starting, is buggy or whatever serious issue that you cannot have a continuous service for your LNbits users.
Running your LNbits instance app on a separate machine, it takes exactly 30 seconds to go and edit the .env file where you put the funding node source (your local bundle node) and change it with whatever other LN node you have available as backup. It could be even a cloud node like Voltage, another bundle node you had prepared. As a LN Bank provider, you should be prepared for these cases, with immediate backup plans.
So with just changing the source, your LNbits is up and running. Keep in mind to have enough liquidity in the new node source, that can match at least the total balances of your LNbits accounts.
Option B - Your bundle node + VPS LNbits
Ok this one is a bit more advanced but is a very good option, if you want a business model with a strong hardware.
In this case you still use your own bundle home node, over Tor, but you will keep the LNbits instance on a remote VPS (Virtual Private Server) and access it through a secured VPN tunnel.
Here is a great guide made by Hakuna, step by step. No further instructions.
Also check these simple instructions with configuration file examples, by Massimo.
Another good guide by MobyCrypt - How to turn your self hosted RaspiBlitz node into a clearnet node ijn 10 min (where you can adapt the access only for LNbits instance if you want).
Same, as previous option, in case your bundle node is wrecked, you could just change the funding source in the LNbits configuration and will be up and running in minutes.
Option C - LNBits dedicated machine + bundle as backup
OK, this one I recommend it for those who want to have a more business solution, reliable and strong. It could be very easily a good machine (not Rpi) in your office/home, good hardware with battery backup UPS and good internet, but also could be a professional cloud VPS and you setup yourself.
I was explaining more about types of hardware for nodes in this guide.
So, let’s get started:
Install a Debian OS - as base operating system, simple, with GUI
Install Core Lightning node that also include Bitcoin Core daemon
Install Electrum server (which flavor you want EPS | Rust | Fulcrum)
Optional: RTL (RideThe Lightning), CLBoss and any other tools you need to manage your LN node channels and liquidity. Here is a full list of awesome apps you could use with your CLN node.
Install LNbits, here are the install instructions.
Optional, setup Tor service for your node access, or use it on clearnet, opening only specific necessary ports (for CLN, REST for Zeus, SSL for LNbits, Electrum port etc).
Setup your domain DNS entries specific for your LNbits and add a SSL certificate for that subdomain.
Done, open some LN channels and your LNbits Bank is ready for your “customers”!
You can still keep your old bundle node machine as a backup for this one, in case of SHTF and / or as another routing hub for your main LNbits node (as I described in this guide). You can do wonderful things between a public and a private LN node.
That’s it for the moment, I hope I gave you enough hints about how to run a Independent and Redundant LNbits Server.
Don’t complicate it too much, keep it simple. Separate your core node services from apps that can be migrated easily from one source to another.
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: