Giter VIP home page Giter VIP logo

lightning-jet's Introduction

License

Lightning Jet ๐Ÿš€โšก๏ธ, or simply Jet

Lightning Jet is a fully automated rebalancer for nodes on the Lightning Network. Jet facilitates routing by moving channel liquidity to where its needed the most, taking into account routing volume, missed routing opportunities (htlcs), and a variety of other factors.

Jet runs as a daemon (background service) on a broad range of supported platforms. It categorizes peers into inbound and outbound based on routing volume; it then rebalances the channels (via circular rebalancing), ensuring sufficient liquidity (inbound and outbound) for bi-directional routing.

Lightning Jet's mission is to assist independent node operators in competing in the ever-changing landscape of the Lightning Network as large institutional players enter the space.

Join Lightning Jet telegram chat.

Supported Platforms

You can install Lightning Jet on a laptop, desktop, Raspberry Pi, RaspiBlitz, myNode and other platforms.

You can use Lightning Jet to rebalance your node in Voltage Cloud. In this setup, Jet will connect to your node remotely via a secure connection.

You can install and run Lightning Jet in Docker (for advanced users with prior Docker experience).

Jet is available on EmbassyOS and can rebalance channels on Start9 products that run the OS.

Jet can be installed in Ubuntu VM on Windows, Mac OS, and other platforms.

Prerequisites

Make sure to install node if you don't have it already. Run node -v to check if you have node and whether it is up to date (version 16.x+). Update node in case of an old version (this will also update npm).

curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs

The above command updates node binaries. Alternatively, you can download an installable for your platform.

Make sure npm is up to date (version 8.x) by running npm -v. Update npm in case of an old version; refer to node update steps above.

You may run into an issue of having multiple copies of npm installed if you update npm separately from node. Re-run npm -v after the update to ensure that your path is picking the update version. You can locate multiple copies by find / -name npm 2> /dev/null; identify the right copy of npm and update PATH in ~/.profile accordingly.

Installation

git clone https://github.com/itsneski/lightning-jet
cd lightning-jet
npm install
nano ./api/config.json

Edit config.json: set correct absolute (not relative) paths for macaroonPath and tlsCertPath. On umbrel, macaroons are typically located at /home/umbrel/umbrel/lnd/data/chain/bitcoin/mainnet/admin.macaroon, tls cert is at /home/umbrel/umbrel/lnd/tls.cert.

On umbrel0.5.0+, macaroons are located at /home/umbrel/umbrel/app-data/lightning/data/lnd/data/chain/bitcoin/mainnet/admin.macaroon and tls cert at /home/umbrel/umbrel/app-data/lightning/data/lnd/tls.cert.

nano ~/.profile

Edit .profile: add a prefix $HOME/lightning-jet: to the line that says export PATH=. The line should look like this:

export PATH="$HOME/lightning-jet:<rest of your path, leave it as is>"

Add export PATH=$HOME/lightning-jet:$PATH to the end of .profile if the line does not exist.

Next, execute the updated .profile for your current terminal session. The path will be set automatically for all new sessions.

. ~/.profile

Test your path by running jet -v. Your path is set correctly if it prints out help. Fix the PATH in ~/.profile in case of an error.

Upgrade to Umbrel0.5.0 (Umbrel5)

Umbrel5 changed the location of macaroons and tls cert files. Edit config file to set correct paths for macaroons at /home/umbrel/umbrel/app-data/lightning/data/lnd/data/chain/bitcoin/mainnet/admin.macaroon and tls cert at /home/umbrel/umbrel/app-data/lightning/data/lnd/tls.cert.

nano ./api/config.json

RaspiBlitz

  • Install JET (following the above steps)
  • Set the following in config.json:
"macaroonPath": "/home/bos/.lnd/data/chain/bitcoin/mainnet/admin.macaroon"
"tlsCertPath": "/home/bos/.lnd/tls.cert"

The following step may not be necessary in case you get read access to channel.db via a symlink.

chmod +r /home/bos/.lnd/data/chain/bitcoin/mainnet/admin.macaroon

