Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

SegWit and LN

6 messages, Jan 2, 2018. Started by Praveen Baratam.

Praveen Baratam (2), Johan Torås Halseth (2), Hafeez Bana, ZmnSCPxj

Permalink First message in the Wayback Machine

Praveen Baratam permalink original

Why is SegWit required for LN? If we wait for the *funding transaction* to be *confirmed*, we can then safely create and update unconfirmed commitment transactions...

I don't see how SegWit is important here... Am I missing something?

Hafeez Bana in reply to Praveen Baratam permalink original

to fix transaction malleability

On Tue, Jan 2, 2018 at 1:53 PM, Praveen Baratam <praveen.baratam at gmail.com> wrote:

Quoted text (18 lines)
> Why is SegWit required for LN? If we wait for the *funding transaction*
> to be *confirmed*, we can then safely create and update unconfirmed
> commitment transactions...
>
> I don't see how SegWit is important here... Am I missing something?
>
> --
> Dr. Praveen Baratam
>
> about.me <http://about.me/praveen.baratam>
> ᐧ
>
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
>
Johan Torås Halseth in reply to Hafeez Bana permalink original

Hi, Before you can safely broadcast the funding transaction, the two parties involved in a channel must have signed a commitment transaction spending the output from the funding transaction. Without segwit, the funding transaction can be malleated, leaving the commitment transaction invalid, and funds locked up if one of the parties stops cooperating.

Cheers, Johan On Tue, Jan 2, 2018 at 15:11, Hafeez Bana <hafeez.bana at gmail.com> wrote: to fix transaction malleability

On Tue, Jan 2, 2018 at 1:53 PM, Praveen Baratam < praveen.baratam at gmail.com [praveen.baratam at gmail.com] > wrote: Why is SegWit required for LN? If we wait for the funding transaction to be confirmed , we can then safely create and update unconfirmed commitment transactions... I don't see how SegWit is important here... Am I missing something?

Johan Torås Halseth in reply to Johan Torås Halseth permalink original

That’s correct :)

On Tue, Jan 2, 2018 at 15:34, Praveen Baratam <praveen.baratam at gmail.com> wrote: Thank you for explaining @Hafeez & @Johan Now that all the BIPs necessary for LN including SegWit (Softfork) are active on the mainnet, are we just waiting for the LN implementation to mature or are there any other issues? ᐧ On Tue, Jan 2, 2018 at 8:01 PM, Johan Torås Halseth < johanth at gmail.com [johanth at gmail.com] > wrote: Hi, Before you can safely broadcast the funding transaction, the two parties involved in a channel must have signed a commitment transaction spending the output from the funding transaction. Without segwit, the funding transaction can be malleated, leaving the commitment transaction invalid, and funds locked up if one of the parties stops cooperating.

Cheers, Johan On Tue, Jan 2, 2018 at 15:11, Hafeez Bana < hafeez.bana at gmail.com [hafeez.bana at gmail.com] > wrote: to fix transaction malleability

On Tue, Jan 2, 2018 at 1:53 PM, Praveen Baratam < praveen.baratam at gmail.com [praveen.baratam at gmail.com] > wrote: Why is SegWit required for LN? If we wait for the funding transaction to be confirmed , we can then safely create and update unconfirmed commitment transactions... I don't see how SegWit is important here... Am I missing something?

Praveen Baratam in reply to Johan Torås Halseth permalink original

Which is the most mature Lightning implementation right now? I want to setup a lightning node and start experimenting with it.

Also did anybody create a protocol diagram of how lightning works? (similar to the one below about SSL)

[image: Inline image 1]

I have seen higher level diagrams but as evident from my previous mails, they only touch the basic concepts and not the exact flow of events leaving many doubts. It would be really helpful to make such a detailed flowchart/diagram if one does not exist already.

Also, what are the current limitations/known-gaps in lightening network protocol? When can its guarantees fail? ᐧ

On Tue, Jan 2, 2018 at 8:13 PM, Johan Torås Halseth <johanth at gmail.com> wrote:

