Level 3 · Advanced
Lightning internals
In short
A Lightning channel is a 2-of-2 multisig output funded on chain, and payments update who owns how much of it off chain. Payments hop across several channels using HTLCs, hash time-locked contracts that let each hop settle only when the receiver reveals a secret.
08Lightning internalsCommitments, revocation, HTLCs, onion routing and BOLTs.10 min
- A channel is a 2-of-2 multisig funding output. Each side holds a signed commitment transaction paying out the current balances.
- Updating the channel revokes the old state by revealing a secret. Broadcast a revoked state and your peer can claim the whole channel with a penalty transaction. Watchtowers can watch for this on your behalf.
- Multi-hop payments use HTLCs: outputs locked to a hash
H = SHA256(preimage), with timelocks that shrink at each hop so every node can settle safely. - Onion routing (Sphinx) means each hop learns only its previous and next hop.
- The protocol is specified in the BOLTs. Newer work includes splicing, BOLT 12 offers, and PTLCs that use Schnorr adaptor signatures instead of shared hashes.
Learn Bitcoin with real people.
Find meetups and Bitcoiners in your city, and ask the questions you'd never post online. Free to download on iPhone and Android.