Start Jet

jet start daddy

The above is a watchdog service that will start and keep-alive rest of the sevices.

Familiarize yourself with Database Management and Logging.

How to use

Jet runs as a daemon (background process). You can interact with Jet by using the following command line tools:

jet help

Examples:

jet peers Lists peers classified into inbound, outbound, and low-volume based on htlc history. Notable columns: p - % of [inbound or outbound] routing by the peer out of a total [inbound or outbound] across all peers; ppm - peer's current ppm rate; margin - rebalance will be profitable as long as its ppm is below the margin.
jet monitor Monitors ongoing rebalances, rebalance history, and stuck htlcs. Warns about the state of BOLT database (channel.db); for example, jet will warn when the channel.db grows over a threshold.
jet monitor --status Monitors the status of rebalances; shows whether rebalances are paused or active; provides recommendation for local ppm range.
jet stats Displays profitability metrics over a time period, including delta(s) with previous time period. Node operators can use this tool to A/B test new channels and fee updates on existing channels.
jet probes Displays nodes (discovered during probes) that have signaled a commitment to liquidity. This tool can be used to identify prospects for new channels.
jet htlc-analyzer Analyzes failed htlcs and lists peers sorted based on missed routing opportunities. Missed routing opportunities are typically due to [outbound] peers not having sufficient liquidity and/or having low fees.
jet htlc-analyzer ln2me --hours 12 Shows missed routing opportunities for ln2me node over the past 12 hours.
jet analyze-fees Analyzes fees for [outbound] peers and recommends whether to increase or decrease fees based on routing history.
jet analyze-fees WalletOfSatoshi Analyzes fees for WalletOfSatoshi and recommends to increase or decrease fees based on routing history.
jet fee-history Shows fee history for all peers.
jet fee-history d++ Shows fee history for d++.
jet htlc-history Shows total sats that peers routed based on htlc history. Notable columns: % of inbound or outbound routing by a peer out of total [inbound or outbound] across all peers; d% of [inbound or outbound] routing by a peer out of total routing [inbound & outbound] by the peer.
jet rebalance-history --hours 12 Shows rebalance history for all peers over the past 12 hours.
jet rebalance-history coingate --hours 12 Shows rebalance history for coingate over the past 12 hours.
jet rebalance d++ neski 500000 --ppm 550 --mins 30 Circular rebalance from dplus to neski for 5mil sats with 550 max ppm and a max runtime of 30 mins.
jet update-channel 769123776873431041 --base 1 --ppm 375 Sets the base fee to 1 msat and ppm to 375 sats per million for a channel with id of 769123776873431041.
jet reconnect Reconnects to disconnected peers (via BalancesOfSatoshis (bos) api)

Docker

This installation is for advanced users with prior Docker experiece. Refer here for a host-based installation on a laptop, desktop, Raspberry Pi, RaspiBlitz, myNode and other platforms.

Prerequisites

Installation

git clone https://github.com/itsneski/lightning-jet
cd lightning-jet
. docker/genconfig.sh

Edit $HOME/.lightning-jet/config.json: set correct paths for macaroonPath and tlsCertPath. On Umbrel, macaroons are located at /home/umbrel/umbrel/lnd/data/chain/bitcoin/mainnet/admin.macaroon, tls cert is at /home/umbrel/umbrel/lnd/tls.cert. Optional: list expensive nodes to avoid in the avoid section.

nano $HOME/.lightning-jet/config.json

Edit the docker/.env: set LND_DIR to your installation of LND (typically /home/umbrel/umbrel/lnd). Set LND_HOSTNAME and LND_IP_ADDRESS to match your instance of LND. On Umbrel you can leave default LND_HOSTNAME. For LND_IP_ADDRESS run ifconfig -a | grep inet then select IP address that begins with 10.. Make sure that LND_CONFIG_FILE path is correct.

nano docker/.env

Build image

docker-compose -f docker/docker-compose.yml build

This make take a while, make sure not to interrupt the process.

Start up daddy

