[preface] [[preface]] == Preface The Lightning Network (LN) is a second layer peer-to-peer network that allows us to make Bitcoin payments "off-chain," meaning without committing them as transactions to the Bitcoin blockchain. The Lightning Network gives us Bitcoin payments that are secure, cheap, fast, and much more private, even for very small payments. Building on the idea of payment channels, first proposed by Bitcoin's inventor Satoshi Nakamoto, the Lightning Network is a routed network of payment channels where payments "hop" across a path of payment channels from the sender to the recipient. The initial idea of the Lightning Network was proposed in 2015 in the groundbreaking paper "The Bitcoin Lightning Network: Scalable Off-Chain Instant Payments," by Joseph Poon and Thaddeus Dryja. By 2017, there was a "test" Lightning Network running on the internet, as different groups built compatible implementations and coordinated to set some interoperability standards. In 2018, the Lightning Network went "live" and payments started flowing. In 2019, Andreas M. Antonopoulos, Olaoluwa Osuntokun, and René Pickhardt agreed to collaborate to write this book. It appears we have been successful! === How to Use This Book [[intended_audience_sec]] === Intended Audience This book is mostly intended for technical readers with an understanding of the fundamentals of Bitcoin and other open blockchains. [role="pagebreak-before less_space"] [[conventinons_used_sec]] === Conventions Used in This Book The following typographical conventions are used in this book: _Italic_:: Indicates new terms, URLs, email addresses, filenames, and file extensions. +Constant width+:: Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords. **`Constant width bold`**:: Shows commands or other text that should be typed literally by the user. _++Constant width italic++_:: Shows text that should be replaced with user-supplied values or by values determined by context. [TIP] ==== This element signifies a tip or suggestion. ==== [NOTE] ==== This element signifies a general note. ==== [WARNING] ==== This element indicates a warning or caution. ==== [[code_examples_sec]] === Code Examples The examples are illustrated in Go, C++, Python, and using the command line of a Unix-like operating system. All code snippets are available in the GitHub repository under the _code_ subdirectory. Fork the book code, try the code examples, or submit corrections via https://github.com/lnbook/lnbook[GitHub]. All the code snippets can be replicated on most operating systems with a minimal installation of compilers, interpreters, and libraries for the corresponding languages. Where necessary, we provide basic installation instructions and step-by-step examples of the output of those instructions. Some of the code snippets and code output have been reformatted for print. In all such cases, the lines have been split by a backslash (+\+) character, followed by a newline character. When transcribing the examples, remove those two characters and join the lines again and you should see identical results to those shown in the example. All the code snippets use real values and calculations where possible, so that you can build from example to example and see the same results in any code you write to calculate the same values. For example, the private keys and corresponding public keys and addresses are all real. [[using_code_examples_sec]] === Using Code Examples If you have a technical question or a problem using the code examples, please send email to pass:[bookquestions@oreilly.com]. This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission. We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, ISBN, and copyright. For example: “__Mastering the Lightning Network__ by Andreas M. Antonopoulos, Olaoluwa Osuntokun, and René Pickhardt (O'Reilly). Copyright 2022 aantonop Books LLC, René Pickhardt, and uuddlrlrbas LLC, ISBN 978-1-492-05486-3." __Mastering the Lightning Network__ is offered under the Creative Commons Attribution-Noncommercial-No Derivative Works 4.0 International License (CC BY-NC-ND 4.0). If you feel your use of code examples falls outside fair use or the permission given previously, feel free to contact us at pass:[permissions@oreilly.com]. === References to Companies and Products All references to companies and products are intended for educational, demonstration, and reference purposes. The authors do not endorse any of the companies or products mentioned. We have not tested the operation or security of any of the products, projects, or code segments shown in this book. Use them at your own risk! [[addresses_and_transactions_sec]] === Addresses and Transactions in This Book The Bitcoin addresses, transactions, keys, QR codes, and blockchain data used in this book are, for the most part, real. That means you can browse the blockchain, look at the transactions offered as examples, retrieve them with your own scripts or programs, etc. However, note that the private keys used to construct the addresses printed in this book have been "burned." This means that if you send money to any of these addresses, the money will either be lost forever or (more likely) appropriated, since anyone who reads the book can take it using the private keys printed herein. [WARNING] ==== DO NOT SEND MONEY TO ANY OF THE ADDRESSES IN THIS BOOK. Your money will be taken by another reader, or lost forever. ==== === O'Reilly Online Learning [role = "ormenabled"] [NOTE] ==== For more than 40 years, pass:[O’Reilly Media] has provided technology and business training, knowledge, and insight to help companies succeed. ==== Our unique network of experts and innovators share their knowledge and expertise through books, articles, and our online learning platform. O’Reilly’s online learning platform gives you on-demand access to live training courses, in-depth learning paths, interactive coding environments, and a vast collection of text and video from O'Reilly and 200+ other publishers. For more information, visit pass:[http://oreilly.com]. [[how_to_contact_us_sec]] === How to Contact Us Information about _Mastering the Lightning Network_ as well as the Open Edition and translations are available at link:$$https://lnbook.info/$$[]. Please address comments and questions concerning this book to the publisher: ++++