mirror of
https://github.com/lnbook/lnbook
synced 2024-11-04 18:00:26 +00:00
85 lines
2.3 KiB
Plaintext
85 lines
2.3 KiB
Plaintext
[[payment_channels]]
|
|
== Payment Channels
|
|
|
|
In this chapter we will dive into payment channels and see how they are constructed. We will start with Alice's node opening a channel to Bob's node, building on the examples presented in the beginning of this book.
|
|
|
|
The messages exchanged by Alice and Bob's nodes are defined in https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md["BOLT2 - Peer Protocol"]. The transactions created by Alice and Bob's nodes are defined in https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md["BOLT3 - Transactions"]. In this chapter we are focusing on the "Channel Open & Close" and "Channel State Machine" parts of the Lightning protocol architecture, highlighted by a double outline in the center (Peer 2 Peer Layer) of <<LN_protocol_channel_highlight>>:
|
|
|
|
[[LN_protocol_channel_highlight]]
|
|
.The Lightning Network Protocol Suite
|
|
image::images/LN-protocol-channel-highlight.png["The Lightning Network Protocol Suite"]
|
|
|
|
=== Bitcoin ownership and control
|
|
|
|
Before we understand payment channels, we have to take a small step back and understand how ownership and control work in Bitcoin.
|
|
|
|
==== Holding signed transactions without broadcasting
|
|
|
|
==== Chaining transactions without broadcasting
|
|
|
|
==== Solving malleability (SegWit)
|
|
|
|
==== A different way of using the Bitcoin system
|
|
|
|
==== Cryptographic protocol vs. message protocol
|
|
|
|
=== Constructing a payment channel
|
|
|
|
==== Node public keys
|
|
|
|
==== Generating a multisignature address
|
|
|
|
=== Funding the channel
|
|
|
|
==== The funding transaction
|
|
|
|
==== The refund transaction
|
|
|
|
=== Funding message flow
|
|
|
|
[[funding_message_flow]]
|
|
.The funding message flow
|
|
image::images/funding_message_flow.png["The funding message flow"]
|
|
|
|
==== The open_channel message
|
|
|
|
==== The accept_channel message
|
|
|
|
==== The funding_created message
|
|
|
|
==== The funding_signed message
|
|
|
|
==== The funding_locked message
|
|
|
|
=== Closing the channel
|
|
|
|
==== The cooperative close transaction
|
|
|
|
=== Closing message flow
|
|
|
|
==== The shutdown message
|
|
|
|
==== The closing_signed message
|
|
|
|
=== Updating the channel state
|
|
|
|
==== The commitment transaction
|
|
|
|
==== The commitment_signed message
|
|
|
|
==== Asymmetric commitments
|
|
|
|
==== Cheating with a prior state
|
|
|
|
=== Revoking prior state
|
|
|
|
==== Commitment revocation
|
|
|
|
==== The revoke_and_ack message
|
|
|
|
=== Penalty mechanism
|
|
|
|
==== The penalty transaction
|
|
|
|
=== Conclusion
|