docker-compose -f docker/docker-compose.yml up

Execute commands

Prepend all commands with docker exec -it lightning-jet:

docker exec -it lightning-jet jet help

Ubuntu VM

Lightning Jet can be installed in Ubuntu VM on Windows, Mac OS, and other platforms.

  1. Install VirtualBox and set up Ubuntu image

  2. Add user to the sudo group

  3. Install curl: sudo snap install curl

  4. Install node

  5. Install git: sudo apt install git

  6. Install jet

  7. Copy over admin.macaroon (and tls.cert if needed) as in Voltage Cloud

Voltage Cloud

Lightning Jet can rebalance your node in Voltage Cloud by connecting to it remotely via a secure grpc connection. You can select any platform (host-based or cloud, like AWS) to install Jet as long as it supports Node. Jet runs as a daemon (background process), so its best to select a platform that supports running Jet 24/7.

  1. Download admin.macaroon from Voltage Cloud, the option is visible on the front page when you log into the dashboard. Remember the location where you downloaded the file.

  2. Install Jet, skip the section that edits config.json. Run jet -v to ensure you get a valid response.

  3. Create a folder under lightning-jet, say voltage, and move admin.macaroon there. This will ensure that the macaroon file won't get accidentally deleted.

Next, update config.json by nano api/config.json:

  1. Set macaroonPath to the absolute (not relative) path of admin.macaroon file from the previous step, e.g. /home/umbrel/lightning-jet/voltage/admin.macaroon if on umbrel.

  2. Remove tlsCertPath from the config.

  3. Add serverAddress to config that points at API Endpoint, you can find it on the front page of Voltage Cloud dashboard. The value should be in the following format: <node alias>.m.voltageapp.io:10009.

Example of config file:

{
  "avoid": [
  ],
  "macaroonPath": "/home/umbrel/lightning-jet/voltage/admin.macaroon",
  "serverAddress": "<node alias>.m.voltageapp.io:10009",
  "debugMode": false,
  "rebalancer": {
    "maxTime": 30,
    "maxPpm": 650,
    "maxAutoPpm": 500,
    "maxInstances": 40,
    "maxPendingHtlcs": 4,
    "enforceMaxPpm": false,
    "exclude": [
    ]
  }
}

Run jet peers once installation is completed and ensure you get a correct answer as opposed to an error. jet start daddy to kick off Jet's automated rebalancer.

Telegram bot

Lightning Jet telegram bot (jet bot) will notify you about important events such as changes in fees for your remote peers.

To create jet bot: initiate a conversation with BotFather on your Telegram app. Then, select the bot's name (e.g., JET bot) and bot's username (e.g., JET_bot).

Copy the telegram token from the Telegram app chat with BotFather (right under 'Use this token to access the HTTP API:'). nano ./api/config.json to add the telegramToken setting with the above value (see config file example below).

jet start telegram to kick off the service. Make sure there are no errors. Then open a chat with the bot you just created in your Telegram app and type /start. This will kick off the communication between the Telegram bot with Jet. You only need to do this step once.

Make sure to restart the telegram service if it was already running prior to updating the config file: jet restart telegram.

Database management

Jet uses sqlite database to store operational data. The database is located under ./db/jet.db. You can monitor the size of individual tables by jet info --db. Jet automatically cleans old records, with the exception of two tables: rebalance_history that stores the history of rebalances and channel_events that stores the history of channel events (open/closed, active/inactive). To manage the size of those tables, first check the size by jet info --db, then add the following variables to config, set them to desired history depth (in days):

{
  ...
  "db": {
    "maxRebalanceHistoryDepth": "180",
    "maxChannelEventsDepth": "180"
  }
}

In the above example, the rebalance_history and channel_events table depth is set to 180 days.

Restart the worker service: jet restart worker.

Logging

Each jet's service has a separate log file under /tmp directory: /tmp/jet-daddy.log, /tmp/jet-rebalancer.log, /tmp/jet-telegram.log, etc. Individual rebalances have separate log files under /tmp in the following format /tmp/rebalance_*. For example, /tmp/rebalance_WalletOfSatoshi_LNBiGlnd03.log corresponds to a rebalance from Wallet of Satosh to LNBig.

