Essential and Life-Saver Tools for Node Runners.
All these tools are helping me a lot with my Lightning Node Friendspool⚡🍻
How to Setup Telegram Bot:
- Create a Telegram Bot: Open the Telegram app and search for the "BotFather" bot. Start a chat with BotFather and use the /newbot command to create a new bot. Follow the instructions to set up your bot and obtain the API token.
- Get Your Chat ID:
Start a chat with your newly created bot.
Visit the following URL in your web browser, replacing <YOUR_BOT_TOKEN> with the actual token you obtained:
bash
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdatesLook for the "chat" object within the response. The "id" field in that object is your chat ID. - Get your TELEGRAM USER ID (This is very important to ensure you are the only user authorized to use the bot Access https://t.me/userinfobot and this will return your TELEGRAM_USER_ID
Repository Installation:
- Git Clone the Repository:
git clone https://github.com/jvxis/nr-tools.git
This is the best and cheapest tool ever for swaps out (from Lightning to On-chain) Send SATS from your Lightning node directly to any Lightning Address. You can send it out to your strike lightning address and send it back to your node to your on-chain wallet with no FEES.
Preparation
-
Get the
config.inifile https://github.com/jvxis/nr-tools/blob/main/config.ini -
You need to change the lines to your configuration.
nano config.ini*[paths]* # set your paths in case you cron-job it: $ whereis lncli # replace pathtoumbrel for your full path for umbrel directory lncli_path = /pathtoumbrel/scripts/app compose lightning exec lnd lncli *[system]* # replace userpath for your full parent path to the .npm-global directory full_path_bos = /userpath/.npm-global/lib/node_modules/balanceofsatoshis/bos -
SAVE
CTRL+Oand ExitCTRL+X
How to Run
- You can run the code with the argument --local-balance . Ex.
python3 swap-wallet21.py --local-balance 40This will first consider the channels where the local liquidity is above 40% - When you run the code, you should reply to some questions.

- You can choose a specific peer or leave it blank
- The program will end only after the total amount informed is transferred
- Tips: Use a wallet service with free withdrawals like Strike, and define a smaller amount per transaction.
You can control your Lightning Node using Telegram. This tool allows you to pay invoices, generate invoices, send SATs, and much more. All available commands
1. `/onchainfee <amount> <fee_per_vbyte> - Calculate on-chain fee`
2. `/pay <payment_request> - Pay a Lightning invoice`
3. `/invoice <amount> <message> <expiration_seconds> - Create a Lightning invoice`
4. `/bckliquidwallet - Backup Liquid wallet`
5. `/newaddress - Get a new onchain address`
6. `/sign <message> - Sign a message`
7. `/connectpeer <peer address> - connect to a peer`
8. `/openchannel <public key> <size in sats> <fee rate in sats/vB> - open a channel using UTXOS`
9. `/lndlog <optional all docker logs parameters> and | grep something - Shows LND logs`
10.`/sendsats <lnaddress> <amount> <memo> <peer> (optional) - send sats to a lnaddress`
Preparation
-
Get the
config.pyfile https://github.com/jvxis/nr-tools/blob/main/config.py -
You need to change the lines to your configuration.
nano config.pyPATH_TO_UMBREL = "YOUR-FULL-PATH-TO-UMBREL" # Path to your elements wallets: BCK_SOURCE_PATH = "/home/<user>/app-data/elements/data/liquidv1/wallets" # Any external folder, external storage device where you want to place the backup: BCK_DEST_PATH = "/mnt/backup/liquid" # Chat ID: https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates: CHAT_ID="CHAT_ID" NODE="NODE NAME" # Please check if it is the right path for your BOS Binary: FULL_PATH_BOS = "/home/<user>/.npm-global/lib/node_modules/balanceofsatoshis/" -
SAVE
CTRL+Oand ExitCTRL+X -
Now you need your telegram User ID, please keep it safe for you ONLY.
-
Access https://t.me/userinfobot type
/startand this will return your TELEGRAM_USER_ID
How to Setup
-
Open lntools-bot.py file
nano lntools-bot.py -
Change Line 8 sys.path.append('/path/to/nr-tools/') to your path, if you cloned it on your user it should be
/home/user/nr-tools/ -
Change Lines:
# Insert your Telegram bot token TELEGRAM_BOT_TOKEN = "YOUR-TELEGRAM-BOT-TOKEN" #Get it on https://t.me/userinfobot TELEGRAM_USER_ID = "YOUR-TELEGRAM-USER-ID" BOS_PATH = "path_to_your_BOS_binary" -
SAVE
CTRL+Oand EXITCTRL+X
Now you can run it python3 lntools-bot.py
To run on the background you can use screen or setup it as a service: screen -S lntools-bot python3 lntools-bot.py
This script checks for pending stuck htlcs that are near expiration height (< 13 blocks). It collects peers of critical htlc and disconnects / reconnects them to reestablish the htlc. Sometimes htlcs are being resolved before expiration this way and thus costly force closes can be prevented.
How to Setup:
- open the code:
cd nr-toolsandnano htlcScan.sh - Include your Bot Token and Chat ID to receive telegram messages
- Replace the line 26
_CMD_LNCLI="/path_to_umbrel/scripts/app compose lightning exec -T lnd lncli"with your Umbrel diretory Path - Optionally set up the
blocks_til_expiry=13on line 75 to a higher number - Save the Script - CTRL + O
- Leave the editor - CTRL + X
- Make the script an executable:
sudo chmod +x htlcScan.sh - Setup CRON to run the script every 30 minutes -
sudo crontab -e - Add the line:
*/30 * * * * /bin/bash /home/<USER>/nr-tools/htlcScan.sh - CTRL + O to save and CTRL + X to leave editor
Done!
This script checks the LND database size and restarts the lND and other services if it is bigger than 12GB.
How to Setup:
- open the code:
cd nr-toolsandnano check_channelsdb_size.sh - Include your Bot Token and Chat ID to receive telegram messages
- Replace on line 4 /path_to_umbrel with the path for your Umbrel Directory
file_path="/path_to_umbrel/app-data/lightning/data/lnd/data/graph/mainnet/channel.db" - Setup with the size that you usually restart LND on line 7
threshold_size="12000000000" - Replace lines 41 and 48, where is /path_to_umbrel with path for your Umbrel Directory
- Save the Script - CTRL + O
- Leave the editor - CTRL + X
- Make the script an executable:
sudo chmod +x check_channelsdb_size.sh - Setup CRON to run the script every 1 hour -
sudo crontab -e - Add the line:
0 * * * * /bin/bash /home/<USER>/nr-tools/check_channelsdb_size.sh - CTRL + O to save and CTRL + X to leave editor
Done!
This is a telegram bot to start, stop and restart Umbrel services. You can use /on name_of_service to start some services
How to Setup:
- open the code:
cd nr-toolsandnano service_on_off.py - Include your Bot Token and your Telegram user Id to receive telegram messages
- Replace /path_to_umbrel with your path to Umbrel directory
SCRIPT_PATH = "/path_to_umbrel/scripts/app" - Save the Script - CTRL + O
- Leave the editor - CTRL + X
- Install Dependencies:
pip3 install pyTelegramBotAPI - Run the code:
python3 service_on_off.py
You can also run it with a screen command to keep it executing in background: screen -S service-on-off python3 service_on_off.py
Usage: On your telegram app inside the BOT, you can type:
- /on lightning - to turn on lnd
- /off lightning - to turn off lnd
- /boot lighting - to restart lnd The same can be done with any Umbrel Services. Like, bitcoin, circuit-breaker, tailscale, lightning-terminal etc.
Done!
This script sells some info about your node every day, channels, and their capacity, and you get some SATs back as payment for this info
Portuguese Instructions by Redin: https://github.com/jvxis/nr-tools/blob/main/SATS4.txt
Pre-reqs
- You need to set up an account on https://sparkseer.space
- Then you need to get the API-KEY
- Click on Node and then Account and click on the button GENERATE APY KEY

- Open the code:
cd nr-toolsandnano sats4plus.py - Replace the line 12 with your API KEY:
API_KEY = "SPARKEER_API_KEY" - On line 55 replace /path_to_umbrel with the path to your Umbrel directory:
["/path_to_umbrel/scripts/app", "compose", "lightning", "exec", "lnd", "lncli", "querymc"], - Save the Script - CTRL + O
- Leave the editor - CTRL + X
- Install Dependencies:
pip3 install requests - Run the code:
python3 sats4plus.py
Recommended to execute this code as a Linux Service or with screen: screen -S sats4 python3 sats4plus.py
Done!
Generates a BOS Fund command to consolidate your unspent UTXOS.
Pre-reqs You need Balance of Satoshis (BOS) installed
Usage:
- Just run
python3 utxo-consolidator.py
** This program only generates the command, so you should first check it, copy, paste and then RUN.
Done!
This code runs with your crontab every day and saves your node balance, considering Forwards and Rebalances
Pre-reqs You need Balance of Satoshis (BOS) installed
How to Setup:
- open the code:
cd nr-toolsandget_node_daily_balance.py - Replace
NODE_NAME = "Your-node-name"with your Node Alias - Replace
FULL_PATH_BOS = "/home/<user>/.npm-global/lib/node_modules/balanceofsatoshis/"This is very important to set up right to run with Crontab - Save the Script - CTRL + O
- Leave the editor - CTRL + X
- open crontab with the command
crontab -e - Add a line:
0 0 * * * /usr/bin/python3 /home/<user>/get_node_daily_balance.py >> /home/<user>/node-balance.log 2>&1Please check if it is the right path in your system. - Save the Script - CTRL + O
- Leave the editor - CTRL + X
** This code will save your node daily balance in the file /home/<user>/node-balance.log
** If you want to run adhoc for a specific date and month please run the code get_node_balance.py
Done!

