Lndg
Lite GUI web interface to analyze lnd data and leverage the backend database for automation tools around rebalancing and other basic maintenance tasks.
Install / Use
/learn @cryptosharks131/LndgREADME
LNDg - GUI for LND Data Analysis and Node Management
Welcome to LNDg, an advanced web interface designed for analyzing Lightning Network Daemon (LND) data and automating node management tasks.
Table of Contents
Installation
Choose your preferred installation method:
1-Click Installation
Easily install LNDg directly from popular platforms like Umbrel, Citadel, Start9, and RaspiBlitz. Follow the instructions provided by your chosen platform.
Docker Installation
This method requires Docker and Docker Compose to be installed on your system.
1. Prepare Installation:
# Clone the repository
git clone https://github.com/cryptosharks131/lndg.git
# Change directory to the repository
cd lndg
# Customize the docker-compose.yaml file
nano docker-compose.yaml
Replace the contents of docker-compose.yaml with your desired volume paths and settings. An example configuration is shown below:
services:
lndg:
build: .
volumes:
# Adjust paths according to your setup
- /home/<user>/.lnd:/root/.lnd:ro
- /home/<user>/<path-to>/lndg/data:/app/data:rw
command:
- sh
- -c
# Customize network ('mainnet' or 'testnet') and RPC address/port if needed
- python initialize.py -net 'mainnet' -rpc '127.0.0.1:10009' -wn && python controller.py runserver 0.0.0.0:8889 > /var/log/lndg-controller.log 2>&1
# Use host network mode for simplicity, adjust if needed
network_mode: "host"
2. Build and Deploy:
# Build and deploy the Docker container in detached mode
docker-compose up -d
# Retrieve the admin password for the initial login
cat data/lndg-admin.txt
- This example configuration will host LNDg at
http://<your-machine-ip>:8889. - Log in to LNDg using the username
lndg-adminand the password retrieved fromdata/lndg-admin.txt.
Manual Installation
This method provides a hands-on approach to setting up LNDg.
1. Install LNDg:
# Clone the repository
git clone https://github.com/cryptosharks131/lndg.git
# Change directory
cd lndg
# Ensure Python virtualenv is installed (example for Debian/Ubuntu)
sudo apt update && sudo apt install -y virtualenv
# Set up a Python 3 virtual environment
virtualenv -p python3 .venv
# Install required dependencies
.venv/bin/pip install -r requirements.txt
# Initialize settings (use --help for options)
# Add -wn or --whitenoise to serve static files if not using a separate webserver
.venv/bin/python initialize.py -wn
# Install whitenoise if the -wn flag was used
.venv/bin/pip install whitenoise
# Retrieve the admin password
cat data/lndg-admin.txt
# Run the development server (adjust IP/port if needed)
.venv/bin/python manage.py runserver 0.0.0.0:8889
- The initial login user is
lndg-admin. The password is indata/lndg-admin.txt. - Access LNDg at
http://<your-machine-ip>:8889.
2. Setup Backend Controller:
The controller.py script manages backend database updates, automated rebalancing, HTLC stream data, and p2p trade secrets. Set it up to run persistently using systemd (recommended) or supervisord.
-
Systemd:
- Option 1 (Script):
sudo bash systemd.sh - Option 2 (Manual): Manual Systemd Setup Instructions
- Option 1 (Script):
-
Supervisord:
- Configure Supervisord:
.venv/bin/python initialize.py -sd - Install Supervisord:
.venv/bin/pip install supervisor - Start Supervisord:
supervisord
- Configure Supervisord:
Alternatively, use your preferred task scheduler (like cron) to run controller.py.
Updating LNDg
Docker Update
# Navigate to the lndg directory
cd lndg
# Stop the current containers
docker-compose down
# Rebuild the image without using cache
docker-compose build --no-cache
# Start the updated containers
docker-compose up -d
# OPTIONAL: Remove unused Docker objects
docker system prune -f
Manual Update
# Navigate to the lndg directory
cd lndg
# Pull the latest changes
git pull
# Install any new dependencies
.venv/bin/pip install -r requirements.txt
# Apply any database migrations
.venv/bin/python manage.py migrate
# Restart the LNDg service (web server and controller)
# Example for systemd:
# sudo systemctl restart lndg-web.service
# sudo systemctl restart lndg-controller.service
# If using supervisord:
# supervisorctl restart lndg-web
# supervisorctl restart lndg-controller
# If using the development server, stop and restart it:
# .venv/bin/python manage.py runserver 0.0.0.0:8889
If using a webserver like Nginx with uWSGI (see below), restart the uWSGI service:
sudo systemctl restart uwsgi.service
Configuration
Backend Controller Setup
As mentioned in the Manual Installation, the controller.py needs to run persistently. Use systemd or supervisord for reliable operation.
Webserver Setup (Optional)
For continuous operation and better performance, especially in non-DEBUG mode, use a dedicated webserver like Nginx instead of the Django development server. Using a webserver also handles static file serving, making the whitenoise dependency optional.
A helper script is included for setting up Nginx:
sudo bash nginx.sh
Remember to restart the uwsgi.service after updates if using this setup.
PostgreSQL Setup (Optional)
LNDg uses SQLite3 by default. You can configure it to use a PostgreSQL database for potentially better performance in high-usage scenarios.
See the Postgres Setup Guide for instructions.
Important Notes
- Custom LND Settings: If not using default LND settings (e.g., non-default ports, network), use flags during
initialize.py(check--help) or editlndg/settings.pydirectly. - Static Files (Manual Install): If running manually without a separate webserver (like Nginx), you MUST use the
-wnflag withinitialize.pyand installwhitenoiseto serve static files (.css, .js). Running the development server (manage.py runserver) withDEBUG=Falsewithoutwhitenoiseor a webserver will cause issues. - Updating Settings: Modify
lndg/settings.pydirectly or re-runinitialize.py <options> -fto update settings. - Admin Credentials: Manage login credentials via the admin interface at
http://<your-lndg-ip:port>/lndg-admin. - Firewall: Ensure your firewall allows incoming connections on the port LNDg is running on (default: 8889).
Key Features
Track Peer Events
Monitor changes your peers make to channel policies and track connection events for your open channels.
Batch Channel Opens
Open up to 10 channels simultaneously in a single transaction, potentially reducing on-chain fees.
Watch Tower Management
Add, monitor, and remove watchtowers connected to your LND node.
Fee Rate Suggestions
Receive suggestions for adjusting outbound fee rates based on the last 7 days of payment and forwarding data. Enable Auto-Fees to act on these suggestions automatically. Note: Allow ~24 hours after a manual change before making another adjustment on the same channel.
New Peer Suggestions
Get recommendations for new peers based on your node's successful routing history, considering:
- Volume Score: Based on the count and volume of transactions routed through the peer.
- Savings By Volume (ppm): Estimated sats saved on rebalances if peered directly, relative to the volume routed through the peer.
Channel Performance Metrics
Aggregate payment and forwarding data provides:
- Outbound Flow: Amount routed outbound vs. amount rebalanced in.
- Revenue: Total earned, profit (revenue - cost), and assisted revenue (earned due to this channel's inbound).
- Inbound Flow: Amount routed inbound vs. amount rebalanced out.
- Updates: Number of channel updates (correlates to
channel.dbsize).
A dedicated P&L page tracks overall node metrics and profitability.
Password Protected Login
Initial username is lndg-admin. Change it via the /lndg-admin page.
Auto-Rebalance Action Suggestions
LNDg suggests actions to optimize Auto-Rebalancing (AR).
AR-Autopilot Setting
Enable this setting (AR-Autopilot) to automatically implement the suggestions f