By default, the log level is set to info, with info, warnings and errors being logged. To see debug-level information, set the log level to debug by adding the following setting to the config:

{
  ...
  "log": {
    "level": "debug"
  }
}

Restart the service(s) for the setting to take effect.

Config file

A list of config settings under ./api/config.json:

macaroonPath admin.macaroon absolute path for Jet connect to LND.
tlsCertPath tls cert absolute path for Jet connect to LND.
serverAddress server address and port number of lnd host; defaults to localhost:10009.
telegramToken The telegram bot token.
avoid A list of nodes to avoid during manual and automated rebalances. jet rebalance avoids expensive nodes automatically. the avoid setting can help speed things up by providing a static list of nodes to avoid.

Settings under rebalancer section:

maxPpm Maximum ppm for manual rebalances.
maxAutoPpm Maximum ppm for automated rebalances. This setting is typically lower than maxPpm since automated rebalances can spend more time looking for a cheaper route than manual rebalances.
maxTime Timeout rebalance after N minutes. This setting can be overridden by jet rebalance --mins parameter for manual rebalances.
maxInstances Maximum rebalance instances that the auto rebalancer can launch. Keep this setting lower if your node gets overloaded (e.g., monitor by top command).
maxPendingHtlcs Maximum number of pending htlcs that a peer can have for circular rebalance. Rebalance will be skipped otherwise.
enforceMaxPpm Controls whether jet will enforce max ppm default set by maxAutoPpm for all rebalances. By default, as long as rebalances are still profitable, jet may override the default max ppm with [outbound] peer's local ppm. With enforceMaxPpm set to true jet will cap the rebalances bymaxAutoPpm. The downside is that it may reduce the rebalance success rate for peers with local ppm being higher than the default max ppm.
enforceProfitability When set to true, jet will pause all non profitable automated rebalances, leaving only profitable rebalances. Monitor rebalance status by jet monitor --status
minCapacity Sets minimum capacity (in sats) for channels to be included in automated rebalancing. For example, "minCapacity": 500000 means that channels with capacity below or equal to 500000 sats will be excluded from automated rebalancing.
buffer Minimum rebalance buffer in sats, overrides default value of 250. Jet will warn when the delta between local and remote ppm for outbound and balanced peers is below the buffer.
disabled When set to true, the setting disables automated rebalancer. You can still rebalance manually via jet rebalance. Requires restart of the daddy service jet restart daddy followed by jet stop rebalancer.
exclude A list of nodes to exclude from auto rebalancing. In terms of terminology, rebalance A -> B means that liquidity is moving from the local side of channel [with peer] A to the local side of channel with B. "exclude": ["A:from", "B:to", "C:all"] ensures that A won't be rebalanced from, B won't be rebalanced into, and C won't participate in the rebalancing at all. p.s. previous "A:inbound" is equivalent to "A:from", and "B:outbound" is equivalent to "B:to".

Example:

{
  "avoid": [
    "03d2e20bc19d995098ba357157a9cfbfbfdff4b78fce5ec713128e988e0115d776",
    "03f80288f858251aed6f70142fab79dede5427a0ff4b618707bd0a616527a8cec7"
  ],
  "macaroonPath": "/home/umbrel/umbrel/lnd/data/chain/bitcoin/mainnet/admin.macaroon",
  "tlsCertPath": "/home/umbrel/umbrel/lnd/tls.cert",
  "debugMode": false,
  "telegramToken": "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11",
  "rebalancer": {
    "maxTime": 30,
    "maxPpm": 650,
    "maxAutoPpm": 500,
    "maxInstances": 10,
    "enforceMaxPpm": false,
    "exclude": [
    ]
  }
}

lightning-jet's People

Contributors

cameri avatar itsneski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lightning-jet's Issues

Add an option to enforce maxAutoPpm

