Difference between revisions of "LND Configuration Settings"

From PlebNet Wiki
Jump to navigation Jump to search
Line 88: Line 88:
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>
You can find details of LN+ watchtower [https://lightningnetwork.plus/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
Check if all is ok as watchtower client

Revision as of 10:11, 20 September 2021

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

Routing Optimization

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

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.
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

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

Database optimizations

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)

Startup Optimizations

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

Setting Description
sync-freelist=1 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