Skip to content

Instantly share code, notes, and snippets.

@msimion
Last active October 3, 2022 19:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msimion/e756bbe95426a91d7a0aa9912c7d0619 to your computer and use it in GitHub Desktop.
Save msimion/e756bbe95426a91d7a0aa9912c7d0619 to your computer and use it in GitHub Desktop.

[ 1 ] Connect to the node over ssh and make sure you are under /home/umbrel.

[ 2 ] Create the charge-lnd config/policy file. I named mine charge-lnd.pol.

Add the following contents in it:

[default]
# 'default' is special, it is used if no other policy matches a channel
strategy = static
#zerobasefee for Pickhardt Payments
base_fee_msat = 0
fee_ppm = 1

[proportional]
# 'proportional' can also be used to auto balance (lower fee rate when low remote balance & higher rate when higher remote balance)
# fee_ppm decreases linearly with the channel balance ratio (min_fee_ppm when ratio is 1, max_fee_ppm when ratio is 0
strategy = proportional
min_fee_ppm = 1
max_fee_ppm = 25

[ 3 ] Create the script that will be invoked by the cron job defined at step [4]. I named mine charge-lnd-cron.sh.

Add the following contents in it:

#!/bin/sh

ln_shell=$(docker ps | grep lightning-shell | awk '{print $1}')

docker cp /home/umbrel/charge-lnd.pol $ln_shell:/home/lnshell

docker exec $ln_shell /home/lnshell/.local/bin/charge-lnd -c /home/lnshell/charge-lnd.pol

[ 3.1 ] Make the script executable by running the following command:

chmod +x charge-lnd-cron.sh

[ 4 ] Add the following cron entry on the umbrel node:

*/2 * * * * /home/umbrel/charge-lnd-cron.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment