mirror of https://github.com/lnbook/lnbook
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
2.7 KiB
Plaintext
97 lines
2.7 KiB
Plaintext
5 years ago
|
[role="pagenumrestart"]
|
||
|
[[ch02_How_Lightning_Works]]
|
||
|
== How the Lightning Network Works
|
||
|
|
||
|
=== Payment channels
|
||
|
|
||
|
* trustless between peers
|
||
|
* operation takes place off chain
|
||
|
* throughput bound by TCP/IP traffic
|
||
|
* have capacity which is split into a balance sheet
|
||
|
* instant payments between peers
|
||
|
|
||
|
==== Multisig address
|
||
|
* short review of bitcoin transactions
|
||
|
* review of segwit multisig addresses
|
||
|
|
||
|
==== Funding Transaction
|
||
|
* opens the payment channel
|
||
|
* encodes the capacity of the channel
|
||
|
* not clear who owns what fraction of the capacity
|
||
|
* visible onchain transaction (even for private channels)
|
||
|
|
||
|
==== Commitment Transaction
|
||
|
* encodes the balance of the payment channel
|
||
|
* kept secretly between channel partners
|
||
|
* everyone has their own set of transactions
|
||
|
* encumbered with a time lock to give time to penalize protocol breach
|
||
|
* smart contract inside which gives possability to penalize protocol breach
|
||
|
|
||
|
==== Announcing the channel
|
||
|
* gossip protocol
|
||
|
* option to have private channels
|
||
|
|
||
5 years ago
|
==== Closing the channel
|
||
5 years ago
|
* the good way - mutal close
|
||
|
* the bad way - force close
|
||
|
* the ugly way - protocol breach
|
||
|
|
||
|
=== Invoices
|
||
|
|
||
5 years ago
|
An alternative structure for the subsections of the invoice section (while covering the same topics) could be: (creating, decoding, paying as 3 sub chapters)
|
||
5 years ago
|
|
||
|
* creating invoices
|
||
|
* decoding invoices
|
||
|
* bech32 encoding and human readable part of invoices
|
||
|
|
||
|
==== Payment Hash
|
||
|
* `pre_image` as proof of payment
|
||
|
* random numbers and selecting the pre_image
|
||
|
|
||
|
==== Meta Data
|
||
|
* Description
|
||
|
* routing hints
|
||
|
* fallback address
|
||
|
* expire time
|
||
|
* signature
|
||
|
|
||
|
=== Delivering the payment
|
||
|
|
||
|
* gossip protocol
|
||
|
* network of payment channels
|
||
|
* different scope of the network
|
||
|
** global path finding (entire knowledge of the network necessary)
|
||
|
** multihop routing (onion necessary only a subset of nodes involved)
|
||
|
** locally setting up and setteling htlcs (only peers involved)
|
||
|
|
||
|
==== Finding a path
|
||
|
|
||
|
* trivial case / channel partner as destination with enough funds in the channel
|
||
|
* topology information from the gossip protocol
|
||
|
* fees and pathfinding from destination to source
|
||
|
|
||
|
==== Onion routing
|
||
|
|
||
|
* construct an onion using
|
||
|
** SPHINX
|
||
|
** payment hash
|
||
5 years ago
|
** path
|
||
5 years ago
|
|
||
|
==== Payment Forwarding Algorithm
|
||
|
|
||
|
* receive an incoming HTLC
|
||
|
* forward an HTLC
|
||
|
* BOLT 02 channel update protocol
|
||
|
* sending back errors
|
||
|
|
||
|
=== Comparison with Bitcoin
|
||
|
|
||
|
* select outputs vs select payment channels / finding a path
|
||
|
* change outputs vs no change on lightning
|
||
|
* mining fees vs routing fees
|
||
|
* public transactions on the blockchain vs. secret payments
|
||
|
* waiting for confirmations vs instant settlement (if everything works smoothly)
|
||
|
* arbitrary amounts vs capacity restrictions
|
||
|
* variying fees depending on the traffic vs announced fees (might become dynamic too?)
|
||
5 years ago
|
* blockchain to save all transactions vs blockchain as a court system
|