Automated, safe discovery and peering with top-tier Lightning Network routing hubs from Mempool.space.
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.
- 🌐 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.5sdelay 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).
SSH into your node and run:
curl -sSL https://raw.githubusercontent.com/borocode/lnd-autoconnect-peers/main/connect_peers.py | sudo python3 -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 --nativeusage: 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# 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