Dear All,

I'd like to suggest a new function in the network, "Free Rebalancing
It is a fee-less, omni-beneficial rebalancing scheme


I currently balance my nodes in the following way, extremely simplified:

1) Identify channels that have too low remote_balance (A) and too low
local_balance (B) for being of any use (in that direction)
2) Find potential routes and amounts between all channels A and all
channels B that would optimize at least one of them
3) Send a payment along those possible routes for different amounts, sorted
after fee, until one succeeds

It works quite good and is quite straight forward until the third step. So
I would like to propose a better solution which works like this:

Send a proposal-for-balancing-message over channel A, and the max amount
you would propose to balance in that direction.

Each node analyses the in and out channels and adjusts the max to it's own
desire to balance. Max can only be adjusted down. Let's say the function is
`int freeBalancerMax(channel in,channel out)`. It could be as simple as
checking how near "in" is to 100ksat local_balance and "out" is to 100ksat
remote_balance. The node passes that message with new max value on to the
next node, much like a normal payment.

When this packet comes back to the origin it will know how much the
intermediate nodes are willing to let you balance, or if someone is
reluctant to balance (and the final max value would be 0)

If everyone is happy (i.e. max>0), the origin node sends a payment along
this node, *without* dropping off any fees along the way, since all nodes
agreed and benefit from the rebalancing act.

Since all intermediate nodes benefit they are happy to do this without
fees. Since they adjust max values to their desire it will stop multiple
attempts from different nodes from starting to oscillate the balances in
the channels, but will instead reach some kind of equilibrium as long as
the node suggesting proposal uses it's freeBalancerMax when proposing and
accepting proposals.

The intermediate nodes might not need to keep track of any agreements to
balancing proposals, it can simply call the freeBalancerMax function, and
if the payment is lower, it passes on the payment even if it didn't get any
fees, otherwise it fails as usual. If someone tries to send a non agreed
payment without fees, but it coincides with the nodes own desire to
rebalance, there is no harm done. Only problem with that is that senders
might flood a path with creative attempts trying to find a path with a
fee-free hop. I think things like that will be stopped by a general
throttle functionality which probably will be needed anyhow.

Best regards
Robert Olsson
Lightning-dev mailing list

Reply via email to