Lightning Channels — Segwit Inside

SegWit Resources
SegWit Resources
Published in
2 min readFeb 13, 2017

Individual payment channels composed as a series of interconnected links are what make the Lightning Network possible. lnd’s channel design currently utilizes the upcoming Bitcoin upgrade: segwit. Although alternative less-ideal channel constructions are possible without segwit, by utilizing segwit we’re able to deploy the most efficient, flexible, and safe channel design. Additionally, the script upgrade capabilities created by segwit provide a path for upgrades to Bitcoin that will improve the privacy and efficiency of Lightning. Examples of such improvements include Elliptic-Curve Schnorr Signatures and unlocking new op-codes that allow for more private end-to-end payments over Lightning by randomizing the payment hash along the route.

Three very important features of Lightning enabled by segwit include: Unlinkable Outsourced Channel Monitoring, infinite channel life time, and the two-stage HTLC scheme proposed by Mats Jerratsch (later modified by Tadge Dryja). Without segwit, fully-automatic channel outsourcing that includes the broadcast of a transaction that claims all funds in a contested channel by the outsourcer isn’t possible. This is because without a malleability fix, the transaction ID of the commitment transaction can’t be known ahead of time. Similarly, the two-stage HTLC scheme greatly improves the usability of Lightning by allowing a long revocation delay with a short payment delay isn’t safe to deploy without segwit.

lnd’s internal wallet is fully segwit-aware. The wallet is capable of segwit nested p2sh addresses, which look like regular p2sh addresses, and also native segwit addresses, which are more efficient and provide a greater degree of scalability. lndimplements BIP 142, which defines an address format for native segwit addresses. These addresses can be used to send money between instances of lnd or software that supports the BIP such as bcoin. On testnet, a native BIP 142 p2wpkh address looks like:

QWyzAWWPYUgdc6j6HxQpgvqKtyBo4xYjBkwr

Originally posted at http://lightning.community/release/software/lnd/lightning/2017/01/10/lightning-network-daemon-alpha-release/. Copied with permission.

--

--

SegWit Resources
SegWit Resources

An information page about Bitcoin’s segregated witness soft-fork