Add an option to enforce maxAutoPpm to be respected, as with some nodes, the rebalancing can get very expensive after the fees have been adjusted according to the suggestions from jet analyze-fees

No active rebalances show in jet monitor but as ongoing process in ps -aux

After stopping auto-rebalance no active rebalances where shown as expected...

image

Then I changed the maxAutoPpm to 300 in config.json

telegram-cloud-photo-size-4-6037144935251162842-y

After the restart of auto-rebalance the newly set fees where not picked up:

telegram-cloud-photo-size-4-6037144935251162792-y

So I stopped auto-rebalance again but 16 processes where still showing up when checking using:

ps -aux | grep 'bos rebalance'

So I think there might be an issue :-)
telegram-cloud-photo-size-4-6037144935251162828-y

Rebalance max fee based on profit margin (eg, LOOP)

It would be nice to have the max ppm fees take profitability margin into account and adjust itself accordingly - instead of being fixed. While setting a overall max fee works for most channels, it fails in cases where the fee rate is too high. As it should in order to limit the total cost.

LOOP is one such example where my fee (lc_rate) is high enough that it would make sense(profitable) to re-balance it with even a higher fee than the current 500ppm - it should start with lowest fee possible and in case it fails because of low fees, should try with a higher fee rate as long as it is profitable to do so, taking rebalance fee & fee earning opportunity for the amount being rebalanced.

feature request

When jet tries to rebalance and fails due to high fee, it sees the min fee that would be required to rebalance. So would be great if it could save this data and provide it as a recomendation per peer, like rebalance will likely to go through with X ppm

jet telegram bot should warn about excessive number of failedtofindpath errors

lnd creates a cache of the graph for forwards (optimization). in case of graph errors, cache records may cause failedtofindpath errors to linger. calling deleteforwardingreputations (bos call deleteforwardingreputations) clears out the cache.

Have jet telegram warn about an excessive number of failedtofindpath errors, and consider calling deleteforwardingreputations automatically when the number of errors exceeds a threshold.

Monitor Errors Out on Unknown Node

A node opened a channel to me, but it seems like their node is new and not known to the network. Jet monitor exited with an error. It seems that I won't be able to use monitor until this node is known.

node: 021358c92d60fa9fc4abbdd0645de3ee581d27ee9366d897317aa344a8f3768b26, error: Error: 5 NOT_FOUND: unable to find node
(node:18087) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'node' of null
    at /home/bos/lightning-jet/api/utils.js:163:20
    at Array.forEach (<anonymous>)
    at listForcedClosingFormattedSync (/home/bos/lightning-jet/api/utils.js:162:17)
    at runMonitorLoop (/home/bos/lightning-jet/jet:377:16)
    at /home/bos/lightning-jet/jet:315:7
    at new Promise (<anonymous>)
    at Command._action (/home/bos/lightning-jet/jet:313:12)
    at Command._run (/home/bos/lightning-jet/node_modules/caporal/lib/command.js:483:42)
    at Program._run (/home/bos/lightning-jet/node_modules/caporal/lib/program.js:183:16)
    at Program.parse (/home/bos/lightning-jet/node_modules/caporal/lib/program.js:289:17)
    at Object.<anonymous> (/home/bos/lightning-jet/jet:342:5)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:18087) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:18087) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

SQLITE busy: database is locked

While a single circular rebalance was in progress, I did a dry run using autorebalance.js

node service/autorebalance.js --dryrun

The circular rebalance finished successfully...

image

... but the following error was reported:

telegram-cloud-photo-size-4-6026268093782800209-y

Output of autorebalance:
autorebalance.log

Rebalance Instances Over-limit

Raspiblitz 1.7.1
lightning-jet v 1.3.0 (installed under bos user)

Observed more rebalance instances than the limit set in the config.json.

  • Config.json contains: "maxInstances": 10,
  • Counted (18) node /home/bos/lightning-jet/jet rebalance ... processes in htop
  • jet monitor displays 14 rebalances in progress

Add docker-compose.yml

Add a docker-compose.yml so it's easier to bring up a docker container using Docker compose.

