BTC_Freedom asked over 2 years ago

Circular Rebalance on Umbrel?

Is there a guide on how to do the Circular Rebalance on Umbrel?
Using RTL or Thunderhub sometimes worked for me and sometimes it didnt. Even though I did the same steps I sometimes received offer of rebalance with too many hops and high fees or receiving "total fees to high" error. RTL says sometimes "no route exists" even though I put some sats as a fee (even when estimate is 0msat fee with 2 hops) and Thub says that already not enough balance (even there is). Ideas?

I am also aware of https://github.com/RooSoft/igniter but I would prefer more detailed step-by-step guide for those using Umbrel and not much familiar with command line.
Anyone?
Thanks and happy Lightning!

3 Comments

LN+

LN+ Admin wrote over 2 years ago

Circular rebalancing can be expensive. It most probably doesn't work because the max fee you put is too low. If you bump it up really high it will most likely work, but you would not want to do it, because spending that much money would defeat the purpose. You have to make sure you rebalance at a lower cost than your own fees. So, this is just trial and error manually or you can use tools that do it automatically for you.

If you want to do rebalancing within a triangular swap after it's complete is pretty easy. Make sure everyone lowers their fees to zero at a certain time, then in Thunderhub you select the new outgoing channel and new incoming channel and go. It will work every time. After this you can all set your fees higher if necessary.


Cuaritas

Cuaritas wrote over 2 years ago

I have been searching and learning more about this, and yes like LN+ said, rebalace is not always required, and not desirable for small channels because the high fee. Anyways, I created a script to do it, just for fun, feel free to check it out: https://github.com/cuaritas/perfectly-balanced


Molina de viento wrote over 2 years ago

Once a swap is complete this website gives details of how to perform a circular rebalance through the swap nodes using lnd on the command line. But for me, using an Umbrel node, I have to use `sudo docker exec lnd lncli` rather than `lncli` on the command line in order to interact using lnd. This means that the standard commands this site gives for rebalancing a swap didn't work for me and I assume won't work for any Umbrel node?

For those looking for a simple Umbrel compatible replacement for the rebalance commands this worked for me:

sudo docker exec lnd lncli addinvoice --amt [AMT]

sudo docker exec lnd lncli buildroute --amt [AMT] --hops [HOPS] | jq -r '(.route.hops[-1] | .mpp_record) |= {payment_addr:"[PAYMENT_ADDR]", total_amt_msat: "[AMT]000"}'

sudo docker exec lnd lncli sendtoroute --payment_hash=[R_HASH] --routes='[JSON]'

[AMT]: Value of the rebalance in sats. This would be half the size of the channels opened. So for a 2,500,000 swap this would be 1,250,000.
[HOPS]: This is the comma separated list of the public keys of the nodes involved in the swap. You can copy this from the commands this website gives on a completed swap page.
[PAYMENT_ADDR]: Copy and paste this from the output from the `addinvoice` command.
[R_HASH]: Copy and paste this from the output from the `addinvoice` command.
[JSON]: Copy and paste the output from the `buildroute` command into a text editor and delete all the carriage returns to get the text for this. If you're text editor supports regular expressions try replacing "\n[ ]*" with " ".

Hope this helps someone.

Please login to post comments.