daywalker90 / sling

A core lightning plugin to automatically rebalance multiple channels.
MIT License
15 stars 3 forks source link

latest release on CLN v24.08.2 latest release on CLN v24.05 latest release on CLN v24.02.1

main on CLN v24.08.2 main on CLN v24.05 main on CLN v24.02.1

sling

A core lightning plugin to automatically rebalance multiple channels.

Installation

For general plugin installation instructions see the plugins repo README.md

Release binaries for

can be found on the release page. If you are unsure about your architecture you can run uname -m.

They require glibc>=2.31, which you can check with ldd --version.

Building

You can build the plugin yourself instead of using the release binaries. First clone the repo:

git clone https://github.com/daywalker90/sling.git

Install a recent rust version (rustup is recommended) and cd into the sling folder, then:

cargo build --release

After that the binary will be here: target/release/sling

Note: Release binaries are built using cross and the optimized profile.

Command overview

Pull sats into a channel

To pull sats into a channel you can add a job like this:

sling-job -k scid direction amount maxppm (outppm) (target) (maxhops) (candidates) (depleteuptopercent) (depleteuptoamount) (paralleljobs)

You can completely leave out optional (those in ()) arguments, with one exception: either outppm and/or candidates must be set :warning:You must use the -k keyword=value format for sling-job!

Easy example: "Pull sats to our side on 704776x2087x3 in amounts of 100000 sats while paying max 300ppm and only using candidates where we charge 0ppm, use defaults (see Options) for the rest of the parameters":

sling-job -k scid=704776x2087x3 direction=pull amount=100000 maxppm=300 outppm=0

Advanced example: "Pull sats to our side on 704776x2087x3 in amounts of 100000 sats while paying max 300ppm. Idle when 0.8*capacity_of_704776x2087x3 is on our side, use max 6 hops and only these other channels i have as partners: 704776x2087x5, 702776x1087x2. Use defaults for the rest of the parameters and (because we omitted outppm) ignore the ppm i charge on my candidates":

sling-job -k scid=704776x2087x3 direction=pull amount=100000 maxppm=300 target=0.8 maxhops=6 candidates='["704776x2087x5","702776x1087x2"]'

Push sats out of a channel

To push sats out of a channel you can add a job like this:

sling-job -k scid direction amount maxppm (outppm) (target) (maxhops) (candidates) (depleteuptopercent) (depleteuptoamount) (paralleljobs)

You can completely leave out optional (those in ()) arguments, with one exception: either outppm and/or candidates must be set :warning:You must use the -k keyword=value format for sling-job!

Easy example: "Push sats to their side on 704776x2087x3 in amounts of 100000 sats while paying max 300ppm and only using candidates where we charge >=600ppm, use defaults (see Options) for the rest of the parameters":

sling-job -k scid=704776x2087x3 direction=push amount=100000 maxppm=300 outppm=600

Advanced example: "Push sats to their side on 704776x2087x3 in amounts of 100000 sats while paying max 300ppm. Idle when 0.8*capacity_of_704776x2087x3 is on their side, use max 6 hops and only these other channels i have as partners: 704776x2087x5, 702776x1087x2. Use defaults for the rest of the parameters and (because we omitted outppm) ignore the ppm i charge on my candidates":

sling-job -k scid=704776x2087x3 direction=push amount=100000 maxppm=300 target=0.8 maxhops=6 candidates='["704776x2087x5","702776x1087x2"]'

Depleteformula

Formula is min(depleteuptopercent * channel_capacity, depleteuptoamount). If you don't set one or both, the global default will be used for one or both respectively instead. You can change the global defaults here: Options

How to set options

sling is a dynamic plugin with dynamic options, so you can start it after CLN is already running and modify it's options after the plugin is started. You have two different methods of setting the options:

  1. When starting the plugin dynamically.
  1. Permanently saving them in the CLN config file. :warning:If you want to do this while CLN is running you must use setconfig instead of manually editing your config file! :warning:If you have options in the config file (either by manually editing it or by using the setconfig command) make sure the plugin will start automatically with CLN (include plugin=/path/to/sling or have a symlink to sling in your plugins folder). This is because CLN will refuse to start with config options that don't have a corresponding plugin loaded. :warning:If you edit your config file manually while CLN is running and a line changes their line number CLN will crash when you use the setconfig command, so better stick to setconfig only during CLN's uptime!

You can mix two methods and if you set the same option with different methods, it will pick the value from your most recently used method.

Options

Feedback

You can report issues, feedback etc. here on github or join this telegram channel: Telegram

Thanks

Thank you to cdecker for helping me get into writing a plugin with cln-plugin, the people in https://t.me/lightningd and giovannizotta of the original circular plugin.