Install charge-lnd and Put Routing Fees on Autopilot

EDIT 2023: Due to some recent changes in Raspiblitz, this guide no longer works exactly the same. See the comments below for details.

In this article, you’ll learn how to automatically manage your channel fees with charge-lnd.

The Lightning Network is a free market for routing and liquidity. It’s up to each individual node to set the price of their node’s liquidity. Node operators do this by defining the base fee and the fee rate for each one of their lightning channels.

Base Fee

The base routing fee is a fixed amount of satoshis that will be collected every time you route a payment. It’s usually measured in millisats (mSats).
1,000 mSats = 1 sat

Fee Rate

The fee rate is a dynamic amount of satoshis based on the total amount routed. The fee rate is measured in milli mSats per sat.
10,000 milli mSats per sat = 1% fee rate

How to install charge-lnd

We’ll be using raspiblitz, but this should guide should work for any linux-based, LND lightning node.

Charge-lnd is a python-pip package. Pip is a package manager (like an app store) for Python.

Normally, you can install pip packages with a single command, but charge-lnd isn’t listed in the official pip repositories so you have to build it yourself.

Go ahead and ssh into your node to enter all these commands.

1. Switch to the bitcoin user on your node (its best to run charge-lnd as this user)

sudo su - bitcoin

2. Download the charge-lnd code to your node

git clone

3. Create an application key authorizing charge-lnd to control your node

lncli bakemacaroon offchain:read offchain:write onchain:read info:read --save_to=~/.lnd/data/chain/bitcoin/mainnet/charge-lnd.macaroon

4. Change current working directory to the repository you just downloaded

cd charge-lnd

5. Install the setuptools package allowing you to build other packages

pip install -U setuptools

6. Build and install the charge-lnd on your node

pip install -r requirements.txt .

You might see a message like this:

The script charge-lnd is installed in '/home/bitcoin/.local/bin' which is not in PATH. Consider adding this directory to PATH or to suppress this warning use --no-warn-script-location

Linux keeps a global environment variable called $PATH which is just a list of directories where system tools are installed. This message is letting you know that charge-lnd was just installed in a directory that isn’t in PATH so you won’t be able to run it with just the name “charge-lnd”. You’ll have to run it by passing the full path to the program each time.

For this guide, we will not be modifying our PATH. If you’d like to check out this guide on How to Add a directory to PATH in Linux.

7. Check that it installed correctly

/home/bitcoin/.local/bin/charge-lnd -h

This should show the help menu for charge-lnd. Remember, this is only installed for the bitcoin user.

8. (Optional) logout of the bitcoin user


Create a default policy config

Charge-lnd keeps a config file where you can define policy rules for setting fees. Read the charge-lnd docs to see all the properties you can set.

1. Open the charge-lnd config in a text editor

sudo nano /home/bitcoin/charge-lnd/charge.config

2. Use the interactive editor to add some config. For example:

chan.min_capacity = 500000
strategy = static
base_fee_msat = 1000
fee_ppm = 10

Save and quit the editor.

3. Apply the configuration to your channel fees

sudo -u bitcoin /home/bitcoin/.local/bin/charge-lnd -c /home/bitcoin/charge-lnd/charge.config

Automatically Apply the Policy at Scheduled Intervals

We’ll use the cron task scheduler to run charge-lnd at whatever interval you want!

WARNING: every time you change fees, your channel will be unusable for 10-60 minutes while the new channel policy update is flooded to the entire lightning network! It’s also considered rude to spam the network with frequent updates.

1. Switch to the bitcoin user

sudo su - bitcoin

2. Open up the cron task list

crontab -e

You might be asked to choose an editor. Choose nano if you’re unsure.

3. Add the cron task to the end of the file to run every night at midnight

0 0 * * * /home/bitcoin/.local/bin/charge-lnd -c /home/bitcoin/charge-lnd/charge.config

Those 5 characters at the beginning are called a cron expression. You can generate your own cron expression for any time interval.

Save and exit the editor.

Final Thoughts

Charge-lnd will only apply changes if it detects that a channel’s fee policy should be changed. These edits will likely be removed if you update your node manager software (i.e. raspiblitz, umbrel, etc.)

I hope this guide helped you step up your routing node game and maybe learn a little bit about linux and command line.

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments (


  1. s

    These instructions do not work. `bitcoin` user is unable to to use git on Raspiblitz. To resolve, clone `charge-lnd` as admin, and then `sudo mv ~/charge-lnd ../bitcoin/charge-lnd` and then `sudo chown bitcoin:bitcoin -R ../bitcoin/charge-lnd`