2
0
mirror of https://github.com/lnbook/lnbook synced 2024-11-18 21:28:03 +00:00
lnbook/ch01.asciidoc
Andreas M. Antonopoulos e9dcaacfd6 Updated user stories
More detail, specific names and background color added to all the user stories
2020-01-17 12:51:30 -05:00

97 lines
8.2 KiB
Plaintext

[role="pagenumrestart"]
[[ch01_intro_what_is_the_lightning_network]]
== Introduction
=== What is the Lightning Network?
The Lightning Network (LN) is a "second layer" protocol on top of Bitcoin and other blockchains that enables fast, secure, private, trustless and permissionless payments.
Users of the LN are able to route payments to each other for very low cost and in real time.
Users who transact on the LN do not need to wait for block confirmations for payments.
Once a payment on the LN has completed, usually within a few seconds, it is final and cannot be reversed: like a Bitcoin transaction, a payment on the LN can only be refunded by the recipient.
While "on-chain" Bitcoin transactions are broadcast and verified by all nodes in the network, transactions routed on the LN are transmitted between pairs of nodes and not visible to everyone, resulting in much greater privacy.
The LN uses onion routing, similar to the protocol used by The Onion Router (TOR) privacy network, so that even the nodes involved in routing a transaction are only directly aware of their predecessor and successor in route.
=== Motivation for the Lightning Network
// TODO
=== Lightning Network Basic Concepts
// TODO Introduce and briefly explain the basic concepts of the LN
[[user-stories]]
=== Lightning Network Uses, Users, and Their Stories
As an electronic cash system Bitcoin preserves the 3 most important properties of money (medium of exchange, store of value, and unit of account).
The invention of money (and in particular Bitcoin) was primarily made to facilitate trade and enable the exchange of value between people.
However, without the LN, Bitcoin is hard to be used concurrently by millions of people.
Therefore, in order to fully understand the uses of the LN, we'll examine it from the perspective of people using it.
In particular the use cases will come from previous users of Bitcoin as well as people who have not used Bitcoin before.
Each of the people and their stories, as listed here, illustrates one or more specific use cases.
We'll be seeing them throughout this book:
consumer::
Alice is a bitcoin user who wants to make fast, secure, cheap and private payments for small amount retail purchases. She buys coffee with bitcoin, using the Lightning Network
merchants::
Bob owns a coffee shop, "Bob's Cafe". "On-chain" bitcoin payments don't scale for small amounts like a cup of coffee, so he uses the Lightning Network to accept bitcoin payments almost instantaneously and for very low fees.
web designer::
Saanvi is a web designer and developer in Bangalore India. She accepts bitcoin for her work, but would prefer to get paid more frequently and so uses the Lightning Network to get paid for each small milestone she completes. With the LN can do more small jobs for more clients without worrying about fees or delays.
content creator / curator::
John is a 9 year old boy from New Zealand, who wanted a game console just like his friends. However, his dad told him that in order to buy it, he had to earn the money by himself. Now John is an aspiring artist so he knows that while he is still learning, he can't charge much for his artwork. After learning about Bitcoin, he managed to setup a website to sell his drawings across the internet. By using the LN, John was able to charge as little as $1 for one of his drawings. By being able to set a fair price, which would normally be considered a micro-payment and as such not possible with other payment methods, and by using a global currency such as Bitcoin, John was able to sell his art work to customers all over the world and in the end buy the game console he wanted so much.
gamer::
Gloria is a teenage gamer from the Philippines. She plays many different computer games, but her favorite ones are those that have an "in-game economy" based on real money. As she plays games, she also earns money by acquiring and selling virtual in-game items. The Lightning Network allows her to transact in small amount for in-game items as well as earn small amounts for completing quests.
migrant::
Farel is an immigrant, who sends money home to his family in Indonesia by working in the Middle East. Remittance companies and banks charge very high fees, and Farel prefers to send smaller amounts more often. Using the Lightning Network, Farel can send bitcoin as often as he wants, with negligible fees.
software service business::
Wei is an entrepreneur who sells information services related to the Lightning Network, as well as Bitcoin and other cryptocurrencies. Wei is monetizing his API endpoints by implementing micro-payments over the Lightning Network. Additionally, Wei has implemented a liquidity provider service that rents inbound channel capacity on the LN, charging a small bitcoin fee for each rental period.
=== Getting Started
In this section we will start by choosing the right software to demonstrate the LN and learn by example. We will examine the choices of two users who represent a common use-case for the LN. Alice, a coffee shop customer will be using a LN wallet on her mobile device to buy coffee from Bob's Cafe. Bob, a merchant, will be using a LN node and wallet to run a point-of-sale system at his cafe so he can accept payment over the LN.
==== Lightning Nodes
The Lightning Network is accessed via software applications that can speak the Lightning Network protocol. A _Lightning Network Node_ (or simply "node") is a software application that communicates on a peer-to-peer basis with other LN nodes, forming the Lightning _Network_ itself. Nodes also include "wallet" functionality, so they can send and receive payments over the LN and on the Bitcoin network.
Lightning network nodes also need access to the Bitcoin blockchain, or another blockchain such as Litecoin. Users have the highest degree of control by running their own authoritative Bitcoin node and LN node.
However, LN nodes can also use a lightweight Bitcoin client (commonly referred to as Simplified Payment Verification (SPV)) to partially validate the correctness of their blockchain.
==== Lightning Wallets
A fully functional lightning wallet contains a LN node and communicates as a peer on the LN. However, some lightning wallets do not contain an LN node, but rely on an LN node operated by a third making it _custodial_, meaning that their funds are in the custody of a third party.
Every user must consider their own technical skills before deciding what type of lightning wallet to use. Those with strong technical skills should run their own LN node. Those with less technical skill but a desire to control their funds without any third party custody, should choose a _non-custodial_ lightning wallet which relies on a third-party LN node. Finally, those seeking simplicity and convenience, even at the expense of control and security, may choose a custodial lightning wallet.
Here are the three broad categories of lightning wallets and the relative degree of control they offer to the user:
|===
| Wallet Type | LN Participation | Keys/Funds Custody | Technical Skill Needed |
| Full Node & Wallet | Full Node | User Control | High |
| Non-Custodial Wallet | Rely on 3rd-party node | User Control | Medium |
| Custodial Wallet | 3rd-party node | 3rd-party custody | Low |
|===
Lightning wallets can be installed on a variety of devices, including laptops, servers and mobile devices. To run an LN node and an authoritative Bitcoin node you will need to use a server or desktop computer, as mobile devices and laptops are usually not powerful enough in terms of capacity, processing, battery life and connectivity. On a laptop or mobile device you can run a LN node that relies on a third-party Bitcoin node for access to the blockchain.
Here are some current examples of LN node and wallet applications for different types of devices:
|===
| Application | Device | LN Node | Bitcoin Node | Wallet Type |
| lnd | Server | Full Node | Bitcoin Core/btcd | Full Control |
| c-lightning | Server | Full Node | Bitcoin Core | Full Control |
| eclair | Server | Full Node | Bitcoin Core/Electrum | Full Control |
| Zap Desktop | Desktop | Full Node | Bitcoin Core/btcd | Full Control |
| Eclair Mobile | Mobile | Lightweight | Electrum | Full Control |
|===