The Dutch Connection asked almost 2 years ago

How do I rebalance a square or pentagon swap?

I'd like to learn how I'm able to rebalance a square or pentagon swap,
I have no issues with a triangle rebalance. This is pretty straight forward.
All help is appreciated!

6 Comments

LN+

LN+ Admin wrote almost 2 years ago

You need to use the command line. The system will give you the exact commands. Can you see them?


The Dutch Connection

The Dutch Connection wrote almost 2 years ago

I can see only see 2 nodes in a square swap scenario. So if I'm node C, I can see node B and node D ..... but not node A. How can you rebalance all channels  in this scenario?


Orville

Orville wrote almost 2 years ago

I use RTL for rebalancing. Here is my suggestion for rebalancing a square:
Let's say you are C in a square and opening to D: 
Set your fee towards D to 0/0. 
Check that the the remote fee of B to you is 0/0.  
Check in Amboss that the fees from D to A and A to B are both 0/0. 
Now you should have have a zero fee ring. 
You rebalance out through D and receive via B with a max fee of 0. If the rebalance does not work you wait, check that all the fees are 0/0 and try again. 
(This could go wrong if D has 0 fees to a zero fee node, and B has that node as a peer. Then A will risk being left out. Maybe you can check that in Amboss)


Orville

Orville wrote almost 2 years ago

Looking into lncli commands I see this one, which would perhaps be helpful as well, but I have not tried it myself:

NAME:
   lncli sendtoroute - Send a payment over a predefined route.

USAGE:
   lncli sendtoroute [command options] [arguments...]

CATEGORY:
   Payments

DESCRIPTION:
   
  Send a payment over Lightning using a specific route. One must specify
  the route to attempt and the payment hash. This command can even
  be chained with the response to queryroutes or buildroute. This command
  can be used to implement channel rebalancing by crafting a self-route,
  or even atomic swaps using a self-route that crosses multiple chains.

  There are three ways to specify a route:
     * using the --routes parameter to manually specify a JSON encoded
       route in the format of the return value of queryroutes or
       buildroute:
           (lncli sendtoroute --payment_hash=<pay_hash> --routes=<route>)

     * passing the route as a positional argument:
           (lncli sendtoroute --payment_hash=pay_hash <route>)

     * or reading in the route from stdin, which can allow chaining the
       response from queryroutes or buildroute, or even read in a file
       with a pre-computed route:
           (lncli queryroutes --args.. | lncli sendtoroute --payment_hash= -

       notice the '-' at the end, which signals that lncli should read
       the route in from stdin
  

OPTIONS:
   --payment_hash value, --pay_hash value  the hash to use within the payment's HTLC
   --routes value, -r value                a json array string in the format of the response of queryroutes that denotes which routes to use
   


Orville

Orville wrote almost 2 years ago

You could also hit up Rings of Fire who are experts in rebalancing rings of many nodes and learn the tricks of their trade.


The Dutch Connection

The Dutch Connection wrote almost 2 years ago

Thanks for the feedback. I'm looking for some examples or even better,  Youtube video's :-)
I'll dig a bit further myself. Just starting my node and want to know everything, This tech is really next level!

Please login to post comments.