Quoted text (64 lines)
> That’s correct :)
>
> On Tue, Jan 2, 2018 at 15:34, Praveen Baratam <praveen.baratam at gmail.com>
> wrote:
>
> Thank you for explaining @Hafeez & @Johan
>
> Now that all the BIPs necessary for LN including SegWit (Softfork) are
> active on the mainnet, are we just waiting for the LN implementation to
> mature or are there any other issues?
> ᐧ
>
> On Tue, Jan 2, 2018 at 8:01 PM, Johan Torås Halseth <johanth at gmail.com>
> wrote:
>
>> Hi,
>>
>> Before you can safely broadcast the funding transaction, the two parties
>> involved in a channel must have signed a commitment transaction spending
>> the output from the funding transaction. Without segwit, the funding
>> transaction can be malleated, leaving the commitment transaction invalid,
>> and funds locked up if one of the parties stops cooperating.
>>
>> Cheers,
>> Johan
>> On Tue, Jan 2, 2018 at 15:11, Hafeez Bana <hafeez.bana at gmail.com> wrote:
>>
>> to fix transaction malleability
>>
>> On Tue, Jan 2, 2018 at 1:53 PM, Praveen Baratam <
>> praveen.baratam at gmail.com> wrote:
>>
>>> Why is SegWit required for LN? If we wait for the *funding transaction*
>>> to be *confirmed*, we can then safely create and update unconfirmed
>>> commitment transactions...
>>>
>>> I don't see how SegWit is important here... Am I missing something?
>>>
>>> --
>>> Dr. Praveen Baratam
>>>
>>> about.me <http://about.me/praveen.baratam>
>>> ᐧ
>>>
>>> _______________________________________________
>>> Lightning-dev mailing list
>>> Lightning-dev at lists.linuxfoundation.org
>>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>>
>>>
>>
>> _______________________________________________ Lightning-dev mailing
>> list Lightning-dev at lists.linuxfoundation.org
>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>
>>
>
>
> --
> Dr. Praveen Baratam
>
> about.me <http://about.me/praveen.baratam>
>
>
ZmnSCPxj in reply to Praveen Baratam permalink original

Good morning Praveen,

For some background please consider the article I wrote: https://zmnscpxj.github.io/offchain/generalized.html

Especially "Requirements on the Blockchain".

For cases where the funding transaction is funded by only one side, then full SegWit is not needed, "only" some kind of malleability fix. However, there is the possibility in the future of funding transaction being funded by both sides, and that requires full SegWit. Full SegWit is not only a malleability fix, but also provides the feature that an unsigned transaction has the same txid as a signed transaction. This is necessary for multi-funded funding transactions (not yet present in Lightning BOLT 1.0).

Quoted text (1 line)
> Which is the most mature Lightning implementation right now? I want to setup a lightning node and start experimenting with it.

I believe lnd has the most features. There are even a few brave individuals who are experimenting with it on mainnet. Please note that those individuals have mainnet BTC to spare for this and will not miss those BTC if it becomes locked due to bugs (they are mostly using UTXOs they consider to be "dust" I believe), so in general you should restrict yourself to testnet for now unless you have some dust you are willing to lose.

Quoted text (1 line)
> Also did anybody create a protocol diagram of how lightning works? (similar to the one below about SSL)

The Lightning BOLT specs have many sequence diagrams: https://github.com/lightningnetwork/lightning-rfc

They are ASCII graphics, but are understandable.

Quoted text (5 lines)
> [image.png]
>
> I have seen higher level diagrams but as evident from my previous mails, they only touch the basic concepts and not the exact flow of events leaving many doubts.  It would be really helpful to make such a detailed flowchart/diagram if one does not exist already.
>
> Also, what are the current limitations/known-gaps in lightening network protocol? When can its guarantees fail?

There are many. A few include:

1. The same hash is used for the entire route. Spies who have many nodes can correlate routes with the same hash if the route passes through multiple different nodes they control.  This is fixable and will be fixed in a future BOLT version.
2. Funding of channels is currently one-sided only. This is safer in general as some measure of trust and anti-DoS and so on is needed for two-sided funding of channels (i.e. if you blindly accept requests for two-sided funding, and I am much richer than you, I can start up a node or hundreds of nodes, have them request two-sided funding channels with you, then take all of them offline, leaving you with BTC locked in unuseable channels which you will have to unilaterally close (which requires delays measured in hours or days as part of the protocol)). Two-sided channel funding will probably be rejected by default by your node software and would have to be specifically enabled for nodes you trust (although that probably will not be part of the protocol itself, just the design of node software).  This will be added in a future BOLT version.
3. Burchert-Decker-Wattenhofer channel factories are not yet part of the BOLT spec. This will reduce blockchain use even further, at the cost of a more involved process for closing channels.  This will be added in a far future BOLT version, because this is even newer tech than Lightning and will still need more design and so on.
4. If you do any receives at all (note that routing through your node is a receive+send) you need to watch the blockchain for attempts at theft. There is some work being done, called WatchTower, that would let you delegate this watching to a third party on your behalf. You do not need to watch the blockchain if you use your node strictly for sending only (I believe Eclair has a mode for this, intended to be used for mobile devices).  This WatchTower will be added in a future BOLT version.

Regards, ZmnSCPxj