🤓My First Pentagon Capacity 1.0M SAT 😲

Posted 6 days ago by radday55

SwapID  This was every exciting and confusing all at the same time, you open channels to each other and there needs to be a type of cohesiveness so that each layer of the liquidity swap can complete. Working with Kippy, PEBERG, 028fd634bc2c97aba9a8 and Aloha-Sendlt made this a smooth and seamless effort.

LN+ replied 5 days ago

Pentagons are hard, which is why I didn't even consider hexagons. Triangles are best really. Lots of them!

swap.router replied 5 days ago

What are the main differences between triangles, squares and pentagons exactly? Especially in regards to rebalancing?

radday55 replied 5 days ago

I did not do the rebalancing I'm still trying to grasp what Balance Score is and why it has a scale. This is truly one of the best eye opening  coding experience to date, if @LN+ can pass on any if to understand it that would be great. 

LN+ replied 4 days ago

There is no real difference between shapes regarding rebalancing. The larger the shape the more rebalancing to be done of course and it's harder to complete because every node needs to be cooperative. This could be a problem because as soon as a channel is established it may start routing, and thus it's possible that a channel moves funds before the rebalancing takes place. But that's a good thing. The whole point of rebalancing is to encourage routing. If routing happens before rebalancing it's even better.

The balance score tells you how balanced your channel is. If all funds are on one side, you get the lowest score. If the funds are perfectly balanced (50% on one side, 50% on the other side) you get the highest score.

In general, I think rebalancing is not necessary, especially for smaller channels. See this: https://lightningnetwork.plus/questions/4

Theoretically, if you have a triangle you have a path for the funds to flow either direction through the triangle without rebalancing. Let's say you have an A>B>C triangle and all 3 channels are maximum unbalanced. Let's see the possible directions for the money to flow from the perspective of B:
  • B to receive from A and send to C: Since all funds are on B's side, the maximum channel capacity can be used to route such payments. Maximum routing fees can be earned.
  • C receives funds and needs to route to A: Since C has all funds on their side towards A, the funds will be routed from C to A directly, without involving B. No routing fees can be earned.

If you do rebalance all channels, B will be able to route both directions, but only half the amount in both directions. So total possible routing fees earned would be the same either way. There is nothing to be gained with rebalancing in a triangle.

However, things get more complicated if you're not in a triangle, or your channels are massive.

If you're not in a triangle it's not guaranteed that funds can flow both directions easily. It may take several potentially costly hops in one direction, and thus the routing algorithms will avoid that path. Thus, in those cases you would want to find ways to rebalance your channels that are depleted quickly so they can keep routing and thus making your money. For example, let's say you open a 10M channel to a merchant selling coffee. This merchant will receive funds every day, and you will generate routing fees by sending funds towards them through your node. You never route money the other way around, because the coffee shop never sends money out (through you anyway). At one point that 10M channel will become completely empty on your side and all funds will be on their side. What you need to do in this situation is to rebalance that channel so the funds are on your side again. If you can do that, you can route money again to the coffee shop. The key is to make sure your rebalancing activity is cheaper than what you will earn routing money to the coffee shop. The reason that is possible is that when somebody pays for coffee their wallet will want to find a path fast and relatively cheap, but it won't spend endless time trying all possible ways to route the money, so it will settle for your node to route the funds. However, you have all the time to find a more optimal path to rebalance. If it takes 30-60-90 seconds, it's OK, especially if it's an automated script that tries all possible long routes. So you're basically doing the routing work so to say and spending your time to prepare easy routing paths for the future by rebalancing and you're earning some fees for this work.

Also, if your channels are massive you can afford to cut them into half to increase the chances to route both ways.

Please sign in to post replies.

Lightning Network Node
Rank: 5 / Titanium Node
Capacity: 20,103,126 SAT
Channels: 10