Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add lnd-graph-crawl by mutatrum #2268

Open
wants to merge 4 commits into
base: v1.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 36 additions & 1 deletion home.admin/_commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,39 @@ function notifyme() {
function whitepaper() {
cd /home/admin/config.scripts
./bonus.whitepaper.sh on
}
}

# command: graphcrawl
# Find suitable lightning nodes to connect, based on distance, channels, capacity, bos score and liveliness
function lndgraphcrawl() {
clear
echo "Do you want to use a third party bos score list? Any character to 'yes' and press enter to 'skip'"
read bos
if [ "$bos" != "" ]; then
echo "Downloading bos score list..."
wget https://bos.lightning.jorijn.com/data/export.json /mnt/hdd/app-storage/lnd-graph-crawl/lnd-graph-crawl/export.json 2>/dev/null
echo "Bos score list downloaded"
else
echo "Skipped downloading bos list"
fi
echo
echo "node lnd_graph_crawl.js ALIAS|PUB_KEY [min_channels (5)] [min_capacity_btc (0.1)] [active_days (7)] [lnd describegraph.json] [bos score file export.json]"
echo "ALIS|PUB_KEY is essential either one"
echo "Options description:"
echo " min_channels filter for minimum number of channels. Default: 5"
echo " min_capacity_btc filter for minimum capacity in BTC. Default: 0.1"
echo " active_days filter for last seen activity, in days. Default: 7"
echo " describegraph.json override for the lnd describegraph file"
echo " export.json override for the BOS score file"
echo
echo "What options do you want to set?"
echo "Example: MUTATRUM 10 5 14 describegraph.json export.json"
read op1 op2 op3 op4 op5 op6
echo "Crawling data...."
lncli describegraph > /tmp/describegraph.json /mnt/hdd/app-storage/lnd-graph-crawl/lnd-graph-crawl/describegraph.json
sudo mv /tmp/describegraph.json
node /mnt/hdd/app-storage/lnd-graph-crawl/lnd-graph-crawl/lnd_graph_crawl.js $op1 $op2 $op3 $op4 $op5 $op6
echo
sudo rm -f /mnt/hdd/app-storage/lnd-graph-crawl/lnd-graph-crawl/describegraph.json
sudo rm -f /mnt/hdd/app-storage/lnd-graph-crawl/lnd-graph-crawl/export.json
}
24 changes: 24 additions & 0 deletions home.admin/config.scripts/bonus.lnd-graph-crawl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# https://github.com/mutatrum/lnd_graph_crawl

# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "config script to switch the lnd-graph-crawl on or off"
echo "bonus.lnd-graph-crawl.sh [on|off]"
echo "Crawl the data writing only 'lndgraphcrawl' on the terminal"
exit 1
fi

if [ "$1" = "on" ]; then
sudo mkdir /mnt/hdd/app-storage/lnd-graph-crawl/
sudo rm -f lncli describegraph > /mnt/hdd/app-storage/lnd-graph-crawl/lnd-graph-crawl/describegraph.json
sudo git clone https://github.com/mutatrum/lnd_graph_crawl /mnt/hdd/app-storage/lnd-graph-crawl/lnd-graph-crawl
sudo chown -R admin:admin /mnt/hdd/app-storage/lnd-graph-crawl/
echo "lnd-graph-crawl installed"
fi

if [ "$1" = "off" ]; then
sudo rm -rf /mnt/hdd/app-storage/lnd-graph-crawl/
echo "lnd-graph-crawl removed"
fi