New Lightning Banner

Segregated Witness (SegWit) and the Lightning Network have often been associated with each other because SegWit would enable an improved version of the Lightning Network to exist on Bitcoin; however, the enhancements SegWit brings to the Lightning Network are not entirely clear to many Bitcoin users. During the Q&A portion of a recent presentation at the Bitcoin Milano Meetup, Lightning Labs co-founder Olaoluwa Osuntokun was asked about the relationship between SegWit and the Lightning Network.

Although there have been indications that SegWit could be activated on the Bitcoin network before August 1st of this year, Osuntokun was able to explain how SegWit improves the Lightning Network and what would happen if the improvement was never added to Bitcoin.

Indefinite Payment Channels

The Lightning Network has gone through a few iterations, and its origins can be traced back to the original concept of payment channels. Payment channels are a way to do cryptographically-secure Bitcoin payments without broadcast each transaction to the blockchain, and the Lightning Network effectively improves upon this idea by creating a generalized network of these sorts of payments on top of Bitcoin.

“Previously, there were payment channels, but they had a limited lifetime — meaning basically that you open a channel and then five days later or some amount of days you basically have to close it,” said Osuntokun. “That’s kind of limiting because you as a user or the software itself (ideally) needs to decide what duration [the channels] should be open. And that depends on a lot of parameters.”

According to Osuntokun, the fact that users would need to reopen channels on a regular basis would offset some of the scalability benefits that are supposed to come with these sorts of layer-two solutions.

“One thing SegWit allows us to do very cleanly is we can have channels that can be open forever,” explained Osuntokun. “You can have channels that are open for months, for years.”

Osuntokun added that he’s had a testnet Lightning Network channel open on his laptop for around four months.

Transaction Malleability

According to Osuntokun, another benefit of SegWit when it comes to the Lightning Network is that it solves transaction malleability “in a clean way”.

“The way these transactions work, it’s kind of like a tree structure, so you have one transaction dependent on another transaction,” explained Osuntokun. “If that other transaction gets invalidated, then this one does as well. So, you could have a weird scenario where even though you have a — ideally you could always get your money back — if the transaction got maleated then basically you wouldn’t have a valid signature to unlock your money.”

In the Lightning Network white paper, this scenario is described as a “hostage situation” in regard to a user’s funds being at the mercy of a bad actor.

Outsourcing

Another benefit of SegWit for the Lightning Network has to do with the need to watch the blockchain for someone attempting to cheat. While the system is secure in theory, users must still watch the blockchain to broadcast a revocation transaction if their counterparty tries to cheat. According to Osuntokun, this activity can be outsourced to another party if SegWit is activated on the network.

“With SegWit, we can do this thing called outsourcing where we can basically give a server a very minimal amount of information, which doesn’t even reveal which channel you are, and that sort of can act on your behalf,” said Osuntokun.

What if Bitcoin Doesn’t Get SegWit?

Finally, Osuntokun also commented on what would happen in a hypothetical scenario where SegWit is never activated on Bitcoin. At first, he pointed to Litecoin, which has already activated SegWit, as an option for further testing.

“We can basically use Litecoin as kind of a testbed,” said Osuntokun. “We can basically test our software out on something that’s a little bit smaller scale to make sure it’s actually hardened and works well.”

Having said that, Osuntokun added that the Lightning Network can still come to Bitcoin in a scenario where SegWit is not activated.

“We can still do it, but it’ll be more limited in terms of its capability, and it’ll be a little bit hacky,” said Osuntokun. “So, ideally, we get a malleability fix, and the main one that’s [available] right now is SegWit. It has a bunch of testing; I’ve implemented it, and I think it’s pretty good.”

  • continuedhere

    If the channels are open indefinitely how do transactions get committed to the blockchain? Does that happen periodically without the channels being closed?

  • Devin Broley

    How do we know the third party isn’t compromised. Isn’t this a system of control that negates the decentralization that cryptocurrency aspires to?