Skip to content

Lightning Network

Arnaud Bailly edited this page Jul 13, 2021 · 5 revisions

Lightning Network

The core idea of Lightning is to separate the signing and creation of transactions from the actual broadcasting to the blockchain. Each bi-partite payment channel maintain the balance of the 2 parties through a pair of exclusive commitment transactions where each member of the pair can be posted by only one party, with outputs constructed in such a way that the other party can receive the total amount in the channel should the transaction be posted illegitimately.

When 2 parties want to do some payment, they can agree to construct a new pair of commitment transactions and reveal the private key for their revocable delivery output so that each party can then build a breach recovery transaction: If a party posts an old commitment transaction, the counterparty can immediately post this breach recovery transaction and thus get all the money of the payment channel.

A lightning network is needed when one wants to send money to another party to which it has no direct payment channel. This is made possible by constructing a Hashed Timelock Contract which is tied to one output of the commitment transaction. This contract ensures the output can only be spent if one provides a value R which is the preimage of a known hash(R) value, within a certain time limit. The fact that R is known only by both parties makes it possible to route the payment through other nodes without running the risk of money being stolen. The trick is to decrease the timeout for the HTLC for each hop traversed.

Clone this wiki locally