Guides and articles about Bitcoin and how to use it in practical use cases. Education is the key in this matter. Hyperbitcoinization will happen ONLY when more people know how to use Bitcoin and how to be a sovereign individual.
Accounting system
- Wallet owners who want to use LNbits as an interface for their funds management as well as its extra-features.
- Online and offline merchants or service providers who want to accept Bitcoin onchain and Lightning Network payments.
- Developers who want to build Lightning Network applications.
- Node operators who want to integrate their node with the LNbits system for accounting purposes.
- All of those have different needs. We build LNbits in a modular way so that every user can use our features in a way that suits you best.
Wallet manager
Demo platform
LNbits flyer
Some Basics
- LND Guide | Installing LND
- LND Config Example | LND Settings
- CLN Guide | Installing CLN
- LUDs LNURL Spec | NIPs Nostr Spec
- Run a watchtower | Very important!
- Getting Started with LNbits | Substack guide
- ToDos for your safety with LNbits | Youtube Video
- Private Banks on Lightning Network | Substack guide
- Run custodian wallets for your friends & family | Substack guide
- LNbits for a small restaurant / hotel | Substack guide
- Using LNbits Streamer copilot | Substack guide
- Start your NOSTR Market with LNbits | Substack guide
- Using LNbits for schools projects or festival events Substack guide
Install LNbits
Basic installation guide
- LNbits on clearnet by Axel
- LNbits on a VPS by Hannes
- LNbits on cloudflare by Leo
LNbits SaaS
Funding sources
LNBITS_BACKEND_WALLET_CLASS to your needed source if you set adminUI=TRUE in the .env.ls -a..env file or within your superuser account under Manage-Server section.
If you would like to use the .env version you can find the parameters here:CoreLightning
- CLN
LNBITS_BACKEND_WALLET_CLASS: CoreLightningWalletCORELIGHTNING_RPC: /file/path/lightning-rpc
- Spark (c-lightning)
LNBITS_BACKEND_WALLET_CLASS: SparkWalletSPARK_URL: http://10.147.17.230:9737/rpcSPARK_TOKEN: secret_access_key
Lightning Network Daemon
- LND (REST)
LNBITS_BACKEND_WALLET_CLASS: LndRestWalletLND_REST_ENDPOINT: http://10.147.17.230:8080/LND_REST_CERT: /file/path/tls.certLND_REST_MACAROON: /file/path/admin.macaroon or Bech64/HexLND_REST_MACAROON_ENCRYPTED: eNcRyPtEdMaCaRoOn
- LND (gRPC)
LNBITS_BACKEND_WALLET_CLASS: LndWalletLND_GRPC_ENDPOINT: ip_addressLND_GRPC_PORT: portLND_GRPC_CERT: /file/path/tls.certLND_GRPC_MACAROON: /file/path/admin.macaroon or Bech64/Hex You can also use an AES-encrypted macaroon (more info) instead by usingLND_GRPC_MACAROON_ENCRYPTED: eNcRyPtEdMaCaRoOn To encrypt your macaroon, run./venv/bin/python lnbits/wallets/macaroon/macaroon.py.
LNbits (another LNbits instance)
- LNbits instance hosted on a cloud server or your own home server
LNBITS_BACKEND_WALLET_CLASS: LNbitsWalletLNBITS_ENDPOINT: https://lnbits.mydomain.comLNBITS_KEY: my-lnbits-AdminKey
- LNbits Legend Demo Server (!! Do NOT use this one for production / commercial purposes, only for testing !!)
LNBITS_BACKEND_WALLET_CLASS: LNbitsWalletLNBITS_ENDPOINT: https://legend.lnbits.comLNBITS_KEY: legend-lnbits-AdminKey
Lightning TipBot
LNBITS_BACKEND_WALLET_CLASS: LnTipsWalletLNBITS_ENDPOINT: https://ln.tipsLNBITS_KEY: To get the Key you will need to run /api in a private chat with the LightningTipbot on Telegram once.
IBEX HUB
LNPay
<your LNbits host>/wallet/webhook with the "Wallet Receive" event and no secret given. The setting https://mylnbits/wallet/webhook will be the endpoint url that gets notified about any payment.LNBITS_BACKEND_WALLET_CLASS: LNPayWalletLNPAY_API_ENDPOINT: https://api.lnpay.co/v1/LNPAY_API_KEY: sak_apiKeyLNPAY_WALLET_KEY: waka_apiKey
OpenNode
LNBITS_BACKEND_WALLET_CLASS: OpenNodeWalletOPENNODE_API_ENDPOINT: https://api.opennode.com/OPENNODE_KEY: opennodeAdminApiKey
Alby
LNBITS_BACKEND_WALLET_CLASS: AlbyWalletALBY_API_ENDPOINT: https://api.getalby.com/ALBY_ACCESS_TOKEN: AlbyAccessToken
Additional / Troubleshooting Guides
The Killswitch 🚨
Difference between admin and superuser
LNBITS_ADMIN_UI=true in the .env file, the settings are initialized and will be used. From there on the according settings from the database instead those of the .env file are used.Super User
class SaaSSettingsAdmin Users
LNBITS_ADMIN_USERS, comma-seperated list of user IDs. Admin Users can change settings in the admin ui - with the exception of funding source settings, because this would require a server restart and could potentially make the server inaccessable. Also they have access to all the extensions dedicaated to them in LNBITS_ADMIN_EXTENSIONS.Allowed Users
LNBITS_ALLOWED_USERS, comma-seperated list of user IDs. By defining these users LNbits will no longer be useable by the public. Only defined users and admins can then access the LNbits frontend.Update LNbits
cd lnbits ## Stop LNbits with `ctrl + x` git pull ## Keep your poetry install up to date, this can be done with poetry self update poetry install --only main ## or git checkout main && git pull && poetry install ## Start LNbits with poetry run lnbits
sudo systemctl restart lnbits
cd ~/apps/lnbits git pull upstream main sudo ~/scripts/app start lnbits
SQLite to PostgreSQL migration
# STOP LNbits # add the database connection string to .env 'nano .env' LNBITS_DATABASE_URL= # postgres://<user>:<password>@<host>/<database> - alter line bellow with your user, password and db name LNBITS_DATABASE_URL="postgres://postgres:postgres@localhost/lnbits" # save and exit # START LNbits # STOP LNbits poetry run python tools/conv.py # or make migration
Backup and restore of the database
Funding my LNbits wallet from my node doesn't work
allow-circular-route=1Error 426
FORWARDED_ALLOW_IPS=*RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME} RequestHeader set "X-Forwarded-SSL" expr=%{HTTPS}
Network Error
- Given that you want your setup to stay like this open your LNbits wallet using the .onion URI and create it again. In this way the QR is generated to be accessible via this .onion URI so via tor only. Do not generate that QR from a .local URI, because it will not be reachable via internet - only from within your home-LAN.
- Open your LN wallet app that you used to scan that QR and this time by using tor (see wallet app settings). If the app doesn't offer tor, you can use Orbot (Android) instead. See installation section for detailed instructions on how to open your LNbits for clearnet/https.
Prevent others from generating wallets on my LNbits
.env file (see the env example here). This only works if you use the setting adminUI=FALSE in the .env, otherwise you need to do that in the Manage Server section -> Users -> Allowed Users. Everyone else will not be allowed afterwards.Customize the invoice expiry timeframe
LIGHTNING_INVOICE_EXPIRY in your .env file or use the AdminUI to change the default value for all invoices. There is also a new field in the /api/v1/payments endpoint where you can set expiry in the JSON data.Wallet-URL deleted
Wallet on demo server legend.lnbits
Wallet on your own funding source/node
cd ~/app-data/lnbits/data sqlite3 database.sqlite3 .dump wallets
INSERT INTO wallets VALUES('f8a43fc363ea428db5c53b3559935f1f','NAME OF WALLET','1280ff5910a9c485a782a2376f338b6c','33b95b099ce848e3b484124373f681e5','2cca208ae6d94d438227b9487ff216f9');
https://your.lnbits.com/wallet?usr=1280ff5910a9c485a782a2376f338b6c&wal=f8a43fc363ea428db5c53b3559935f1f
.quit
LNURL for a lightning-address vice versa
Configure a comment that people see when paying to my LNURLp QR
Deposit onchain BTC to LNbits
Via an external swap service.
Using the Onchain and Boltz LNbits extension.
- Use Electrum or Sparrow wallet to create a new onchain wallet and save the backup seed in a safe place.
- Go to wallet information and copy the xpub.
- Go to LNbits - Onchain extension and create a new watch-only wallet with that xpub.
- Go to LNbits - Tipjar extension and create a new Tipjar. Select also the onchain option besides the LN wallet.
- Optional - Go to LNbits - SatsPay extension and create a new charge for onchain btc. You can choose between onchain and LN or both. It will then create an invoice that can be shared.
- Optional - If you use your LNbits linked to a Wordpress + Woocommerce page, once you create/link a watch-only wallet to your LN btc shop wallet, the customer will have both options to pay on the same screen.
Tooling & Building with LNbits
IMPORTANT:
- LNbits works based on the LNURL protocol which requests are valid in two forms: either as https://clearnet link (no self-signed certificates allowed) or as http://v2/v3 onion link. To offer LNbits services like LNURLp/w QR codes or NFC Cards, that can be used in the wild, you will need to open LNbits to clearnet (https).
- Only use DATA-Cables to power your esp32. Not all cables support data in addition to powering the esp. You wouldnt be the first if the cable that came with the esp is a power-only one
- Make sure to not use a USB-Hub with other devices attached. This can lead to weird effects that are hard to debug (e.g. not starting or stopping).
- To realize esp projects with a MacOS you will need an UART Bridge Driver. If you have problems with the driver on Mac or Linux systems, you can find those here or, if a TTGO Display is involved this one. If you are on windows and have problems connecting make sure to download the OLD version 11.1.0 because the newer one is not working! You can also find a serial terminal here to check your connection - set to baudrate 115200.
- Though it is way more comfortable to use Platform.io (e.g. dependencies are installed automatically) we recommend using Arduino for everyone new to building.
- TT-Go Display S3: The colour of the tab of the screen protector film tells you which controller exactly (ST7735_redtab, ST7735_blacktag, ST7735_greetab, greentab128, ..) has been used to build it. Keep it to be able to debug if you programm yourself and the screen does not display graphics correctly, e.g. colours wrong, mirrored images, or stray pixels at the edges. If you ever need to do this, there is an epic guide on adjusting for different displays
- Always use lowercase lnurl239xx instead of LNURLl239xx
- Adding lightning:lnurl1234xyz will create a QR that requests to open the users wallet for this invoice on scan (last installed lightning app on iOS, setting in Android)
- If you are flashing an esp32 via web will only work with these browsers (TL:DR Chrome, Edge & Opera).
- Please note this PIN-OUT reference for the esp
- When you use FOSSoftware or FOSGuides pls always link the author. Everyone loves to watch their baby grow and it also initiates a building chain that is quite awesome to watch:)
Author
This tutorial has been written by Darth Coin
You can say thanks by tipping the professor.
Credits
This tutorial has been proofread by Asi0Flammeus
Even if this content is in its original language, human review is necessary to ensure its accuracy.
Asi0Flammeus3 098 sats1 549 satsEvery content on the platform is the result of a collaborative effort: each lesson, translation, and revision is made possible by the work of contributors. For this reason, we are always looking for proofreaders who can review our content in many languages. If you want to participate in the proofreading process, please reach out in our Telegram group and read our tutorial. We remind you that this content is open-source - licensed under CC BY-SA - so it can be freely shared and used, as long as the original source is credited.