Fine Control for Excluding Peers from Rebalances

Per discussion, current implementation of exclude in the config.json: "excludes nodes classified as outbound or balanced, it does not exclude inbound nodes."

In my experience I have had a couple of special cases where I wanted to, e.g. (1) exclude outbound rebalances from an inbound peer
or (2) exclude outbound rebalances on an outbound peer (new channel, 100% local). From these experiences I was thinking there might be value in having finer control of how peers are excluded: either entirely, in only the outbound direction, or only in the inbound direction.

Neski, [11/20/2021 21:38]
[In reply to Neski]
@NanIthilHODL for example:

"exclude": [
"pub id1:all" ,
"pub id2:inbound"
"pub id3:outbound"
]

will exlcude pub id1 from inbound and outbound rebalance peers, pub id2 from inbound, and pub id3 from outbound peers.

Rebalances may get stalled if a particular peer keeps on erroring out

Scenario: a peer, at the top of the rebalancing list, keeps on erroring out (fee too high, failed to find path, etc). This may prevent other [outbound] peers from being rebalanced. In the worst cases, a "bad" peer can completely stall rebalancer, even though it is unlikely.

jet monitor "stuck htlcs"

I find the naming "stuck htlcs" a kind of confusing, may I suggest to rename it to "active htlc's" :-)

image

channel.db is not accessible by jet on RaspiBlitz

Jet monitors the size of channel.db and notifies via telegram when the size goes over a limit. On RaspiBlitz, channel.db runs from the bitcoin:bitcoin account, whereas jet runs from the bos (BalanceOfSatoshis) account. Subsequently, jet does not have read access to the channel.db and can not notify via telegram when the channel.db size goes over the limit.

htlc analyzer crashes when there are no htlcs

Log:

[cameri@umbrel lightning-jet-config]$ sudo docker exec -it lightning-jet cat /tmp/autorebalance.log
max commands: 10
max ppm: 500
max pending htlcs: 4
classifying peers...
no events found
classify: TypeError: Cannot read properties of undefined (reading 'peers')
    at classifyPeersAnalyzer (/app/api/htlc-analyzer.js:20:16)
    at classify (/app/service/autorebalance.js:125:18)
    at Object.<anonymous> (/app/service/autorebalance.js:100:1)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47
finished classifying
12/31 05:16 AM
generating htlc history...

--------------------------------
12/31 05:16 AM
runLoop error: TypeError: Cannot read properties of undefined (reading 'inbound')
TypeError: Cannot read properties of undefined (reading 'inbound')
    at runLoopExec (/app/service/autorebalance.js:157:14)
    at runLoop (/app/service/autorebalance.js:139:5)
    at Object.<anonymous> (/app/service/autorebalance.js:106:1)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47

Add documentation for docker

Currently there's no documentation for docker on:

  • how to build the docker image from source
  • how to publish (git tags?)
  • how to run with mynode
  • how to run with raspiblitz
  • how to run with umbrel
  • how to run with native setup
  • how to run commands on docker container

Replace config.json with config.yaml

This is a suggestion only :-)

Unfortunately the JSON file format doesn't allow any comments and I would like to suggest the use of YAML

WHY?
I find it laboriously as a noob to keep separate notes and would appreciate it very much to have the possibility to comment things I change in config.json, as my old brain is not so fit anymore :-)

Especially the entries for "avoid" and "exclude" which are pubkeys.

Multiple misspelling in instructions

"To create jet bot: initiate a converation with BotFarther on your Telegram app. Select bot's name (e.g. JET bot) and bot's username (e.g. jet_bot)."

Should read: "To create jet bot: initiate a conversation with BotFather on your Telegram app. Select bot's name (e.g. JET bot) and bot's username (e.g. jet_bot)."

Jet services stopped during node update

I recently updated my umbrel to the latest version. I updated using the UI dashboard of umbrel. After a long while, realised the jet services are not running. Here are the logs that may help investigate further:

