Difference between revisions of "LND Configuration Settings"

From PlebNet Wiki
Jump to navigation Jump to search
 
(18 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== Intro ==
<languages/>
<translate>
 
 
== Intro == <!--T:1-->
 
<!--T:2-->
WARNING: If you are running Umbrel not all of these configuration settings are open to you currently, because Umbrel does not compile all the flags for LND daemon. If you use a setting that isn't valid to your LND service will not start up.
WARNING: If you are running Umbrel not all of these configuration settings are open to you currently, because Umbrel does not compile all the flags for LND daemon. If you use a setting that isn't valid to your LND service will not start up.


     Ever since the Lightning Network has started and when people began opening channels with others they have been trying to get the most out their Node.  People have been doing this ever since computers have gotten into peoples hands.  Trying out different settings and finding out what works best.
     <!--T:3-->
Ever since the Lightning Network has started and when people began opening channels with others they have been trying to get the most out their Node.  People have been doing this ever since computers have gotten into peoples hands.  Trying out different settings and finding out what works best.
Anyone who would love to go over a long list of config parameters which can be used could check out this Lnd GitHub page  
Anyone who would love to go over a long list of config parameters which can be used could check out this Lnd GitHub page  
https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf
https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf


     There are more entries then I ever thought possible, but this Wiki page is how to make adjustments to the Lightning Node environment which helps ones node to perform better.  Something which we'd all would like to happen.
     <!--T:4-->
There are more entries then I ever thought possible, but this Wiki page is how to make adjustments to the Lightning Node environment which helps ones node to perform better.  Something which we'd all would like to happen.
The list which follows is the most common settings which Node Operators have come to agree which best suites a Node which wants to earn fees and route other Nodes Payments.
The list which follows is the most common settings which Node Operators have come to agree which best suites a Node which wants to earn fees and route other Nodes Payments.
These settings apply to LND 0.12.1 releases.  The latest release still has many issues which need to be resolved.
These settings apply to LND 0.12.1 releases.  The latest release still has many issues which need to be resolved.


<!--T:5-->
A full list of all LND settings can be found here:
A full list of all LND settings can be found here:
https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf
https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf


== Opening Channel With Predefined Fees ==
 
 
== For the Settings To Take Effect == <!--T:6-->
 
<!--T:7-->
For the settings to take effect, you will need to restart lnd. Do not restart entire node.
 
<!--T:8-->
Restart lnd <code> cd ~/umbrel ; docker-compose restart lnd; docker-compose ps </code>
 
<!--T:9-->
For non umbrel, the instructions could be different.
 
 
 
== Opening Channel With Predefined Fees == <!--T:10-->
 
<!--T:11-->
With lnd you can set up fees only once the channel is opened. You cannot set fees on pending channels. Unless you have a predefined fees setup, the channel open with default fees (which is 1 Sat Base Fee and 1 ppm fee rate). Now it could be too low for your liking and sometimes, when you open channel with low on-chain fees (1 Sat/Vb) it could take a long time to confirm, sometimes overnight. If you want to sleep with peace that when your open the channel, it will be with your desired default fee you can make the following additions to your lnd.conf.
With lnd you can set up fees only once the channel is opened. You cannot set fees on pending channels. Unless you have a predefined fees setup, the channel open with default fees (which is 1 Sat Base Fee and 1 ppm fee rate). Now it could be too low for your liking and sometimes, when you open channel with low on-chain fees (1 Sat/Vb) it could take a long time to confirm, sometimes overnight. If you want to sleep with peace that when your open the channel, it will be with your desired default fee you can make the following additions to your lnd.conf.


<!--T:12-->
The section below should be in the [Bitcoin] section of the lnd.conf file.
The section below should be in the [Bitcoin] section of the lnd.conf file.


<!--T:13-->
{| class="wikitable"
{| class="wikitable"
! Setting
! Setting
Line 29: Line 57:
|}
|}


== Watch Tower Settings == 


     Pretty good name for what this does.  Watch Towers are communications between agreeing Nodes to keep on eye on each others Node.  Node Operators pass their Watch Tower address between each other so when one of them is down for some reason, the other one watches for channel situations like a forced close.  If this closure tries to use a non-current Channel state, then the Watch Tower will step in and penalize the Node trying to cheat.
 
== Watch Tower Settings == <!--T:14-->
 
 
 
     <!--T:15-->
Pretty good name for what this does.  Watch Towers are communications between agreeing Nodes to keep on eye on each others Node.  Node Operators pass their Watch Tower address between each other so when one of them is down for some reason, the other one watches for channel situations like a forced close.  If this closure tries to use a non-current Channel state, then the Watch Tower will step in and penalize the Node trying to cheat.
     Currently, the fee for watching another Node is disabled, but at some point there will be a cost with this.  Now if your Node does catch some foul play one will earn fees for being the good guy.
     Currently, the fee for watching another Node is disabled, but at some point there will be a cost with this.  Now if your Node does catch some foul play one will earn fees for being the good guy.


<!--T:16-->
adding the following to your lnd.conf should do the job
<pre>
[wtclient]
wtclient.active=true
wtclient.sweep-fee-rate=10
<!--T:17-->
[watchtower]
watchtower.active=true
</pre>
<!--T:18-->
{| class="wikitable"
{| class="wikitable"
! Setting
! Setting
Line 48: Line 94:
|}
|}


<!--T:19-->
Restart lnd <code> cd ~/umbrel ; docker-compose restart lnd; docker-compose ps </code>
Restart lnd <code> cd ~/umbrel ; docker-compose restart lnd; docker-compose ps </code>


<!--T:20-->
check watch tower server status  
check watch tower server status  
<code>~/umbrel/bin/lncli tower info</code>
<code>~/umbrel/bin/lncli tower info</code>


<!--T:21-->
the output will confirm your watch tower server status. It will also provide you a pubkey. If you want to allow your friends to add you as their watch tower give them this URI. Do not distribute willy nilly. This is different from your pubkey.
the output will confirm your watch tower server status. It will also provide you a pubkey. If you want to allow your friends to add you as their watch tower give them this URI. Do not distribute willy nilly. This is different from your pubkey.


<!--T:22-->
<code>
<code>
{
{
Line 67: Line 117:
</code>
</code>


<!--T:23-->
Similarly, your friend (who you want to add as your watch tower) must give you their URI for you to add them as your watch tower.  
Similarly, your friend (who you want to add as your watch tower) must give you their URI for you to add them as your watch tower.  


<!--T:24-->
Once you have their URI, add as
Once you have their URI, add as
<code>~/umbrel/bin/lncli wtclient add <URI provided></code>
<code>~/umbrel/bin/lncli wtclient add <URI provided></code>


<!--T:25-->
You can find details of [https://lightningnetwork.plus/watchtower LN+ watchtower here] if you want to use them as watchtower. You do not need to follow other instructions, just use their watchtower URI for tor or for clearnet.
<!--T:26-->
Check if all is ok as watchtower client
Check if all is ok as watchtower client
<code>~/umbrel/bin/lncli wtclient towers</code>
<code>~/umbrel/bin/lncli wtclient towers</code>
This will give you a list of watchtowers your node is connected to. You can keep 2-4 nodes as your watch towers.
This will give you a list of watchtowers your node is connected to. You can keep 2-4 nodes as your watch towers.


<!--T:27-->
Check the statistics  
Check the statistics  
<code>~/umbrel/bin/lncli wtclient stats</code>
<code>~/umbrel/bin/lncli wtclient stats</code>


== Alias ==
 
 
== Alias == <!--T:28-->
 
<!--T:29-->
The section below should be in the [Application Options] section of the lnd.conf file.
The section below should be in the [Application Options] section of the lnd.conf file.


<!--T:30-->
{| class="wikitable"
{| class="wikitable"
! Setting
! Setting
Line 90: Line 152:
|}
|}


== Routing Optimization ==
<!--T:31-->
The section below should be in the [routerrpc] section of the lnd.conf file.
See [[Special:MyLanguage/Setting a node alias|Setting a node alias]] for more information.
 
 
 
== Routing Optimization == <!--T:32-->
 
<!--T:33-->
The value below must be under Application Options section of the lnd.conf file.
{| class="wikitable"
! Setting
! Description
|-
|max-cltv-expiry=5000
| The maximum number of blocks funds could be locked up for when forwarding payments. (default: 2016)
|-
|max-commit-fee-rate-anchors=100
| The maximum fee rate in sat/vbyte that will be used for commitments of channels of the anchors type. Must be large enough to ensure transaction propagation (default: 10)
|}
 
The section below should be in the [routerrpc] section of the lnd.conf file. *Note* the values suggested below are inspired from [https://github.com/alexbosworth/run-lnd AlexBosworth's lnd configuration ]. These may not work for all nodes. Stay with default configuration unless you know what you are looking to achieve.


{| class="wikitable"
{| class="wikitable"
Line 117: Line 198:
|routerrpc.penaltyhalflife=2h0m0s
|routerrpc.penaltyhalflife=2h0m0s
| Defines the duration after which a penalized node or channel is back at 50% probability (default: 1h0m0s). To keep failed routes out of future routes, set a higher time.
| Defines the duration after which a penalized node or channel is back at 50% probability (default: 1h0m0s). To keep failed routes out of future routes, set a higher time.
|-
|max-cltv-expiry=5000
| The maximum number of blocks funds could be locked up for when forwarding payments. (default: 2016)
|-
|max-commit-fee-rate-anchors=100
| The maximum fee rate in sat/vbyte that will be used for commitments of channels of the anchors type. Must be large enough to ensure transaction propagation (default: 10)
|}
|}


== Channel Size limits ==
== Channel Size limits == <!--T:34-->


<!--T:35-->
The section below should be in the [Application Options] section of the lnd.conf file.
The section below should be in the [Application Options] section of the lnd.conf file.


<!--T:36-->
{| class="wikitable"
{| class="wikitable"
! Setting
! Setting
Line 146: Line 223:
|}
|}


== Database optimizations ==


== BOLT Database optimizations (channel.db) == <!--T:37-->
<!--T:38-->
{| class="wikitable"
{| class="wikitable"
! Setting
! Setting
! Description
! Description
|-  
|-  
|under [bolt] section
|<b>under [bolt] section</b>
|-
|-
|db.bolt.auto-compact=true
|db.bolt.auto-compact=true
Line 160: Line 240:
|How long ago the last compaction of a database file must be for it to be considered for auto compaction again. Can be set to 0 to compact on every startup. (default: 168h)
|How long ago the last compaction of a database file must be for it to be considered for auto compaction again. Can be set to 0 to compact on every startup. (default: 168h)
|-  
|-  
|under [Application Options]
|<b>under [Application Options]</b>
|-
|-
|gc-canceled-invoices-on-startup=1
|gc-canceled-invoices-on-startup=1
Line 168: Line 248:
|Cleanup chanceled invoices at run-time
|Cleanup chanceled invoices at run-time
|-
|-
|Under [caches] section
|<b>under [caches] section</b>
|-
|-
|caches.channel-cache-size=500000
|caches.channel-cache-size=500000
|Maximum number of entries contained in the channel cache, which is used to reduce memory allocations from gossip queries from peers. Each entry requires roughly 2Kb. (default: 20000)
|Maximum number of entries contained in the channel cache, which is used to reduce memory allocations from gossip queries from peers. Each entry requires roughly 2Kb. (default: 20000)
|-
|<b>under [routing] section</b>
|-
|routing.strictgraphpruning=1
|Remove channels from graph that have one side that hasn't made announcements
|}
|}


== Startup Optimizations ==
== Startup Optimizations == <!--T:39-->


<!--T:40-->
The section below should be in the [Application Options] section of the lnd.conf file.
The section below should be in the [Application Options] section of the lnd.conf file.


<!--T:41-->
{| class="wikitable"
{| class="wikitable"
! Setting
! Setting
! Description
! Description
|-
|-
|sync-freelist=1
|sync-freelist=false
|Enable free list syncing for the default bbolt database. This will decrease start up time, but can result in performance degradation for very large databases, and also result in higher memory usage
|Enable free list syncing for the default bbolt database. This will decrease start up time, but can result in performance degradation for very large databases, and also result in higher memory usage
|-
|-
Line 189: Line 276:
|}
|}


== Auto Wallet Unlock (Version 0.13.0+) ==
== Auto Wallet Unlock (Version 0.13.0+) == <!--T:42-->
 
<!--T:43-->
{| class="wikitable"
{| class="wikitable"
! Setting
! Setting
Line 198: Line 287:
|}
|}


== Logging ==
 
 
== Logging == <!--T:44-->
 
<!--T:45-->
{| class="wikitable"
{| class="wikitable"
! Setting
! Setting
Line 207: Line 300:
|}
|}


== Pre 0.13 LND settings ==
</translate>
== Logging ==
{| class="wikitable"
! Setting
! Description
|-
|protocol.anchors=true
| Enabled anchor style channels (this lowers commit fees), this is now default in LND 0.13+ so the parameter is not required and will cause LND to not start up if included in the lnd.conf
|}

Latest revision as of 06:49, 2 August 2022

Other languages:
English


Intro

WARNING: If you are running Umbrel not all of these configuration settings are open to you currently, because Umbrel does not compile all the flags for LND daemon. If you use a setting that isn't valid to your LND service will not start up.

    Ever since the Lightning Network has started and when people began opening channels with others they have been trying to get the most out their Node.  People have been doing this ever since computers have gotten into peoples hands.  Trying out different settings and finding out what works best.

Anyone who would love to go over a long list of config parameters which can be used could check out this Lnd GitHub page https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf

    There are more entries then I ever thought possible, but this Wiki page is how to make adjustments to the Lightning Node environment which helps ones node to perform better.  Something which we'd all would like to happen.

The list which follows is the most common settings which Node Operators have come to agree which best suites a Node which wants to earn fees and route other Nodes Payments. These settings apply to LND 0.12.1 releases. The latest release still has many issues which need to be resolved.

A full list of all LND settings can be found here: https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf


For the Settings To Take Effect

For the settings to take effect, you will need to restart lnd. Do not restart entire node.

Restart lnd cd ~/umbrel ; docker-compose restart lnd; docker-compose ps

For non umbrel, the instructions could be different.


Opening Channel With Predefined Fees

With lnd you can set up fees only once the channel is opened. You cannot set fees on pending channels. Unless you have a predefined fees setup, the channel open with default fees (which is 1 Sat Base Fee and 1 ppm fee rate). Now it could be too low for your liking and sometimes, when you open channel with low on-chain fees (1 Sat/Vb) it could take a long time to confirm, sometimes overnight. If you want to sleep with peace that when your open the channel, it will be with your desired default fee you can make the following additions to your lnd.conf.

The section below should be in the [Bitcoin] section of the lnd.conf file.

Setting Description
bitcoin.basefee=1000 The base fee in millisatoshi we will charge for forwarding payments on our channels. This setting is equivalent to 1 Sat base fee.
bitcoin.feerate=2500 The fee rate used when forwarding payments on our channels. The total fee charged is basefee + (amount * feerate / 1000000), where the amount is the forwarded amount. This setting is equivalent to 2500 ppm fee.


Watch Tower Settings

    Pretty good name for what this does.  Watch Towers are communications between agreeing Nodes to keep on eye on each others Node.  Node Operators pass their Watch Tower address between each other so when one of them is down for some reason, the other one watches for channel situations like a forced close.  If this closure tries to use a non-current Channel state, then the Watch Tower will step in and penalize the Node trying to cheat.
    Currently, the fee for watching another Node is disabled, but at some point there will be a cost with this.  Now if your Node does catch some foul play one will earn fees for being the good guy.

adding the following to your lnd.conf should do the job

[wtclient]
wtclient.active=true
wtclient.sweep-fee-rate=10

[watchtower]
watchtower.active=true
Setting Description
wtclient.active=true Turns on the Watch Tower Client (in the [wtclient] section of lnd.conf)
wtclient.sweep-fee-rate=10 Sets the watchtower client sweep fee in sats/vbyte for the justice transaction (in the [wtclient] section of lnd.conf)
watchtower.active=true Enable integrated watchtower server listening on :9911 by default. (in the [watchtower] section of lnd.conf)

Restart lnd cd ~/umbrel ; docker-compose restart lnd; docker-compose ps

check watch tower server status ~/umbrel/bin/lncli tower info

the output will confirm your watch tower server status. It will also provide you a pubkey. If you want to allow your friends to add you as their watch tower give them this URI. Do not distribute willy nilly. This is different from your pubkey.

{

   "pubkey": "XXXXX00000XXXX0000",
   "listeners": [
       "[::]:9911"
   ],
   "uris": [
       "ABC123@XYZ123:9911"
   ]

}

Similarly, your friend (who you want to add as your watch tower) must give you their URI for you to add them as your watch tower.

Once you have their URI, add as ~/umbrel/bin/lncli wtclient add <URI provided>

You can find details of LN+ watchtower here if you want to use them as watchtower. You do not need to follow other instructions, just use their watchtower URI for tor or for clearnet.

Check if all is ok as watchtower client ~/umbrel/bin/lncli wtclient towers This will give you a list of watchtowers your node is connected to. You can keep 2-4 nodes as your watch towers.

Check the statistics ~/umbrel/bin/lncli wtclient stats


Alias

The section below should be in the [Application Options] section of the lnd.conf file.

Setting Description
alias=MyNodeAlias Set the Alias of the node

See Setting a node alias for more information.


Routing Optimization

The value below must be under Application Options section of the lnd.conf file.

Setting Description
max-cltv-expiry=5000 The maximum number of blocks funds could be locked up for when forwarding payments. (default: 2016)
max-commit-fee-rate-anchors=100 The maximum fee rate in sat/vbyte that will be used for commitments of channels of the anchors type. Must be large enough to ensure transaction propagation (default: 10)

The section below should be in the [routerrpc] section of the lnd.conf file. *Note* the values suggested below are inspired from AlexBosworth's lnd configuration . These may not work for all nodes. Stay with default configuration unless you know what you are looking to achieve.

Setting Description
routerrpc.apriorihopprob=0.5 Assumed success probability of a hop in a route when no other information is available (default: 0.6). For aggressive, set it higher and your node will try unknown routes but will take longer to route.
routerrpc.aprioriweight=0.75 Weight of the a priori probability in success probability estimation. Valid values are in [0, 1]. (default: 0.5). For aggressive, set it higher. 1 turns off i.e. probability of a future event is not dependent on the previous outcome.
routerrpc.attemptcost=10 The (virtual) fixed cost in sats of a failed payment attempt (default: 100). For aggressive, set lower.
routerrpc.attemptcostppm=1 The (virtual) proportional cost in ppm of the total amount of a failed payment attempt (default: 1000). For aggressive set lower.
routerrpc.maxmchistory=100000 The maximum number of payment results that are held on disk by mission control. For aggressive set higher.
routerrpc.minrtprob=0.005 Minimum required route success probability to attempt the payment (default: 0.01). For aggressive set lower.
routerrpc.penaltyhalflife=2h0m0s Defines the duration after which a penalized node or channel is back at 50% probability (default: 1h0m0s). To keep failed routes out of future routes, set a higher time.

Channel Size limits

The section below should be in the [Application Options] section of the lnd.conf file.

Setting Description
minchansize=5000000 Minimum Channel Size in Sats
maxchansize=50000000 Maximum Channel Size in Sats
maxpendingchannels=5 The maximum number of incoming pending channels permitted per peer
protocol.wumbo-channels=true If set, then lnd will create and accept requests for channels larger than 0.167 BTC, up to max 5 BTC


BOLT Database optimizations (channel.db)

Setting Description
under [bolt] section
db.bolt.auto-compact=true Allow automatic compaction of your channel.db file on startup
db.bolt.auto-compact-min-age=240h How long ago the last compaction of a database file must be for it to be considered for auto compaction again. Can be set to 0 to compact on every startup. (default: 168h)
under [Application Options]
gc-canceled-invoices-on-startup=1 Cleanup canceled invoices on startup
gc-canceled-invoices-on-the-fly=1 Cleanup chanceled invoices at run-time
under [caches] section
caches.channel-cache-size=500000 Maximum number of entries contained in the channel cache, which is used to reduce memory allocations from gossip queries from peers. Each entry requires roughly 2Kb. (default: 20000)
under [routing] section
routing.strictgraphpruning=1 Remove channels from graph that have one side that hasn't made announcements

Startup Optimizations

The section below should be in the [Application Options] section of the lnd.conf file.

Setting Description
sync-freelist=false Enable free list syncing for the default bbolt database. This will decrease start up time, but can result in performance degradation for very large databases, and also result in higher memory usage
stagger-initial-reconnect=1 Stagger initial reconnection on startup, this will reduce load when you have a bunch of channels

Auto Wallet Unlock (Version 0.13.0+)

Setting Description
wallet-unlock-password-file=/path/to/file Provide filepath to plain-text file with your password. This will automatically unlock LND


Logging

Setting Description
debuglevel=CNCT=debug,CRTR=debug,HSWC=debug,NTFN=debug,RPCS=debug This allows you to change the default logging level, the example provides max amount of logging information at the expense of some more disk IO and space