Bitcoin Forum
November 05, 2024, 04:37:43 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Multi-hop payment channel rebalancing in LN  (Read 377 times)
spartacusrex (OP)
Hero Member
*****
Offline Offline

Activity: 718
Merit: 545



View Profile
November 14, 2017, 04:23:18 PM
 #1

Bi-directional payment channels allow the lightning network to work.

At some point one side of a channel may be empty and all the funds belong to just one of the channel owners. This means the other party cannot send extra funds on this channel, and must either multi-hop the funds, or close the current channel and open a new one with new funds. It also means that this channel cannot be used in other multi-hop payments in both directions, restricting available options.

Say for instance I had some funds in a channel with StarBucks. Paid for my coffee every morning.

Although this is a bi-directional channel most of the traffic, if not all, would be one way. When I had sent all the funds available to me, that channel would be pretty useless for me, but could still be used to send multi hop funds one way for other parties.

It would be in StarBucks interest to refill that channel, off-chain of course, so that my payment experience with them would be uninterrupted and seamless. It would also be good for me, as I would not have to publish an expensive on-chain BTC txn to settle up. And good for the LN network as the channel could be used in other multi-hop payments in both directions again.

....

What if there were 3 channels, which circled back to me. There could be more, but they must create a circle where the same 'side' of every channel has more funds.

In this extreme case all the participants of the path are completely bottom-heavy in funds, the number in the brackets.

Spartacus[0]   -> StarBucks[10]
StarBucks[0]   -> Epicurus[10]
Epicurus[0]     -> Spartacus[10]

In total :
Spartacus has 10
StarBucks had 10
Epicurus has 10

And now you perform a txn that sends 5 each on their respective channels. this is zero sum since every sender is also a receiver.

Spartacus sends 5 to Epicurus
Epicurus sends 5 to StarBucks
StarBucks send 5 to Spartacus

(This is why all the channels must be bottom heavy, as only one top heavy link in the chain can prevent it from working)

So the new channel positions are

Spartacus[5]   -> StarBucks[5]
StarBucks[5]   -> Epicurus[5]
Epicurus[5]     -> Spartacus[5]

In total :
Spartacus has 10
StarBucks had 10
Epicurus has 10 .. all good.

Now the channel is back to being fully useful again.

I am not 100% sure if this sequence of off-chain txns can be performed atomically (securely) ? Your basically sending a payment to yourself on a special route. So you would know the hash of the hash lock contract at the start. I don't think it screws with anything ?

( Or is this something that is being considered already ? Did look but could not find this specifically.. )

Life is Code.
spartacusrex (OP)
Hero Member
*****
Offline Offline

Activity: 718
Merit: 545



View Profile
November 15, 2017, 11:41:42 AM
 #2

Thinking about it a little more.. of course it's safe  Tongue

No one on the network would know if you were sending the coins to yourself anyway.

So using this technique you can refill/rebalance your channels, by sending funds from other channels you are part of back to yourself via a specific route, without having to open/close anything on the main chain (send a BTC txn..).

I am working on a fee-less decentralised P2P LN network. not HUB based (there is a difference). This technique may prove quite useful.



Life is Code.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!