11/15 06:23 PM
error running the loop: Error: Error: 2 UNKNOWN: waiting to start, RPC services not available
Error: async hook stack has become corrupted (actual: 148726, expected: 1150)
 1: 0xa5834 node::AsyncWrap::PopAsyncContext(v8::FunctionCallbackInfo<v8::Value> const&) [node]
 2: 0xd2a7c  [node]
 3: 0xd9a4  [node]
 4: 0xd3f20 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
 5: 0x1916c  [node]

the timing of the error is close to when I updated my node, leading to the suspicion that it was due to the restart of the node that some file got corrupted and led to the services conking up.

Rebalancer Error (Raspiblitz)

After running 1.3.0 rebalancer gets "stuck." I.e., jet monitor thinks rebalances are in process and in fact associated processes are running, but no htlcs appear, rebalances never countdown, etc.

Runining on Raspiblitz 1.7.1, lightning-jet installed under the "bos" user.

Example error from rebalance log follows:

* rebalancing from BCash_Is_Trash to SeasickDiver
* remaining amount: 1,000,000
* time left: 30 mins
(node:9153) UnhandledPromiseRejectionWarning: Error: Cannot find module 'balanceofsatoshis/lnd'
Require stack:
- /home/bos/lightning-jet/bos/rebalance.js
- /home/bos/lightning-jet/api/rebalance.js
- /home/bos/lightning-jet/jet
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at lazy (/home/bos/lightning-jet/node_modules/import-lazy/index.js:3:33)
    at Object.get (/home/bos/lightning-jet/node_modules/import-lazy/index.js:11:22)
    at lndForNode (/home/bos/lightning-jet/bos/rebalance.js:5:42)
    at Object.rebalance (/home/bos/lightning-jet/bos/rebalance.js:67:29)
    at rebalanceSync (/home/bos/lightning-jet/bos/rebalance.js:23:20)
    at module.exports (/home/bos/lightning-jet/api/rebalance.js:232:20)
    at Object.apply (/home/bos/lightning-jet/node_modules/import-lazy/index.js:16:20)
    at /home/bos/lightning-jet/jet:95:7
    at new Promise (<anonymous>)
    at Command._action (/home/bos/lightning-jet/jet:92:12)
    at Command._run (/home/bos/lightning-jet/node_modules/caporal/lib/command.js:483:42)
    at Program._run (/home/bos/lightning-jet/node_modules/caporal/lib/program.js:183:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:9153) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:9153) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Show full rebalance history

It's hard to set the minutes correctly when trying to retrieve all the past rebalances using jet rebalance-history [mins]

At the moment I have to approach it and increase the [mins] value until the following error is thrown :-)

image

May I suggest to modify the code, so that the default without [mins] value shows all rebalances

Also a filtering possibility would be great, although it can be done with grep, e.g.

jet rebalance-history 13000 | grep 'success'

jet.db: rebalance-generated htlc failures should be skipped

Rebalance generated htlc failures are being recorded in the htlc log file from jet.db

It would be ideal if those records were not written to jet.db in the first place, as htlc-analyzer is skipping them anyway because they are not a result of "organic" routing events.

jet monitor change of timestamp

May I recommend to change the following timestamps to 24 hour format since it is not evident whether it's AM or PM

rebalances in progress:

image

successful rebalances over the past 4 hour(s) (10 max lines):

image

Misleading summary in jet monitor --status

The summary shown on index 12 + 13 is:

'remote ppm exceeds local. revisit local ppm and / or max ppm based on suggested range'

But local ppm is 200 ppm higher than remote ppm and maxAutoPpm is set to 550 in config.json.

image

image

image

Jet not finding file channel.db

zombie@zombie:~$ uname -a
Linux zombie 5.11.0-41-generic #45-Ubuntu SMP Fri Nov 5 11:37:01 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

