|
November 14, 2017, 04:23:18 PM |
|
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.. )
|