# Mastering the Lightning Network

[![CC BY-SA 4.0][cc-by-sa-shield]][cc-by-sa]

STATUS: First Edition published on Dec 21, 2021

<img src="images/cover_thumb.png" width=200 alt="Mastering Lightning Cover">

## About
Mastering the Lightning Network is an O'Reilly Media book, by authors Andreas M. Antonopoulos ([@aantonop](https://twitter.com/aantonop)), Olaoluwa Osuntokun ([@roasbeef](https://twitter.com/roasbeef)), Rene Pickhardt ([@renepickhardt](https://twitter.com/renepickhardt)). It was published on Dec 21, 2021, in paperback and e-book, by O'Reilly Media. It is available everywhere that books are sold. This repository contains the manuscript of the book as published by O'Reilly Media, tagged as [firstedition_firstprint](https://github.com/lnbook/lnbook/releases/tag/firstedition_firstprint).

The book describes the Lightning Network (LN), a Peer-to-Peer protocol running on top of Bitcoin and other blockchains, which provides near-instant, secure, micro-payments.

The book is suitable for technical readers with an understanding of the fundamentals of Bitcoin and other open blockchains.

## Contents

### Preface

*  [Cover](cover.html)
*  [Titlepage](titlepage.html)
*  [Copyright](copyright.html)
*  [Table of Contents](toc.html)
*  [Preface](preface.asciidoc)

### Part 1

*  [Part 1 - Intro](part_1_divider.asciidoc)
*  [Introduction](01_introduction.asciidoc)
*  [Getting Started](02_getting_started.asciidoc)
*  [How the Lightning Network Works](03_how_ln_works.asciidoc)
*  [Lightning Node Software](04_node_client.asciidoc)
*  [Operating a Lightning Network Node](05_node_operations.asciidoc)

### Part 2

*  [Part 2 - Intro](part_2_divider.asciidoc)
*  [Lightning Network Architecture](06_lightning_architecture.asciidoc)
*  [Payment Channels](07_payment_channels.asciidoc)
*  [Routing on a Network of Payment Channels](08_routing_htlcs.asciidoc)
*  [Channel Operation and Payment Forwarding](09_channel_operation.asciidoc)
*  [Onion Routing](10_onion_routing.asciidoc)
*  [Gossip and the Channel Graph](11_gossip_channel_graph.asciidoc)
*  [Pathfinding and Payment Delivery](12_path_finding.asciidoc)
*  [Wire Protocol: Framing and Extensibility](13_wire_protocol.asciidoc)
*  [Lightning's Encrypted Message Transport](14_encrypted_transport.asciidoc)
*  [Lightning Payment Requests](15_payment_requests.asciidoc)
*  [Security and Privacy of the Lightning Network](16_security_privacy_ln.asciidoc)
*  [Conclusion](17_conclusion.asciidoc)

### Appendices

*  [Bitcoin Fundamentals Review](appendix_bitcoin_fundamentals_review.asciidoc)
*  [Docker Basics](appendix_docker_basics.asciidoc)
*  [Protocol Messages](appendix_protocol_messages.asciidoc)

### Glossary

*  [Glossary](glossary.asciidoc)

### Author Bios and Colophon

*  [Author Bios](author_bio.html)
*  [Colophon](colo.html)

## Creative Commons Attribution Sharealike License

Mastering the Lightning Network is released under the Creative Commons CC-BY-SA 4.0 license. The full terms of the license can be found here:

[![CC BY-SA 4.0][cc-by-sa-shield]][cc-by-sa]

<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Text" property="dct:title" rel="dct:type">Mastering the Lightning Network</span> by <span xmlns:cc="http://creativecommons.org/ns#" property="cc:attributionName">Andreas M. Antonopoulos, Olaoluwa Osuntokun, Rene Pickhardt</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.<br />Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="https://github.com/lnbook/lnbook" rel="dct:source">https://github.com/lnbook/lnbook</a>.

This "Free Culture" compliant license was approved by our publisher O'Reilly Media (http://oreilly.com), who understands the value of open source. O'Reilly Media is not just the world's best publisher of technical books, but is also a strong supporter of this open culture and the sharing of knowledge.

Thank you O'Reilly Media!

## Translations and Derivatives (eg. PDF, HTML, EPUB ebooks)

The current license permits derivative work, such as independent translations and the production and circulation of PDF, HTML or other derivative renderings of the source ASCIIDOC. *The license does not extend to O'Reilly Media intellectual property, such as the cover page.*

If you are interested in translating this book please see [TRANSLATING.md](TRANSLATING.md)

[cc-by-sa]: http://creativecommons.org/licenses/by-sa/4.0/
[cc-by-sa-image]: https://licensebuttons.net/l/by-sa/4.0/88x31.png
[cc-by-sa-shield]: https://img.shields.io/badge/License-CC%20BY--SA%204.0-lightgrey.svg
