Lndmanage
Channel management tool for lightning network daemon (LND) operators.
Install / Use
/learn @bitromortac/LndmanageREADME
lndmanage
lndmanage is a command line tool for advanced channel management of an LND node.
DISCLAIMER: This is BETA software, so please be careful. No warranty is given.
See installation instructions.
Feature list:
- Activity reports
report - Display the node summary
status infocommand: explore info about a channel or node in the graph- Advanced channel listings
listchannelslistchannels rebalance: list channels for rebalancinglistchannels forwardings: list forwarding statistics for each channellistchannels hygiene: information for closing of active channelslistchannels inactive: information on inactive channels
- Peer listing
listpeers: aggregated channel statistics - Fee updating
update-fees: increase revenue and rebalance by fee optimization - Recommendation of good nodes
recommend-nodes - Batched channel opening
openchannels - Support of
lncli
Command Line Options
usage: lndmanage.py [-h] [--loglevel {INFO,DEBUG}] {status,listchannels,recommend-nodes,report,info,lncli,openchannels,update-fees} ...
Lightning network daemon channel management tool.
positional arguments:
{status,listchannels,recommend-nodes,report,info,lncli,openchannels,update-fees}
status display node status
listchannels lists channels with extended information [see also subcommands with -h]
listpeers lists peers with extended information
recommend-nodes recommends nodes [see also subcommands with -h]
report displays reports of activity on the node
info displays info on channels and nodes
lncli execute lncli
openchannels opens multiple channels
update-fees optimize the fees on your channels to increase revenue and to automatically rebalance
Info Command
Sometimes it is necessary to get more information about a specific public channel or node. This could be for example trying to figure out what fees are typically charged by a node or to look up its IP address.
With the info command you can enter
$ lndmanage info CHANNEL_ID
or
$ lndmanage info NODE_PUBLIC_KEY
and it will automatically detect whether you are asking for a channel or node info.
Sample output for a channel:
-------- Channel info --------
channel id: CHANIDXXXXXXXXXXXX channel point: CHANPOINTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:X
capacity: 500000 sat
blockheight: 606273
open since: 2019-10-07 13:31:24
channel age: 139.030000 days
last update: 2020-02-25 06:15:09
-------- Channel partners --------
NODEPUBKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | NODEPUBKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ALIAS 1 | ALIAS 2
base fee: 1000 msat | base fee: 1000 msat
fee rate: 0.000001 sat/sat | fee rate: 0.002500 sat/sat
time lock delta: 40 blocks | time lock delta: 14 blocks
disabled: False | disabled: False
last update: 2020-01-20 13:12:09 | last update: 2020-01-22 10:28:57
Sample output for a node:
-------- Node info --------
NODEPUBKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
alias: ALIAS
last update: 2020-02-24 16:45:09
number of channels: 44
total capacity: 33333333 sat
capacity (median): 150000 sat
capacity (mean): 500000 sat
base fee (median): 1000 msat
base fee (mean): 666 msat
fee rate (median): 0.000001 sat/sat
fee rate (mean): 0.002039 sat/sat
-------- Addresses --------
NODEPUBKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX@XX.XXX.XXX.XXX:9735
Activity Report
With lndmanage you can get a compact overview of what happened during the last day(s). It will show you forwarding activity (total forwardings, forwarding fees, and forwarding amounts) as well as channel opening and closing events by invoking
$ lndmanage report
Different time intervals can be specified with the --from-days-ago and
--to-days-ago flags.
Here is a sample report for one of the subreports. The activity histogram for the time interval is displayed as a one-line histogram, which consists of Braille-like characters.
Report from yyyy-mm-dd hh:mm to yyyy-mm-dd hh:mm
Forwardings:
activity (⣿ represents 8 forwardings):
|⠀⠀⡀⡀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⣄⠀⣀⠀⣦⣀⠀⡀⡀⠀⡀⡀⠀⡀⠀⠀⠀⠀⠀⠀⣀⣀⡀⣀⡀⡀⣀⠀⣀⡀⣄|
total forwardings: 37
forwardings per day: 37
channels with most outgoing forwardings:
cidxxxxxxxxxxxxxxx: 10
cidxxxxxxxxxxxxxxx: 6
cidxxxxxxxxxxxxxxx: 4
cidxxxxxxxxxxxxxxx: 3
cidxxxxxxxxxxxxxxx: 3
Forwarding Information
A more sophisticated way to see if funds have to be reallocated is to
have a look at the forwarding statistics of, e.g., the last two months
of the individual channels with
$ lndmanage listchannels forwardings --from-days-ago 60 --sort-by='fees'
(here sorted by total fees, but it can be sorted by any column field).
The output will look like:
-------- Description --------
cid channel id
nfwd number of forwardings
age channel age [days]
fees total fees [sat]
f/w total fees per week [sat / week]
flow flow direction (positive is outwards)
ub unbalancedness [-1 ... 1] (0 is 50:50 balanced)
bwd bandwidth demand: capacity / max(mean_in, mean_out)
r action is required
cap channel capacity [sat]
pbf peer base fee [msat]
pfr peer fee rate
annotation channel annotation
alias alias
-------- Channels --------
cid nfwd age fees f/w flow ub bwd r cap pbf pfr alias
xxxxxxxxxxxxxxxxxx 6 103 907 106.950 1.00 0.30 0.00 X 6000000 231 0.000006 abc
xxxxxxxxxxxxxxxxxx 3 82 300 35.374 -0.08 0.74 0.70 1000000 1000 0.000001 def
xxxxxxxxxxxxxxxxxx 4 32 216 25.461 0.42 0.38 0.17 X 6000000 1003 0.000003 ghi
...
Fee Optimization
The update-fees command lets you dynamically update the fee rates and base fees on your
channels. It analyzes the outward (fee-earning) forwardings that happened on them and lowers
or increases fees incrementally based on the demand. The minimal and maximal fee rate boundaries
are configurable (see update-fees -h). The fee optimization will enforce that fee rates
are not lowered, when the channel has no outbound liquidity, it economically enforces a
buffer for excess demand times.
The command will not set new fees unless the user answers with yes after the statistics output.
Example output for a channel with excess demand:
>>> Fee optimization for node XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX (node alias):
Channels with peer: 1, total capacity: 5000000, total local balance: 1033113
Outward forwarded amount: 1521253 (rate 217322 / target rate 14286)
Number of outward forwardings: 1
Fee rate change: 0.000150 -> 0.000225 (factor 1.500)
Base fee change: 0 -> 0 (factor 0.750)
> Statistics for channel XXXXXXXXXXXXXXXXXX:
ub: 0.59, flow: 0.26, fees: 226.666 sat, cap: 5000000 sat, lb: 1033113 sat, nfwd: 2, in: 895518 sat, out: 1521253 sat.
One can see that the channel routed more than the target of 14286 sat/day, so the fee rate is increased by a factor of 1.5.
Example output for a channel with no demand:
>>> Fee optimization for node XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX (node alias):
Channels with peer: 1, total capacity: 5000000, total local balance: 3134892
