Chaincode Seminars
  • Seminar for Bitcoin and Lightning protocol
  • Bitcoin Protocol Development
    • Welcome to the Bitcoin Protocol Development Seminar
    • SegWit
    • Mining and Network Block Propagation
    • P2P
    • Scripts and Wallets
  • Lightning Protocol Development
    • Payment Channels, Intro to Lightning, and HTLCs
    • How the layers of Lightning Fit Together
    • Lightning Routing
    • Lightning Limitations
    • The Future of Lightning
Powered by GitBook
On this page
  • Reading
  • Discussion Questions
  • A walk through the layers of Lightning
  • Creating a channel
  • The Update Layer
  • The Transfer Layer
  • The Multihop Layer
  • Diffie–Hellman key exchange
  • How and when do I use HMAC?
Edit on GitHub
  1. Lightning Protocol Development

How the layers of Lightning Fit Together

Reading

Content
Time (min)

40

20

20

20

70

50

80

25

10

5

15

15

15

15

60+

Discussion Questions

  1. How would an offline vending machine work?

A walk through the layers of Lightning

  1. How does the LN-Penalty mechanism currently leak out of the update layer?

Creating a channel

  1. What factors should be considered before opening a Lightning channel with a peer?

The Update Layer

  1. How would switching to PTLCs affect the update layer?

  2. If LN were to upgrade the update layer, would the network need to end-to-end upgrade?

  3. Why are the second stage HTLC transactions not part of the commitment transaction?

The Transfer Layer

  1. Explain how the timeout mechanism works for in-flight HTLCs?

  2. How is the payment hash sent to the payer?

  3. Can both HTLCs and PTLCs coexist in a channel?

  4. What's are the required parts of invoices?

The Multihop Layer

  1. How can nodes that are not always online prevent loss of funds?

  2. What are the risks of forwarding below-dust payments?

  3. What is the relationship of the revocation keys for multiple subsequent commitment transactions? What would change if revocation keys were independent?

  4. How can you send a payment to a node without getting an invoice? What are the tradeoffs of this payment method?

  5. Why is a grace period added to the HTLC timeout?

  6. What are routing hints and why are they important for private channels? Do they leak privacy?

Diffie–Hellman key exchange

  1. What is a Diffie-Hellman key exchange used for?

How and when do I use HMAC?

  1. What's the difference between a MAC and an HMAC?

  2. Where are HMAC and MAC implemented in lightning and why?

PreviousPayment Channels, Intro to Lightning, and HTLCsNextLightning Routing

Last updated 2 months ago

A walk through the layers of Lightning
Creating a channel
Updating State
Revocation in more detail
The Update Layer
The Transfer Layer
The Multihop Layer
The other layers (base and transport)
Message format
Ok to be odd
TLV streams
Feature bits
Diffie–Hellman key exchange
How and when do I use HMAC?
Lightning transactions: from Zero to Hero (optional)