{"id":48040830,"url":"https://github.com/bitromortac/lndmanage","last_synced_at":"2026-04-04T14:07:38.780Z","repository":{"id":34679317,"uuid":"180768481","full_name":"bitromortac/lndmanage","owner":"bitromortac","description":"Channel management tool for lightning network daemon (LND) operators.","archived":false,"fork":false,"pushed_at":"2024-01-09T13:20:44.000Z","size":1027,"stargazers_count":166,"open_issues_count":17,"forks_count":17,"subscribers_count":11,"default_branch":"master","last_synced_at":"2026-03-28T16:58:16.632Z","etag":null,"topics":["bitcoin","lightning","lightning-network"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitromortac.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-04-11T10:24:07.000Z","updated_at":"2026-01-30T22:32:59.000Z","dependencies_parsed_at":"2024-01-06T19:35:06.364Z","dependency_job_id":null,"html_url":"https://github.com/bitromortac/lndmanage","commit_stats":{"total_commits":334,"total_committers":16,"mean_commits":20.875,"dds":"0.13772455089820357","last_synced_commit":"9f4d5c3fb56b1766279924cd8588f96458651539"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/bitromortac/lndmanage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitromortac%2Flndmanage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitromortac%2Flndmanage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitromortac%2Flndmanage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitromortac%2Flndmanage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitromortac","download_url":"https://codeload.github.com/bitromortac/lndmanage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitromortac%2Flndmanage/sbom","scorecard":{"id":240827,"data":{"date":"2025-08-11","repo":{"name":"github.com/bitromortac/lndmanage","commit":"1aa45a7d1ba45526487ec2832becd06d342ce29f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/8 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":8,"reason":"5 out of the last 5 releases have a total of 5 signed artifacts.","details":["Info: signed release artifact: lndmanage-0.16.0-py3-none-any.whl.asc: https://github.com/bitromortac/lndmanage/releases/tag/v0.16.0","Info: signed release artifact: lndmanage-0.15.0-py3-none-any.whl.asc: https://github.com/bitromortac/lndmanage/releases/tag/v0.15.0","Info: signed release artifact: lndmanage-0.14.2-py3-none-any.whl.asc: https://github.com/bitromortac/lndmanage/releases/tag/v0.14.2","Info: signed release artifact: lndmanage-0.14.1-py3-none-any.whl.asc: https://github.com/bitromortac/lndmanage/releases/tag/v0.14.1","Info: signed release artifact: lndmanage-0.14.0-py3-none-any.whl.asc: https://github.com/bitromortac/lndmanage/releases/tag/v0.14.0","Warn: release artifact v0.16.0 does not have provenance: https://api.github.com/repos/bitromortac/lndmanage/releases/136483445","Warn: release artifact v0.15.0 does not have provenance: https://api.github.com/repos/bitromortac/lndmanage/releases/94908116","Warn: release artifact v0.14.2 does not have provenance: https://api.github.com/repos/bitromortac/lndmanage/releases/72060553","Warn: release artifact v0.14.1 does not have provenance: https://api.github.com/repos/bitromortac/lndmanage/releases/63447444","Warn: release artifact v0.14.0 does not have provenance: https://api.github.com/repos/bitromortac/lndmanage/releases/53767008"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: docker/Dockerfile:4","Warn: containerImage not pinned by hash: docker/Dockerfile:21","Warn: containerImage not pinned by hash: docker/Dockerfile.test:1","Warn: containerImage not pinned by hash: docker/Dockerfile.test:2","Warn: pipCommand not pinned by hash: docker/Dockerfile:17","Warn: pipCommand not pinned by hash: docker/Dockerfile.test:7-11","Warn: pipCommand not pinned by hash: lndmanage/grpc_compiled/build_grpc.sh:6","Warn: pipCommand not pinned by hash: lndmanage/grpc_compiled/build_grpc.sh:7","Warn: downloadThenRun not pinned by hash: lndmanage/grpc_compiled/build_grpc.sh:20","Warn: downloadThenRun not pinned by hash: lndmanage/grpc_compiled/build_grpc.sh:21","Warn: downloadThenRun not pinned by hash: lndmanage/grpc_compiled/build_grpc.sh:22","Warn: downloadThenRun not pinned by hash: lndmanage/grpc_compiled/build_grpc.sh:23","Info:   0 out of   4 containerImage dependencies pinned","Info:   0 out of   4 pipCommand dependencies pinned","Info:   0 out of   4 downloadThenRun dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T06:39:17.246Z","repository_id":34679317,"created_at":"2025-08-17T06:39:17.246Z","updated_at":"2025-08-17T06:39:17.246Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31402278,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","lightning","lightning-network"],"created_at":"2026-04-04T14:07:38.677Z","updated_at":"2026-04-04T14:07:38.763Z","avatar_url":"https://github.com/bitromortac.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/bitromortac/lndmanage/raw/master/logo.png\" style=\"max-width:100%;\" width=\"400\" /\u003e\n\u003c/p\u003e\n\u003chr /\u003e\n\n# lndmanage\nlndmanage is a command line tool for advanced channel management of an \n[LND](https://github.com/lightningnetwork/lnd) node.\n\n**DISCLAIMER: This is BETA software, so please be careful. No warranty is given.**\n\n[See installation instructions.](#setup)\n\n### Feature list:\n\n* Activity reports [```report```](#activity-report)\n* Display the node summary ```status```\n* [```info```](#info-command) command: explore info about a channel or node in the graph\n* Advanced channel listings ```listchannels```\n  * ```listchannels rebalance```: list channels for rebalancing\n  * [```listchannels forwardings```](#forwarding-information): list forwarding statistics for each channel \n  * [```listchannels hygiene```](#active-channels): information for closing of active channels\n  * [```listchannels inactive```](#inactive-channels): information on inactive channels\n* Peer listing [```listpeers```](#peer-listing): aggregated channel statistics\n* Fee updating [```update-fees```](#fee-optimization): increase revenue and rebalance by fee optimization\n* Recommendation of good nodes [```recommend-nodes```](#channel-opening-strategies)\n* Batched channel opening [```openchannels```](#batched-channel-opening)\n* Support of [```lncli```](#lncli-support)\n   \n## Command Line Options\n```\nusage: lndmanage.py [-h] [--loglevel {INFO,DEBUG}] {status,listchannels,recommend-nodes,report,info,lncli,openchannels,update-fees} ...\n\nLightning network daemon channel management tool.\n\npositional arguments:\n  {status,listchannels,recommend-nodes,report,info,lncli,openchannels,update-fees}\n    status              display node status\n    listchannels        lists channels with extended information [see also subcommands with -h]\n    listpeers           lists peers with extended information\n    recommend-nodes     recommends nodes [see also subcommands with -h]\n    report              displays reports of activity on the node\n    info                displays info on channels and nodes\n    lncli               execute lncli\n    openchannels        opens multiple channels\n    update-fees         optimize the fees on your channels to increase revenue and to automatically rebalance\n```\n\n## Info Command\nSometimes it is necessary to get more information about a specific public channel\nor node. This could be for example trying to figure out what fees are typically\ncharged by a node or to look up its IP address.\n\nWith the info command you can enter\n\n`$ lndmanage info CHANNEL_ID`\n\nor\n\n`$ lndmanage info NODE_PUBLIC_KEY`\n\nand it will automatically detect whether you are asking for a channel or node info.\n\nSample output for a channel:\n```\n-------- Channel info --------\nchannel id: CHANIDXXXXXXXXXXXX  channel point: CHANPOINTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:X\n          capacity:                 500000 sat                                                                                      \n          blockheight:              606273                                                                                          \n          open since:               2019-10-07 13:31:24                                                                             \n          channel age:              139.030000 days                                                                                  \n          last update:              2020-02-25 06:15:09                                                                             \n\n-------- Channel partners --------\nNODEPUBKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | NODEPUBKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n                       ALIAS 1                                     |                       ALIAS 2\n          base fee:                 1000 msat                      |           base fee:                 1000 msat                       \n          fee rate:                 0.000001 sat/sat               |           fee rate:                 0.002500 sat/sat              \n          time lock delta:          40 blocks                      |           time lock delta:          14 blocks                     \n          disabled:                 False                          |           disabled:                 False                         \n          last update:              2020-01-20 13:12:09            |           last update:              2020-01-22 10:28:57\n```\n\nSample output for a node:\n```\n-------- Node info --------\nNODEPUBKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n          alias:                    ALIAS                                                                                           \n          last update:              2020-02-24 16:45:09                                                                             \n          number of channels:       44                                                                                              \n          total capacity:           33333333 sat                                                                                    \n          capacity (median):        150000 sat                                                                                      \n          capacity (mean):          500000 sat                                                                                      \n          base fee (median):        1000 msat                                                                                       \n          base fee (mean):          666 msat                                                                                        \n          fee rate (median):        0.000001 sat/sat                                                                                \n          fee rate (mean):          0.002039 sat/sat                                                                                \n-------- Addresses --------\n     NODEPUBKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX@XX.XXX.XXX.XXX:9735\n```\n\n## Activity Report\nWith lndmanage you can get a compact overview of what happened during the last\nday(s). It will show you forwarding activity (total forwardings, forwarding fees,\nand forwarding amounts) as well as channel opening and closing events by invoking\n\n`$ lndmanage report`\n\nDifferent time intervals can be specified with the `--from-days-ago` and \n`--to-days-ago` flags.\n\nHere is a sample report for one of the subreports. The activity histogram for \nthe time interval is displayed as a one-line histogram, which consists of \nBraille-like characters.\n```\nReport from yyyy-mm-dd hh:mm to yyyy-mm-dd hh:mm\n\nForwardings:\n   activity (⣿ represents 8 forwardings):\n\n   |⠀⠀⡀⡀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⣄⠀⣀⠀⣦⣀⠀⡀⡀⠀⡀⡀⠀⡀⠀⠀⠀⠀⠀⠀⣀⣀⡀⣀⡀⡀⣀⠀⣀⡀⣄|\n\n   total forwardings: 37\n   forwardings per day: 37\n\n   channels with most outgoing forwardings:\n   cidxxxxxxxxxxxxxxx: 10\n   cidxxxxxxxxxxxxxxx: 6\n   cidxxxxxxxxxxxxxxx: 4\n   cidxxxxxxxxxxxxxxx: 3\n   cidxxxxxxxxxxxxxxx: 3\n```\n\n## Forwarding Information\nA more sophisticated way to see if funds have to be reallocated is to \nhave a look at the forwarding statistics of, e.g., the last two months\n of the individual channels with \n ```$ lndmanage listchannels forwardings --from-days-ago 60 --sort-by='fees'```\n (here sorted by total fees, but it can be sorted by any column field).\n\nThe output will look like:\n```\n-------- Description --------\ncid        channel id\nnfwd       number of forwardings\nage        channel age [days]\nfees       total fees [sat]\nf/w        total fees per week [sat / week]\nflow       flow direction (positive is outwards)\nub         unbalancedness [-1 ... 1] (0 is 50:50 balanced)\nbwd        bandwidth demand: capacity / max(mean_in, mean_out)\nr          action is required\ncap        channel capacity [sat]\npbf        peer base fee [msat]\npfr        peer fee rate\nannotation channel annotation\nalias      alias\n-------- Channels --------\n       cid         nfwd   age  fees     f/w  flow    ub  bwd r     cap  pbf      pfr  alias\nxxxxxxxxxxxxxxxxxx    6   103   907 106.950  1.00  0.30 0.00 X 6000000  231 0.000006    abc\nxxxxxxxxxxxxxxxxxx    3    82   300  35.374 -0.08  0.74 0.70   1000000 1000 0.000001    def\nxxxxxxxxxxxxxxxxxx    4    32   216  25.461  0.42  0.38 0.17 X 6000000 1003 0.000003    ghi\n...\n```\n\n## Fee Optimization\nThe `update-fees` command lets you dynamically update the fee rates and base fees on your\nchannels. It analyzes the outward (fee-earning) forwardings that happened on them and lowers\nor increases fees incrementally based on the demand. The minimal and maximal fee rate boundaries\nare configurable (see `update-fees -h`). The fee optimization will enforce that fee rates\nare not lowered, when the channel has no outbound liquidity, it economically enforces a\nbuffer for excess demand times.\n\nThe command will not set new fees unless the user answers with `yes` after the statistics output.\n\nExample output for a channel with excess demand:\n```\n\u003e\u003e\u003e Fee optimization for node XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX (node alias):\n    Channels with peer: 1, total capacity: 5000000, total local balance: 1033113\n    Outward forwarded amount: 1521253 (rate 217322 / target rate 14286)\n    Number of outward forwardings:      1\n    Fee rate change: 0.000150 -\u003e 0.000225 (factor 1.500)\n    Base fee change:    0 -\u003e    0 (factor 0.750)\n  \u003e Statistics for channel XXXXXXXXXXXXXXXXXX:\n    ub: 0.59, flow: 0.26, fees: 226.666 sat, cap: 5000000 sat, lb: 1033113 sat, nfwd: 2, in: 895518 sat, out: 1521253 sat.\n```\nOne 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.\n\nExample output for a channel with no demand:\n```\n\u003e\u003e\u003e Fee optimization for node XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX (node alias):\n    Channels with peer: 1, total capacity: 5000000, total local balance: 3134892\n    Outward forwarded amount:      0 (rate     0 / target rate 14286)\n    Number of outward forwardings:      0\n    Fee rate change: 0.000149 -\u003e 0.000106 (factor 0.707)\n    Base fee change:    0 -\u003e    0 (factor 0.750)\n  \u003e Statistics for channel XXXXXXXXXXXXXXXXXX:\n    ub: -0.25, flow: 0.00, fees: 0.000 sat, cap: 5000000 sat, lb: 3134892 sat, nfwd: 0, in: 0 sat, out: 0 sat.\n```\nThere was no demand on that channel, so the fee rate was decreased by a factor of 0.707.\n\nExample for an exhausted channel:\n```\n\u003e\u003e\u003e Fee optimization for node XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX (node alias)\n    Channels with peer: 1, total capacity: 2000000, total local balance: 20810\n    Outward forwarded amount:      0 (rate     0 / target rate 14286)\n    Number of outward forwardings:      0\n    Fee rate change: 0.000150 -\u003e 0.000157 (factor 1.048)\n    Base fee change:    0 -\u003e    0 (factor 0.750)\n  \u003e Statistics for channel XXXXXXXXXXXXXXXXXX:\n    ub: 0.98, flow: 0.00, fees: 0.000 sat, cap: 2000000 sat, lb: 20810 sat, nfwd: 0, in: 0 sat, out: 0 sat.\n```\nThis channel is exhausted (it only has 20810 sat left in it, or ub=0.98). Even though\nthere was no demand for this channel, the fee rate is *not* lowered, but kept roughly\nconstant (increased a bit by factor 1.048) in the hope it will be filled again by an\nincoming forwarding event.\n\nThe target for how much a channel should route per day can be set via the\n`--target-forwarding-amount-sat` config parameter. This value has direct influence on\nthe revenue, but it is unknown beforehand and every node operator has to tune it.\nA reasonable value could be half of the daily routed amount of the best-income\nchannel (see `lndmanage listchannels forwardings`). Future work will focus on setting\nthe target amount automatically on a per channel basis. After each optimization step\nforwarding statistics are collected in a json file, to use the data in the future to\nmodel the fee-demand curve. *Please report if the default parameter is way too off for you.*\n\nChannels can be exempt from fee updates via the `[excluded-channels-fee-opt]` config\nsection, see [config example](lndmanage/templates/config_sample.ini).\n\nThe `update-fees` command is meant to be run periodically. A weekly interval is\nrecommended to not put too much strain on the network, which also averages out weekly\npatterns and makes the gossip propagate also to nodes that are not always\nonline like mobile phones.\n\nA convenient way to run this command automatically (every Sunday) is via a cronjob:\n```\n$ crontab -e\n# m h  dom mon dow   command\n0 0 * * Sun lndmanage update-fees --reckless --from-days-ago 7\n```\n\n### Initial fee setting\nIf a node was bootstrapped or one is unsure which initial fees to apply, it is\nrecommended to apply high inital fee rates. This can be accomplished by\n`$ lndmanage update-fees --init`. If the node has done already some forwardings,\none can immediately follow with a `$ lndmanage update-fees --from-days-ago 30` and\nthe fees will adjust downwards or upwards depending on the historic traffic. In order\nfor opened channels to not start with a very low fee setting (and thus to prevent\nimmediate depletion), it is recommended to set a default high fee rate for channel\nopening in the lnd config:\n```\nbitcoin.feerate=2500\n```\n\n\n## Channel hygiene\n### Inactive Channels\nInactive channels ([Zombie channels](https://medium.com/@gcomxx/get-rid-of-those-zombie-channels-1267d5a2a708))\n lock up capital, which can be used elsewhere. \nIn order to close those channels it is useful to take a look\nat the inactive channels with ```$ lndmanage listchannels inactive```.\n\nYou will get an output like:\n\n```\n-------- Description --------\ncid        channel id\nlupp       last update time by peer [days ago]\npriv       channel is private\nini        true if we opened channel\nage        channel age [days]\nub         unbalancedness [-1 ... 1] (0 is 50:50 balanced)\ncap        channel capacity [sat]\nlb         local balance [sat]\nrb         remote balance [sat]\nsr/w       sent and received per week [sat]\nannotation channel annotation\nalias      alias\n\n-------- Channels --------\ncid                lupp priv ini age    ub     cap    lb   rb sr/w alias\nxxxxxxxxxxxxxxxxxx   66  ✗   ✓   71  0.03 2000000 10000  100    0   abc\nxxxxxxxxxxxxxxxxxx   20  ✗   ✗  113 -0.23   40000     0    0    0   def\nxxxxxxxxxxxxxxxxxx   19  ✓   ✗   21  1.00 1200000  1000    0    0   ghi\n...\n```\nChannels, which were updated a long time ago (```lupp```) are likely to be \ninactive in the future and may be closed. Be aware, that if you are the initiator\nof the channel, you have to pay a hefty fee for the force closing.\n\n### Active Channels\nAs well as inactive channels, active channels can lock up capital that is\nbetter directed towards other nodes. In order to facilitate the hard\ndecision whether a channel should be closed, one can have a look at the\n`$ lndmanage listchannels hygiene` command output, which will display relevant\n data of the last 60 days:\n```\n-------- Description --------\ncid        channel id\nage        channel age [days]\nnfwd       number of forwardings\nf/w        total fees per week [sat / week]\nulr        ratio of uptime to lifetime of channel [0 ... 1]\nlb         local balance [sat]\ncap        channel capacity [sat]\npbf        peer base fee [msat]\npfr        peer fee rate\nannotation channel annotation\nalias      alias\n-------- Channels --------\n       cid           age  nfwd    f/w   ulr        lb       cap   pbf      pfr alias           \nxxxxxxxxxxxxxxxxxx   315     0   0.00  0.20       100     91000  1000 0.000001 abc \nxxxxxxxxxxxxxxxxxx   221     0   0.00  0.80         0    400000  1000 0.000001 def \nxxxxxxxxxxxxxxxxxx    36     0   0.00  0.99         0    200000  1000 0.000001 ghi \nxxxxxxxxxxxxxxxxxx    24     5   0.20  1.00    100000   4000000   500 0.000001 jkl \nxxxxxxxxxxxxxxxxxx   117    10   1.10  1.00     30000    500000  1000 0.000001 mno\n```\nYou can base your decision on the number of forwardings `nfwd` and the fees\ncollected per week `f/w`. If those numbers are low and the local balance `lb`\nis high and the channel already had enough time (`age`) to prove itself, you\nmay want to consider closing the channel. Another way to judge the reliability\nof the channel is to look at the proportion the channel stayed active when\nyour node was active, given by the `ulr` column.\n\n## Peer listing\nThe command `$ lndmanage listpeers` will show aggregated statistics for channels. This\nis important if one has for example a public channel (for route advertisement), but\nother channels are kept private. Care must be taken that always at least a single channel\nis public, which is indicated by the `maximum public channel capacity`. `listpeers` shows\nstatistics  such as total incoming and outgoing forwarding amounts as well as total local\nand remote balance. Subcommands `listpeers in` or `listpeers out` can be used to sort by\nincoming or outgoing traffic.\n\n## Channel Opening Strategies\nWhich nodes best to connect to in the Lightning Network is ongoing research. \nThis also depends on your personal use case, whether you are a paying user, \na routing node operator or a service provider (or subsets of those). Therefore\nwe need to empirically test, what _good nodes_ mean to us. lndmanage gives you a\nfew options to chose nodes from the network based on several heuristics:\n\n* ```recommend-nodes good-old```: Based on historic forwardings of closed\nchannels, a list of nodes is compiled with which your node has already\nhad a good relationship. Due to that relationship, good interaction with that\nnode in the future is likely.\n* ```recommend-nodes flow-analysis```: If your node has already routed\npayments, you can use this information to your favor. If you want to improve\nyour position in the Lightning Network for routing, you may want to look for\n need of inbound liquidity. This can be achieved by estimating the \n probability where the payments you routed were ending up. If you connect to\n those nodes directly you bypass other routing nodes.\n* ```recommend-nodes external-source```: This command lets you access text-based\nlists of nodes, which are associated with economic activity. You can provide a\nURL, which is parsed for node public keys and suggests nodes to connect to\n(defaults to the list of [lightning networkstores](http://lightningnetworkstores.com)).\nAnother example of the command using 'bos-scores' is \n`$ lndmanage recommend-nodes external-source --source https://nodes.lightning.computer/availability/v1/btc.json`.\n* ```recommend-nodes channel-openings```: When lightning nodes of new services\n are bootstrapped by opening a bunch of channels at the same time,\n we can detect this. Typically, a node with a large number of channel\n  fluctuation signals economic activity. As the newly opened channels will \n  predominantly be of outbound type, the node will have a large\n demand for inbound liquidity, which is something you want to exploit as a\n routing node.\n* ```recommend-nodes second-neighbors```: One way of improving the position of the node\nin the network is to get connected to as many as possible other nodes\nwith a least number of additional hops. With the `second-neighbors` command\nyou can get a list of nodes that would give you the most new second neighbors,\n if you would open up a channel with.\n\nlndmanage supports a __channel annotation functionality__. This serves for\n remembering why a certain channel was opened. By adding the funding\ntransaction id or channel id to the config file `~/.lndmanage/config.ini`\nunder the `annotations` section (as specified in \n[`config_sample.ini`](lndmanage/templates/config_sample.ini)), annotations\ncan be saved. These annotations will then appear in the `listchannels` views.\n\n## Batched Channel Opening\nlndmanage supports batched channel opening wrapping LND's batchopen command. With this \ncommand you can specify node pubkeys, amounts or a total amount for your channels.\n\n## Support of lncli\nlndmanage supports the native command line interface of `lnd` in interactive mode.\nThis achieves the goal of having to only open one terminal window for node\nmanagement and enables an easy way to run `lncli` from remote machines. In\ninteractive mode `lncli` is available as it would be via command line, e.g.:\n\n`$ lndmangage lncli getinfo`\n\nThe json text output you get from `lncli` is syntax highlighted. To enable\n`lncli` support, lndmanage needs to find the `lncli` executable on the path, or\nin the `~/.lndmanage` home folder (or environment variable `LNDMANAGE_HOME`).\nTo get the `lncli` binary, copy it over from your `$GOPATH/bin/lncli`, compile it\nyourself, or download one of the official [releases](https://github.com/lightningnetwork/lnd/releases).\n*If lndmanage runs on the same host as `lnd` you typically don't have to do\nanything.* To check if it's working you should see\n`Enabled lncli: using /path/to/lncli` and be able to access the `lncli` option.\n\n## Setup\nlndmanage will be developed in lockstep with lnd and tagged accordingly. \nIf you are running an older version of lnd checkout the according \n[tag](https://github.com/bitromortac/lndmanage/releases).\n\n### Requirements\nInstallation of lndmanage requires `\u003e=python3.8`, `lnd v0.16.x`, `python3-venv`.\n\n#### Optional Requirements\nDepending on if you want to install from source dependency packages you may\nneed `gcc`, `g++`, `python3-dev(el)`.\n\n#### LND Build Requirements\nSome commands will only work correctly if lnd is built with the `routerrpc`.\nThis can be done when compiling with minimal build tags of `make \u0026\u0026 make install \ntags=\"routerrpc signrpc walletrpc\"`. If you use precompiled binaries, you can \nignore this.\n\n#### Macaroon and TLS cert needed\nIf you run this tool from a different host than the lnd host, \nmake sure to copy `/path/to/.lnd/data/chain/bitcoin/mainnet/readonly.macaroon`\nand `/path/to/.lnd/tls.cert` to your local machine, which you need for later\nconfiguration.\n\nNote that if you want to run `update-fees` or `openchannels` you will need to\ncreate a custom macaroon, see `scripts/bakemacaroon.sh`. Don't use\n`admin.macaroon`, which is not recommended for best security practices.\n\n#### Signature verification\nCommits and releases are signed with key `1965 063F C13B EBE2` available via\n\n`$ curl https://keybase.io/bitromortac/pgp_keys.asc | gpg --import`\n\nor \n\n`$ curl https://github.com/bitromortac.gpg | gpg --import`\n\n### Linux\n\nYou can install lndmanage via three methods:\n\n1\\. Install from repository:\n```\n$ git clone https://github.com/bitromortac/lndmanage \u0026\u0026 cd lndmanage\n$ git checkout v0.16.0\n$ python3 -m venv venv\n$ git verify-commit HEAD\n$ source venv/bin/activate\n$ pip install --upgrade pip setuptools wheel\n$ pip install .\n```\n\n2\\. Via released assets:\n* Go to the release page https://github.com/bitromortac/lndmanage/releases\n* Download `.whl` and `.whl.asc` files\n* Verify signature and install:\n```\n$ gpg --verify lndmanage-0.16.0-py3-none-any.whl.asc lndmanage-0.16.0-py3-none-any.whl\n$ python3 -m venv venv\n$ source venv/bin/activate\n$ pip install --upgrade pip setuptools wheel\n$ pip install lndmanage-0.16.0-py3-none-any.whl\n```\n\n3\\. Install with pip (deprecated):\n```\n$ python3 -m venv venv\n$ source venv/bin/activate\n$ pip install --upgrade pip setuptools wheel\n$ python3 -m pip install lndmanage\n```\n\n### Windows (powershell)\nInstall [python3](https://www.python.org/downloads/release/python-374/),\n[git](https://git-scm.com/download/win), and\n [visual studio build tools](https://visualstudio.microsoft.com/en/downloads/?q=build+tools).\n\nYou need to set the environment variable `PYTHONIOENCODING` for proper encoding to:\n`$env:PYTHONIOENCODING=\"UTF-8\"`\n\n1\\. Install from source:\n```\n$ git clone https://github.com/bitromortac/lndmanage\n$ cd lndmanage\n$ git checkout v0.16.0\n$ git verify-commit HEAD\n$ py -m venv venv\n$ .\\venv\\Scripts\\activate\n$ pip install --upgrade pip setuptools wheel\n$ pip install .\n```\n\n2\\. Install with pip (deprecated):\n```\n$ py -m venv venv\n$ .\\venv\\Scripts\\activate\n$ pip install --upgrade pip setuptools wheel\n$ python -m pip install lndmanage\n```\n\n### Configuration\n\nWhen starting lndmanage for the first time, it will create a runtime folder \n`/home/user/.lndmanage`, where the configuration `config.ini` and log files\n reside. This folder location can be overwritten by setting an environment \n variable `LNDMANAGE_HOME`. If you run this tool from a remote host to the lnd\n host, you need to configure `config.ini`.\n\n### Running lndmanage\n\nThe installation process created an executable `lndmanage`, which will\nonly be available if the created python environment is active (your prompt \nshould have an `(venv)` in front):\n```\n$ source venv/bin/activate\n```\nthen run\n```\n(venv) $ lndmanage status\n```\nIf it works, you should see the node status.\n\n**Running lndmanage interactively (recommended)**\n\nlndmanage supports an interactive mode with command history. The interactive\nmode has the advantage that the network graph has to be read into memory only\nonce, giving a much faster execution time for subsequent command invocations.\n\nInteractive mode is started by calling lndmanage without arguments:\n```bash\n$ lndmanage\nRunning in interactive mode. You can type 'help' or 'exit'.\n$ lndmanage listchannels forwardings\n\u003coutput\u003e\n$ lndmanage exit\n```\nCommands that can be entered are the ones you would give as arguments.\n\n## Testing\nRequirements are an installation of [lnregtest](https://github.com/bitromortac/lnregtest)\nand links to bitcoind, bitcoin-cli, lnd, and lncli in the `test/bin` folder.\n\nTests can be run with\n`python3 -m unittest discover test`\nfrom the root folder.\n\n## gRPC Reproducibility\nNote that this repository ships prebuilt gRPC interfaces to communicate with LND.\nThese libraries (located in `lndmanage/grpc_compiled`) contain code that is hard\nto review and should not be trusted. In order to check that the libraries indeed\ncan be reproduced from the LND repository, one can run the `build_grpc.sh`\nscript and observe differences via git.\n\n## Docker\n\nIf you prefer to run `lndmanage` from a docker container, `cd docker` \nand follow the [`README`](docker/README.md) there.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitromortac%2Flndmanage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitromortac%2Flndmanage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitromortac%2Flndmanage/lists"}