In the Lightning Network, routing nodes are able to charge a fee for forwarding payments, so-called Hash-Time-Locked-Contracts (HTLCs). This compensation is necessary to incentivize the efficient allocation of capital in the network to be able to receive and send fees inside of the network.
On the HTLC level, channel fees are the difference between the HTLC sent to the routing node, and the HTLC sent from the routing node onwards. As an example, if you are presented a 1000 satoshi invoice from a node one hop away that charges 1 satoshi, you will send an HTLC over 1001 satoshi to the routing node, which sends a 1000 satoshi HTLC to the final recipient.
As fees are included in the payment, and all HTLCs contingent on the same pre-image, you can only charge fees for successful payments.
Fees are applied only once per channel by the party which is forwarding the fee. Meaning, as you push a payment to your neighbor node, you are able to charge a fee, and as payments are pushed to you, your neighbor charges the fee, even if the channel was created by you.
There are two kinds of fees, the base fee and the fee rate.
The base fee is the fee that will be charged for each forwarded HTLC, regardless of the payment size. It is typically denominated in milli-satoshi. It is referred to as
bitcoin.basefee in LND.
lncli updatechanpolicy --base_fee_msat 1000 55d9c8e11e6a926e3929a9584298278e6297b75b75f4f8c751f6b00da05ffe72:1
The fee rate is a proportional fee charged based on the value of each forwarded HTLC. It is typically denominated in parts per million, although the command lncli updatechanpolicy uses decimal place. The command lncli feereport will return both the decimal value (
fee_rate) and the amount per million (
fee_per_mil) for your convenience.
lncli updatechanpolicy --fee_rate 0.000001 55d9c8e11e6a926e3929a9584298278e6297b75b75f4f8c751f6b00da05ffe72:1
lncli feereport will output a list of all your channels and your fee policies. It will also give you a summary of how many fees you have earned routing per day, week and month.
The output above means that for each payment you are pushing through this channel, you are charging 1000 milli-satoshi (1 satoshi) plus 500 milli-satoshi per million. A 1 milllion satoshi large HTLC for example would yield you 1500 milli-satoshi, or 1.5 satoshi.
To see the fees of individual channels, and to see how much fees the other side charges for fees in your channel, you can use the query
lncli getchaninfo 743145615608774656
The output above tells you that while both sides of this channel charge 1000 milli-satoshi per forwarded payment, the fee rate of node 1 is only half of that of node 2. The smallest payment this channel can route in either way is 1000 milli-satoshi, and each HTLC has to be claimed within 40 blocks before it has to be settled on chain.
Alternatively you can probe the entire graph with the command
lncli describegraph. This will return all channels and their policies across the entire network.
You can update your channel policies anytime using the command line. Generally, it is not recommended to update your fees frequently, as this might make you appear less of a reliable routing node. Your peers might have opened a channel with you in the expectation of a certain fee level, and at a new fee level they might not be willing to maintain their connections.
lncli updatechanpolicy --base_fee_msat 1000 --fee_rate 0.000001 --time_lock_delta 500 --min_htlc_msat 1000 --chan_point 55d9c8e11e6a926e3929a9584298278e6297b75b75f4f8c751f6b00da05ffe72:1
You can also set your default channel policies in your lnd configuration file.
bitcoin.basefee=1000 # (in milli-satoshi)
bitcoin.feerate=1 # (in parts per million)
If you amend the above lines to your configuration file for the first time, it will update the channel policies for all existing channels, except for those for which the channel policies have been updated manually before. If you only want to change the fee policies of new channels, you may first apply the command
lncli updatechanpolicy with the existing parameters to all channels before amending the configuration file and restarting lnd.
lncli updatechanpolicy --base_fee_msat 1000 --fee_rate 0.000001