Automate routing fee
This guide will help you automate your lightning routing fees.
Installation
1. Login using ssh
ssh -t [email protected]
2. Create a directory on the SSD for the config file
mkdir ~/umbrel/apps/charge-lnd
3. Create a config file within the directory:
sudo nano ~/umbrel/apps/charge-lnd/charge.config
4. Populate the file with the rules you want, using the sample config file
You can change the rules at any time and add to them as you go along. If you need an explanation of how the parameters and rules work, here is a list of thdde parameters and their explanations.
Here is a config file example:
[default]
# 'default' is special, it is used if no other policy matches a channel
strategy = static
base_fee_msat = 0
fee_ppm = 97
[ignored_channels]
# don't let charge-lnd set fees (strategy=ignore) for channels to/from the specified nodes
node.id = 021c97a90a411ff2b10dc2a8e32de2f29d2fa49d41bfbb52bd416e460db0747d0d
strategy = ignore
[leafnode]
# charge non-routing (private=true) peers a bit more for our service
chan.private = true
strategy = static
fee_ppm = 150
[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 = 50
max_fee_ppm = 250
5. Log in to Github using an access token so that you can pull docker repo directly from there:
Create an access token that you can use from your github account (create one if you donât have one yet)
Go to Github -> settings-> Developer Settings -> Personal access tokens - Create a new one.
Make sure the token has Read and/or Write access to Github registry.
Create it and copy the password. Save it, because you wonât see it again.
Back in the command line, use this info to login to the registry
docker login https://docker.pkg.github.com/[http://docker.pkg.github.com/]
Type your Github username
and generated token string
as password.
Example:
umbrel@umbrel:~/umbrel/apps/charge-lnd $ docker login https://docker.pkg.github.com/[http://docker.pkg.github.com/]
Username: buidlbuidl
Password:
WARNING! Your password will be stored unencrypted in /home/umbrel/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
You should see âLogin succeededâ
6. Find the IP of your docker.
Run this command:
sudo nano ~/umbrel/.env
Find the line with LND_IP
in it, and copy that IP address. Exit without saving.
7. Run the docker
The way charge-lnd works is by running the container "one time" - rather than keeping it open and alive persistently. This is different from other docker installations that Umbrel uses, but it doesn't matter. We can ask our Pi to run the docker from the files hosted on the web.
First, make sure that you are in the right directoryâŠ
cd ~
Now, create the docker w/ the file youâve already created as the config file.
Don't forget to replace LND.IP.ADDRESS.GOES.HERE
in the script below with the one you found above. Do not remove :10009
docker run --rm -it --network=umbrel_main_network \
-e GRPC_LOCATION=LND.IP.ADDRESS.GOES.HERE:10009 \
-e LND_DIR=/data/.lnd \
-e CONFIG_LOCATION=/app/charge.config \
-v /home/umbrel/umbrel/lnd:/data/.lnd \
-v /home/umbrel/umbrel/apps/charge-lnd/charge.config:/app/charge.config \
accumulator/charge-lnd:latest
If everything works as expected, youâll see a list of all of your channels, and the changes that have been made according to your rules / policies.

Check that youâre happy with how itâs applying rules.
If not, go ahead and edit the charge.config file on your hard disk that we created, then run the above ârunâ command again.
8. Now, Automate it!
Once youâre happy with everything, you can optionally set up a âcrontabâ job to automatically run this command every X minutes or hours.
Simply type:
crontab -e
The system will create a new crontab file, since none exists.
In this file, you can put the following, all on one line:
0 * * * * docker run --rm --network=umbrel_main_network -e GRPC_LOCATION=YOUR.LND.IP.ADDRESS:10009 -e LND_DIR=/data/.lnd -e CONFIG_LOCATION=/app/charge.config -v /home/umbrel/umbrel/lnd:/data/.lnd -v /home/umbrel/umbrel/apps/charge-lnd/charge.config:/app/charge.config accumulator/charge-lnd:latest
This will run your charge-lnd script once every hour. This is the maximum recommended frequency by charge-lnd, as running it more frequently can result in failed routes or other confusion and chatter on the network.
If you wish to run it more/less frequently, that's up to you, and you can find the instructions for changing the 0 * * * *
part of the command above here: https://crontab.guru
That's all!
If you've followed the steps above correctly, everything should work just fine, and update your routing policies every hour on the hour.
Tip creators using @LNTXBotđ
/tip 100 @stocktoflow
/tip 100 @The_Lorax_LN
/tip 100 @jorijn
/tip 100 @yuvadm
Resources:
Last updated
Was this helpful?