Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚡ lnd-autoconnect-peers

Automated, safe discovery and peering with top-tier Lightning Network routing hubs from Mempool.space.

CI License: MIT Lightning Network Platform

Connecting to high-capacity, well-connected routing nodes improves your node's graph knowledge, pathfinding speed, and payment routing success.

However, connecting to dozens of nodes simultaneously can cause gossip storms, high memory churn (channel.db BoltDB freelist page faults), and daemon restarts—especially on Single-Board Computers (Raspberry Pi 4/5, RockPi, etc.).

lnd-autoconnect-peers queries live liquidity and connectivity rankings from Mempool.space and connects your node with staggered rate-limiting safeguards and automatic multi-mirror failover.


✨ Features

  • 🌐 Real-Time Discovery & Multi-Mirror Failover: Queries top connectivity and liquidity routing hubs with automatic failover across Mempool mirrors (mempool.space, mempool.emzy.de, mempool.bisq.services).
  • 🛡️ Gossip Flood Safeguard: Built-in configurable pacing (default: 2.5s delay per peer) to keep RAM usage stable and prevent BoltDB crashes.
  • 🐳 Universal Compatibility: Works seamlessly with Umbrel, RaspiBlitz, Start9, Docker-based setups, and native lncli.
  • 🔍 Duplicate Prevention: Automatically checks your existing peers and only connects to new nodes.
  • Zero External Python Dependencies: Runs using standard Python 3 standard library (urllib, json, subprocess).

🚀 Quick Start

1-Line Run (Umbrel / Docker Nodes)

SSH into your node and run:

curl -sSL https://raw.githubusercontent.com/borocode/lnd-autoconnect-peers/main/connect_peers.py | sudo python3 -

On Native / Bare-Metal LND Nodes (RaspiBlitz, Systemd, etc.)

Download and run with the --native flag:

curl -sSL https://raw.githubusercontent.com/borocode/lnd-autoconnect-peers/main/connect_peers.py -o connect_peers.py
python3 connect_peers.py --native

⚙️ CLI Options & Customization

usage: connect_peers.py [-h] [-v] [-c COUNT] [-d DELAY] [--container CONTAINER] [--native]

⚡ Auto-discover and connect to top Lightning Network routing hubs via LND.

options:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -c COUNT, --count COUNT
                        Number of new high-capacity peers to connect to (default: 25)
  -d DELAY, --delay DELAY
                        Delay in seconds between peer connections (default: 2.5)
  --container CONTAINER
                        Docker container name for LND (default: lightning_lnd_1)
  --native              Use native lncli directly instead of Docker exec

Examples:

# Connect to 15 peers with a slower 4-second delay (low-spec Pi)
sudo python3 connect_peers.py -c 15 -d 4.0

# Connect to 40 peers on a custom docker container name
sudo python3 connect_peers.py -c 40 --container my_lnd_container

📜 License

MIT © 2026 borocode

About

Automated rate-limited peering with top Lightning Network routing hubs via Mempool.space without crashing SBC BoltDB

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages