How Did SegWit Help Enable the Lightning Network?
Short answer
The Lightning Network uses payment channels: participants commit funds to a Bitcoin transaction and exchange updated off-chain commitments that determine how the channel balance can be settled. These protocols rely on carefully constructed transactions and enforceable spending conditions.
Explanation
Before SegWit, transaction malleability created a serious engineering obstacle. If a funding transaction's txid could change, pre-signed transactions referring to that funding output might become invalid. SegWit removed signature-related txid malleability for SegWit spends, making the funding and commitment transaction relationships more predictable.
SegWit did not itself create Lightning, and Lightning's design also relies on timelocks, multisignature arrangements, revocation mechanisms, routing, liquidity management, and monitoring. Nor does SegWit guarantee instant final settlement on the Bitcoin blockchain: Lightning payments and channel closes have distinct operational and security considerations.
The key contribution was a more dependable base-layer transaction format on which robust payment-channel protocols could be built.