zombie:~$ jet channeldb
channel.db is located at /home/zombie/.lnd/data/graph/mainnet/channel.db
/home/zombie/.lnd/data/graph/signet/channel.db
checkChannelDb: Error: ENOENT: no such file or directory, stat '/home/zombie/.lnd/data/graph/mainnet/channel.db
/home/zombie/.lnd/data/graph/signet/channel.db'
/home/zombie/lightning-jet/api/channeldb.js:30
if (res.priority === priority.urgent) {

Annoying reminders in Telegram when channel.db > 7 GB

I think it's very annoying to receive a reminder every 5 minutes and it spams telegram unnessecarily!

Personally an hourly one would be sufficient and a symbol โš ๏ธ could be added to give it more expression!

Maybe also an option in config.json could be made to set the interval manually...

image

Add version/change history

I think a version/change history would be great, so we could see easily what has been changed since the last update.

Jet rebalance-history printing blank table when a node is specified

zombie:~$ uname -a
Linux zombie 5.11.0-41-generic #45-Ubuntu SMP Fri Nov 5 11:37:01 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

zombie:~$ jet rebalance-history c-otto.de
rebalance history for c-otto.de
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ (index) โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Wrong display in jet monitor

I did the following manual rebalance using the following command:

jet rebalance 'BTC Sessions' 024706bbb0ef2a7dda56 500000

... and it seemed to have started successfully!

image

But unfortunately the display in jet monitor` is some how wrong, as it doesn't show the peer balanced into, instead it shows a part of the peer name balancing from, it seems that the white space in the peer alias is causing the issue.

image

Rebalancer is getting stuck with 'RPC services not available' error

Error: Error: 2 UNKNOWN: waiting to start, RPC services not available from /tmp/autorebalance.log.

The service is running based on jet status, but rebalances arent being kicked off.

Noticed during alpha testing (at least two instances).

workaround: jet restart rebalancer

jet logger (htlc-logger) service does not recover after an exception

The exception occurred due to the lnd API connection being terminated by lnd. The exact root cause for why the connection is terminated is unknown, but it is likely due to lnd being overloaded.

When an exception occurs, it causes the stream of htlc events to terminate, subsequently resulting in missed hltcs not being recorded in the database.

logging events...
node:internal/process/promises:246
triggerUncaughtException(err, true /* fromPromise */);
^

Error: 2 UNKNOWN: htlc event subscription terminated
at Object.callErrorFromStatus (/home/jeremy/lightning-jet/node_modules/@grpc/grpc-js/build/src/call.js:31:26)
at Object.onReceiveStatus (/home/jeremy/lightning-jet/node_modules/@grpc/grpc-js/build/src/client.js:330:49)
at Object.onReceiveStatus (/home/jeremy/lightning-jet/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181)
at /home/jeremy/lightning-jet/node_modules/@grpc/grpc-js/build/src/call-stream.js:145:78
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
code: 2,
details: 'htlc event subscription terminated',
metadata: Metadata { internalRepr: Map(0) {}, options: {} }
}

analyze-fees spiral due to fee update by peer

More than an issue, this is an observation. I have an outbound peer (as per jet peers) with which the fee structure was very low - 80(fees set by peer)/87(fees set by me); this was the case until recently, my peer increased their fee to 150 and analyze-fees suggested I increase mine to 201; after some time it suggested me to increase it to 501 (as the peer had increased to 450); so it went and now we are at 1050/1201ppm from 80/87ppm. Incidentally, the peer also happens to use jet and likely increased the fees based on their results/suggestions of analyze-fees

This primarily is due to the fact that the peer increased their fee (manually or because of some tool which may have done this). How should the analyze-fees work in such cases to prevent such a situation?

Add example config.json

As I was not sure where to add the new option rebalancer.maxPendingHtlcs it could be very helpful to add an example of the config.json for better understanding.

Rebalance running since more than 14 hours

Hi,

first I wan't to thank you for this fantastic tool and I made already a few successful circular rebalances with it.

Please find below some details about a rebalance that seems to have failed.

This rebalance was started yesterday afternoon and was still running when I checked it this morning, so it was running roughly 14 hours and so I decided to abort it using CTRL-C

Please find below a screenshoot and a log file:

telegram-cloud-photo-size-4-6024016293969115242-y

htlc-logger.log

If some further information is needed don't hesitate to contact me :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.