From 919b743c1d629b1120c6fda06a06b0c6d64f6aea Mon Sep 17 00:00:00 2001 From: Rene Pickhardt Date: Thu, 12 Sep 2019 23:25:49 +0200 Subject: [PATCH 01/17] comparison routing vs path finding --- topics.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/topics.asciidoc b/topics.asciidoc index 07805ca..a5335ed 100644 --- a/topics.asciidoc +++ b/topics.asciidoc @@ -201,6 +201,7 @@ They have particular illustrative purpose and are therefore collected seperately * eltoo vs RSMC (?) * private key vs fully signed transaction (it can be seen as almost the same in the sense of ownership) * locked bitcoin vs freely movable bitcoin (onchain vs. offchain bitcoin) +* routing vs path finding ==== examples tba \ No newline at end of file From 949274e6887aa5a83b0822b18230c5bfea109f87 Mon Sep 17 00:00:00 2001 From: "Andreas M. Antonopoulos" Date: Sun, 15 Sep 2019 11:11:41 -0400 Subject: [PATCH 02/17] Added Travis build status badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1233124..0bb9996 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Mastering the Lightning Network +[![Build Status](https://travis-ci.com/lnbook/lnbook.svg?branch=develop)](https://travis-ci.com/lnbook/lnbook) + ![Mastering Lightning Cover](images/cover_thumb.png) Mastering the Lightning Network is an O'Reilly Media book, due for publication in Q4'2020, and announced on August 28th by authors Andreas M. Antonopoulos ([@aantonop](https://twitter.com/aantonop)), Olaoluwa Osuntokun ([@roasbeef](https://twitter.com/roasbeef)), Rene Pickhardt ([@renepickhardt](https://twitter.com/renepickhardt)). From b065514e3bb4a1ea42332934c7096d83ea40d419 Mon Sep 17 00:00:00 2001 From: Rene Pickhardt Date: Mon, 16 Sep 2019 17:02:59 +0200 Subject: [PATCH 03/17] added 7 ingredients for a payment channel protocol --- topics.asciidoc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/topics.asciidoc b/topics.asciidoc index a5335ed..6e6613a 100644 --- a/topics.asciidoc +++ b/topics.asciidoc @@ -204,4 +204,15 @@ They have particular illustrative purpose and are therefore collected seperately * routing vs path finding ==== examples -tba \ No newline at end of file +tba + +==== properties + +* the seven ingredients for a payment channel c.f: https://youtu.be/AcP3czefanM +** 2-2 musig address +** funding transaction to open the channel (without possibility to malleate the transaction) +** commitment transaction to encode the balance of the channel +** a time lock to remove trust +** a communication protocol for partners exchange data outside of the bitcoin network +** asymmetrical information (unless we switch to eltoo but even there not all keys are shared but channel state is symmetric) +** game theoretic and economical incentives to follow the protocol From 7c525f2dec49482d13dcdda941e84d618b9fe213 Mon Sep 17 00:00:00 2001 From: Rene Pickhardt Date: Mon, 16 Sep 2019 17:08:01 +0200 Subject: [PATCH 04/17] added the first mediabox to the book as a TIP --- ch01.asciidoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ch01.asciidoc b/ch01.asciidoc index ab34216..33e665f 100644 --- a/ch01.asciidoc +++ b/ch01.asciidoc @@ -62,6 +62,11 @@ Once the timelock was over or all Bitcoin were sent to B the channel would have The obvious idea of opening two channels one from A to B and one from B to A would not have helped as each of those channels would have to be closed and reestablished once it ran dry. The core breakthrough for the Lightning Network to become a reallity was the ability to create payment channels which technically can live forever and can send money back and forth as often as the peers wish to in combination with routing payments among several channels. +[TIP] +==== +You can watch a video explaining the construction and operation of unidirectional payment channels online at: https://youtu.be/AcP3czefanM +==== + Surprisingly both properties took quite some while until the community figured them out. Technically speaking the unidirectional payment channel has all the important ingreedients (funding transaction to a 2-2 multisignature wallet, a transaction spending from the wallet encoding the balance, a timelock to allow refunding if the other side becomes unresponsive, off chain communication and the fact that no additional trust other than the one in the bitcoin network) of modern payment channels which are used in the Lightning Network. Despite being rather useless in todays world we will study the unidirectional payment channel in more depth in this book as it is an easy to understand educational example to approach the construction of todays payment channels. From c0d3b46e9fc665bd6bfb8c7e630c47b430d2f60f Mon Sep 17 00:00:00 2001 From: practicalswift Date: Mon, 16 Sep 2019 18:38:23 +0200 Subject: [PATCH 05/17] travis: Add linter to make sure Unix style line endings are used. Add trailing whitespace linter. Fix typos. (#60) * travis: Add linter to make sure Unix style line endings are used * Fix typos * travis: Add linter to detect trailing spaces at end of line * Remove trailing whitespace * Use consistent indentation * travis: Add linter guarding against use of tabs --- .travis.yml | 3 +++ CONTRIBUTING.md | 2 +- ch01.asciidoc | 38 +++++++++++++++++++------------------- glossary.asciidoc | 24 ++++++++++++------------ topics.asciidoc | 6 +++--- 5 files changed, 38 insertions(+), 35 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7286e33..4e316e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,4 +10,7 @@ install: - pip3 install --user codespell script: + - git grep $'\r' -- "*.asciidoc" "*.md" && echo "^ Possible Windows style line ending detected. Please use Unix style line endings (\n)." && false || true + - git grep ' $' -- "*.asciidoc" "*.md" && echo "^ Trailing space detected at end of line. Please remove." && false || true + - git grep $'\t' -- "*.asciidoc" "*.md" && echo "^ Use of tabs detected. Please use space for indentation." && false || true - codespell --ignore-words-list=que $(git ls-files -- "*.asciidoc" "*.md") diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3c41c58..b7bfbdc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,7 +55,7 @@ Adjust heading style in each section as follows: 5. Should include a unique anchor all lower case, underscore separated, within double square brackets (eg. [[intro_to_htlcs]]). 6. Headings should be followed by a blank line. 7. Heading should be followed by a paragraph of text, not a lower-level heading without any text. If you find one like this, add a TODO comment (line of 4 slashes "////", line with "TODO: add paragraph", line of 4 slashes) -8. Often it seems useful to link to a webpage / url. Since the research community figured out that every year about 50% of all outstanding url's become invalid we encourage you to use the wayback machine / Web Archive at: http://web.archive.org and provide a link to a saved copy of the web page. +8. Often it seems useful to link to a webpage / url. Since the research community figured out that every year about 50% of all outstanding url's become invalid we encourage you to use the wayback machine / Web Archive at: http://web.archive.org and provide a link to a saved copy of the web page. Complete Example: diff --git a/ch01.asciidoc b/ch01.asciidoc index 33e665f..1196551 100644 --- a/ch01.asciidoc +++ b/ch01.asciidoc @@ -25,8 +25,8 @@ We very, very much need such a system, but the way I understand your proposal, i ____ While James A. Donald was probably referring to maintenance of the unspent transaction outputs (UTXOs) database, it quickly became clear that verifying and storing so many transactions would also become infeasible for any blockchain. -A key requirement for a second layer protocol such as Lightning (which will be described in greater depth later in this book) is the ability to sequence transactions external to the blockchain. In the first verisons of Bitcoin, Satoshi Nakamoto recognised this and introduced a data field called `nSequence` into the input transaction data. -The `nSequence` field was intended to allow users to transmit updated versions of a transaction to the network, changing the outputs of a transaction, effectively creating a payment channel. +A key requirement for a second layer protocol such as Lightning (which will be described in greater depth later in this book) is the ability to sequence transactions external to the blockchain. In the first versions of Bitcoin, Satoshi Nakamoto recognised this and introduced a data field called `nSequence` into the input transaction data. +The `nSequence` field was intended to allow users to transmit updated versions of a transaction to the network, changing the outputs of a transaction, effectively creating a payment channel. Such a payment channel would then be valid as long as the transaction was not mined. According to a Mailinglist post in 2013 by early Bitcoin developer Mike Hearn, Satoshi Nakamoto envisioned this construction for the use case of high frequency trading.footnote:HearnBitcoinDev[Mike Hearn on Bitcoin-dev - April 16th 2013 - Anti DoS for tx replacement http://web.archive.org/web/20190501234757/https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html.] @@ -34,8 +34,8 @@ There were however some weaknesses in this initial formulation, which limited it The Revocable Sequence Maturity Contracts (RSMC) which form the payment channels in the first version of the Lightning Network have taken part of their name from their property of fixing the `nSequence` field. This is achieved by creating an economic incentive via a penalty mechanism if not the most recent transaction in the payment channel is published to the Bitcoin network. -Effectively the most recent update of the payment channel (encoded as a bitcoin transaction) becomes enforcable in this way. -// find / add sources for some of the claimes +Effectively the most recent update of the payment channel (encoded as a bitcoin transaction) becomes enforceable in this way. +// find / add sources for some of the claims In July of 2011, on the bitcointalk.org forum, a pseudonomous user by the name of _hashcoin_ proposed the usage of Timelocks via the `nLockTime` function of the bitcoin network to solve the custody problem of exchanges.footnote:[Hashcoin on Bitcoin talk on July 4th 2011 - Instant TX for established business relationships (need replacements/nLockTime) http://web.archive.org/web/20190419103503/https://bitcointalk.org/index.php?topic=25786.0] The idea was to be able to quickly trade / sell Bitcoin without the necessity to send all the bitcoins to the exchange in the first place. @@ -49,10 +49,10 @@ Whenever she wanted to do so she could create a newer spend of the funding trans This transaction could not be mined without a signature from Bob. Alice would send the partially signed transaction to Bob how would sign it and keep it private. Note that keeping it private and not sharing the fully signed transaction back to Alice is crucial. -Since Alice never has both signatures for a spend of the multisignature wallet besides the timelocked refund transaction she can't send an outdated spend of the funding transaction to the bitcoin network. +Since Alice never has both signatures for a spend of the multisignature wallet besides the timelocked refund transaction she can't send an outdated spend of the funding transaction to the bitcoin network. Bob on the other hand could do so but he would have no interest in publishing an old state since a newer state would always provide him with more bitcoin than any older state. -Alice is not able to have the refund transaction mined into a block before the timelock expires. -This gives Bob the security to receive more updates as long as the channel would be `open`. +Alice is not able to have the refund transaction mined into a block before the timelock expires. +This gives Bob the security to receive more updates as long as the channel would be `open`. This mechanism would allow two users to engage into several smaller transactions which all happened outside of the Bitcoin network. While this construction of the unidirectional payment channel would have solved the custody problem of exchanges it has never been widely implemented. @@ -69,7 +69,7 @@ You can watch a video explaining the construction and operation of unidirectiona Surprisingly both properties took quite some while until the community figured them out. Technically speaking the unidirectional payment channel has all the important ingreedients (funding transaction to a 2-2 multisignature wallet, a transaction spending from the wallet encoding the balance, a timelock to allow refunding if the other side becomes unresponsive, off chain communication and the fact that no additional trust other than the one in the bitcoin network) of modern payment channels which are used in the Lightning Network. -Despite being rather useless in todays world we will study the unidirectional payment channel in more depth in this book as it is an easy to understand educational example to approach the construction of todays payment channels. +Despite being rather useless in today's world we will study the unidirectional payment channel in more depth in this book as it is an easy to understand educational example to approach the construction of today's payment channels. This setup has one safety issue as transactions have been malleable without the segwit upgrade. A problem that needed to be solved for any payment channel construction that we know up till today and which has been fixed in August 2017. @@ -79,7 +79,7 @@ The Ultra Transaction server was proposed to be a trusted partner of a 2-2 multi Andresen observed that with such a mechanism, payments would effectively take place offchain, allowing the number of transacations which could be handled by the system to be increased. Andresen noted that there might be a better construction which would require less trust in the Ultra Server, and while his proposal was a step in the right direction, a few issues remained to be solved before the design of fully trustless payment channels was complete. -Andresen's work led to many discussions on Bitcointalk forum, and later on the bitcoin-development mailing list. These discussions resulted in the first construction of the first unidirectional payment channels. +Andresen's work led to many discussions on Bitcointalk forum, and later on the bitcoin-development mailing list. These discussions resulted in the first construction of the first unidirectional payment channels. to sum this up: Andresen used a similar construction as the unidirectional channel. They key difference was that a trusted party would have co-signed the spend of the funding transaction. @@ -91,16 +91,16 @@ Without mentioning the term network or routing of payments the idea of connectin In Rosenfelds solution payment providers would be the ultraservers and they would among themselves settle the transactions based on trust. It took us another 3 years until the lightning network whitepaper emerged which had solved all the bits and bolts necessary to get rid of the trust in Rosenfelds solution. -It was 2013 that Bitcoin developer Mike Hearn refered to Meni Rosenfelds proposal and suggesting to reactivate the `nSequence` field which Satoshi preiviously had deactivated.footnote:HearnBitcoinDev[] -Also Hearn refered to a section on the contracts article talking about the case of micropayment channels with the help of `nSequence` +It was 2013 that Bitcoin developer Mike Hearn referred to Meni Rosenfelds proposal and suggesting to reactivate the `nSequence` field which Satoshi preiviously had deactivated.footnote:HearnBitcoinDev[] +Also Hearn referred to a section on the contracts article talking about the case of micropayment channels with the help of `nSequence` Links: * https://en.bitcoin.it/w/index.php?title=Contract&oldid=36712#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party -* Multiple white papers +* Multiple white papers ** Joseph Poon, Thaddeus Dryja - The Bitcoin Lightning Network: -Scalable Off-Chain Instant Payments https://lightning.network/lightning-network-paper.pdf +Scalable Off-Chain Instant Payments https://lightning.network/lightning-network-paper.pdf ** Christian Decker, Roger Wattenhoffer - A Fast and Scalable Payment Network with Bitcoin Duplex Micropayment Channels https://tik-old.ee.ethz.ch/file/716b955c130e6c703fac336ea17b1670/duplex-micropayment-channels.pdf @@ -132,7 +132,7 @@ A person or platform offering content on the web. They want to install a pay wall or get tipped by their fans and consumers. This could even include music or video streaming on demand paying in real time. -John is a 9 year old boy from Australia, who wanted a games console just like his friends. However he was told by his dad 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 Lightning Network, 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 micropayment 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 games console he so very much wanted. +John is a 9 year old boy from Australia, who wanted a games console just like his friends. However he was told by his dad 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 Lightning Network, 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 micropayment 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 games console he so very much wanted. gamer:: Similar to the content creator, a gamer and live streamer would like to be tipped. @@ -153,11 +153,11 @@ They usually pay fees for using point of sales services and several payment meth This directly decreases the margin on which merchants operate. A merchant will be happy to get an additional payment method which is virtually for free to the merchant. -An example of a merchant is Silke. -Silke runs a small coffee shop in an upmarket street in Berlin. -She knows about Bitcoin and wants to accept it in her shop, but has been reluctant to do so because she knows that Bitcoin payments take approx. 10 minutes to be confirmed into her account. -However with the Lightning Network, she knows that her regular clients, such as Joerg can pay for their coffee at her shop, quickly and with negligible fees. -Additionally, by using the Lightning Network, Silke has all funds deposited instantly to her wallet and with usually smaller fees on her side as well. +An example of a merchant is Silke. +Silke runs a small coffee shop in an upmarket street in Berlin. +She knows about Bitcoin and wants to accept it in her shop, but has been reluctant to do so because she knows that Bitcoin payments take approx. 10 minutes to be confirmed into her account. +However with the Lightning Network, she knows that her regular clients, such as Joerg can pay for their coffee at her shop, quickly and with negligible fees. +Additionally, by using the Lightning Network, Silke has all funds deposited instantly to her wallet and with usually smaller fees on her side as well. Ultimately this allows her to provide a better service or to offer better pricing for her products. diff --git a/glossary.asciidoc b/glossary.asciidoc index df9203d..5ad759f 100644 --- a/glossary.asciidoc +++ b/glossary.asciidoc @@ -75,24 +75,24 @@ c-lightning:: Implementation of the Lightning Network Protocol by the Victoria based Blockstream. It is written in C. Closing Transaction:: - If both channel partners agree to close a channel they will create a spent of the funding transaction that reflects the most recent commitment transaction. - It does not include any Hashed Time Lock Contracts or Revocable Sequence Maturity Contracts. - After exchanging signatures for a closing transaction no further channel updates should be made, as this one allows one side to enforce the closing transaction on the blockchain. - Mutually closing a channel with the help of a closing transaction has the advantage that less blockchain transactions are required to claim all funds, in comparison to unilaterally forcing a channel close by publishing a commitment transaction. Additionally, funds are for both parties immediately spendable from a closing transaction. + If both channel partners agree to close a channel they will create a spent of the funding transaction that reflects the most recent commitment transaction. + It does not include any Hashed Time Lock Contracts or Revocable Sequence Maturity Contracts. + After exchanging signatures for a closing transaction no further channel updates should be made, as this one allows one side to enforce the closing transaction on the blockchain. + Mutually closing a channel with the help of a closing transaction has the advantage that less blockchain transactions are required to claim all funds, in comparison to unilaterally forcing a channel close by publishing a commitment transaction. Additionally, funds are for both parties immediately spendable from a closing transaction. coinbase:: - A special field used as the sole input for coinbase transactions. The coinbase allows claiming the block reward and provides up to 100 bytes for arbitrary data. + A special field used as the sole input for coinbase transactions. The coinbase allows claiming the block reward and provides up to 100 bytes for arbitrary data. The block reward consists of two things. First newly generated coins. The amount of allowed coins to be generated is part of the consensus rules and decreases over time based on the current block height. In addition to the newly generated coins, the miner is also allowed to add all the fees of the transactions from the current block to the coinbase. Not to be confused with Coinbase transaction. coinbase transaction:: - The first transaction in a block. Always created by a miner, it includes a single coinbase. - Not to be confused with Coinbase. + The first transaction in a block. Always created by a miner, it includes a single coinbase. + Not to be confused with Coinbase. cold storage:: - Refers to keeping a reserve of bitcoin offline. Cold storage is achieved when Bitcoin private keys are created and stored in a secure offline environment. Cold storage is important for anyone with bitcoin holdings. Online computers are vulnerable to hackers and should not be used to store a significant amount of bitcoin. + Refers to keeping a reserve of bitcoin offline. Cold storage is achieved when Bitcoin private keys are created and stored in a secure offline environment. Cold storage is important for anyone with bitcoin holdings. Online computers are vulnerable to hackers and should not be used to store a significant amount of bitcoin. Commitment Transaction:: Commitment Transactions encode the balance of the payment channel with the help of one output for each channel partner by spending the funding transaction. @@ -111,7 +111,7 @@ Computationally Hard:: A problem is considered to be computationally hard if no algorithm exists or is known that is able to compute the solution to the problem rather quickly. confirmations:: - Once a transaction is included in a block, it has one confirmation. As soon as _another_ block is mined on the same blockchain, the transaction has two confirmations, and so on. Six or more confirmations are considered sufficient proof that a transaction cannot be reversed. + Once a transaction is included in a block, it has one confirmation. As soon as _another_ block is mined on the same blockchain, the transaction has two confirmations, and so on. Six or more confirmations are considered sufficient proof that a transaction cannot be reversed. Contract:: A contract is a set of Bitcoin transactions which result together in a certain desired behavior. @@ -155,7 +155,7 @@ Ephemeral Key:: Even if an ephemeral key leaks, only information about a single payment becomes public. fees:: - The sender of a transaction often includes a fee to the network for processing the requested transaction. + The sender of a transaction often includes a fee to the network for processing the requested transaction. Not to be confused with a routing fee for payments on the lightning network. Nodes on the Lightning network are allowed to take a routing fee for forwarding payments. The routing fee is the sum of a fixed _base_fee_ and a _fee_rate_ which depends on the payment amount. @@ -246,7 +246,7 @@ Noise_XK:: K means that the public key of the receiver needs to be known. More particular (from: http://www.noiseprotocol.org/noise.html) the protocol enables. Encryption to a known recipient, strong forward secrecy. This payload is encrypted based on an ephemeral-ephemeral DH as well as an ephemeral-static DH with the recipient's static key pair. Assuming the ephemeral private keys are secure, and the recipient is not being actively impersonated by an attacker that has stolen its static private key, this payload cannot be decrypted. Sender authentication resistant to key-compromise impersonation (KCI). The sender authentication is based on an ephemeral-static DH ("es" or "se") between the sender's static key pair and the recipient's ephemeral key pair. Assuming the corresponding private keys are secure, this authentication cannot be forged. - // the noice protocol documentation is according to their IPR section public domain. The author is Trevor Perrin (noise@trevp.net) + // the noise protocol documentation is according to their IPR section public domain. The author is Trevor Perrin (noise@trevp.net) Onion Routing:: Onion routing is a technique for anonymous communication over a computer network. @@ -361,7 +361,7 @@ Second stage HTLC:: tbd. secret key (aka private key):: - The secret number that unlocks bitcoin sent to the corresponding address. pass:[A secret] key looks like the following: + The secret number that unlocks bitcoin sent to the corresponding address. pass:[A secret] key looks like the following: + ---- 5J76sF8L5jTtzE96r66Sf8cka9y44wdpJjMwCxR3tzLh3ibVPxh diff --git a/topics.asciidoc b/topics.asciidoc index 6e6613a..75cb084 100644 --- a/topics.asciidoc +++ b/topics.asciidoc @@ -52,7 +52,7 @@ Review of some mechanics and terms from Mastering Bitcoin. This would probably b === Motivation: Why the Lightning Network -* clear definition what does scaling of a computer system mean? (I realize that discussions often fail because that term is not well defined among participants. A similar definition might be necessary for Decentralized and trustless) +* clear definition what does scaling of a computer system mean? (I realize that discussions often fail because that term is not well defined among participants. A similar definition might be necessary for Decentralized and trustless) * Scale Payments (amount of possible payments independent of block size / data base size) * increase privacy (not all payments stored on chain) * decrease settlement time (get rid of confirmations) @@ -189,14 +189,14 @@ Creating Lightning Network Applications === comparisons and examples The following is a loose list of potential infoboxes, tables and dropins which will most likely make it to some part of the book. -They have particular illustrative purpose and are therefore collected seperately to keep better track of them. +They have particular illustrative purpose and are therefore collected separately to keep better track of them. ==== comparisons * payment process on Bitcoin vs payment process on the lightning network * transaction vs payment * capacity vs balance * routing fees vs mining fees -* private vs public channel (difficulty to have truely private channels that don't reveal over time on the blockchain?) +* private vs public channel (difficulty to have truly private channels that don't reveal over time on the blockchain?) * source based routing vs best effort routing (onion routing vs IP forwarding) * eltoo vs RSMC (?) * private key vs fully signed transaction (it can be seen as almost the same in the sense of ownership) From 8b8badc050502dcd5a571a91f842ae559dafb470 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Mon, 16 Sep 2019 18:47:01 +0200 Subject: [PATCH 06/17] travis: Add linter to detect "Satoshi style" double spacing (#61) * Remove double spaces * travis: Add linter to detect double spacing --- .travis.yml | 1 + CONTRIBUTING.md | 2 +- ch01.asciidoc | 10 +++++----- glossary.asciidoc | 8 ++++---- preface.asciidoc | 2 +- topics.asciidoc | 2 +- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4e316e1..becbf0a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,4 +13,5 @@ script: - git grep $'\r' -- "*.asciidoc" "*.md" && echo "^ Possible Windows style line ending detected. Please use Unix style line endings (\n)." && false || true - git grep ' $' -- "*.asciidoc" "*.md" && echo "^ Trailing space detected at end of line. Please remove." && false || true - git grep $'\t' -- "*.asciidoc" "*.md" && echo "^ Use of tabs detected. Please use space for indentation." && false || true + - git grep "[^ ] [^ ]" -- "*.asciidoc" "*.md" && echo "^ Satoshi style double spacing detected. Sorry Satoshi, please use single spacing." && false || true - codespell --ignore-words-list=que $(git ls-files -- "*.asciidoc" "*.md") diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b7bfbdc..20ab7a7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ Before contributing with a Pull Request, please read the current **PROJECT STATU All contributions must be properly licensed and attributed. If you are contributing your own original work, then you are offering it under a CC-BY license (Creative Commons Attribution). *You are responsible for adding your own name or pseudonym in the Acknowledgments section in the [Preface](preface.asciidoc), as attribution for your contribution.* -If you are sourcing a contribution from somewhere else, it must carry a compatible license. The book will initially be released under a CC-BY-NC-ND license which means that contributions must be licensed under open licenses such as MIT, CC0, CC-BY, etc. Contributions under a "share-alike" or GPL license are not compatible with the CC-BY-NC-ND license and therefore cannot be accepted. You need to indicate the original source and original license, by including an asciidoc markup comment above your contribution, like this: +If you are sourcing a contribution from somewhere else, it must carry a compatible license. The book will initially be released under a CC-BY-NC-ND license which means that contributions must be licensed under open licenses such as MIT, CC0, CC-BY, etc. Contributions under a "share-alike" or GPL license are not compatible with the CC-BY-NC-ND license and therefore cannot be accepted. You need to indicate the original source and original license, by including an asciidoc markup comment above your contribution, like this: ``` //// diff --git a/ch01.asciidoc b/ch01.asciidoc index 1196551..59fcb72 100644 --- a/ch01.asciidoc +++ b/ch01.asciidoc @@ -30,14 +30,14 @@ The `nSequence` field was intended to allow users to transmit updated versions o Such a payment channel would then be valid as long as the transaction was not mined. According to a Mailinglist post in 2013 by early Bitcoin developer Mike Hearn, Satoshi Nakamoto envisioned this construction for the use case of high frequency trading.footnote:HearnBitcoinDev[Mike Hearn on Bitcoin-dev - April 16th 2013 - Anti DoS for tx replacement http://web.archive.org/web/20190501234757/https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html.] -There were however some weaknesses in this initial formulation, which limited its potential. Firstly, the payment channel would only be open until the transaction was mined by the miners, either limiting the duration the payment channel or handing control of the payment channel to the miners. Secondly, there was no economic incentive for miners to respect the `nSequence` number, making this mechanism effectivley useless. +There were however some weaknesses in this initial formulation, which limited its potential. Firstly, the payment channel would only be open until the transaction was mined by the miners, either limiting the duration the payment channel or handing control of the payment channel to the miners. Secondly, there was no economic incentive for miners to respect the `nSequence` number, making this mechanism effectivley useless. The Revocable Sequence Maturity Contracts (RSMC) which form the payment channels in the first version of the Lightning Network have taken part of their name from their property of fixing the `nSequence` field. This is achieved by creating an economic incentive via a penalty mechanism if not the most recent transaction in the payment channel is published to the Bitcoin network. Effectively the most recent update of the payment channel (encoded as a bitcoin transaction) becomes enforceable in this way. // find / add sources for some of the claims -In July of 2011, on the bitcointalk.org forum, a pseudonomous user by the name of _hashcoin_ proposed the usage of Timelocks via the `nLockTime` function of the bitcoin network to solve the custody problem of exchanges.footnote:[Hashcoin on Bitcoin talk on July 4th 2011 - Instant TX for established business relationships (need replacements/nLockTime) http://web.archive.org/web/20190419103503/https://bitcointalk.org/index.php?topic=25786.0] +In July of 2011, on the bitcointalk.org forum, a pseudonomous user by the name of _hashcoin_ proposed the usage of Timelocks via the `nLockTime` function of the bitcoin network to solve the custody problem of exchanges.footnote:[Hashcoin on Bitcoin talk on July 4th 2011 - Instant TX for established business relationships (need replacements/nLockTime) http://web.archive.org/web/20190419103503/https://bitcointalk.org/index.php?topic=25786.0] The idea was to be able to quickly trade / sell Bitcoin without the necessity to send all the bitcoins to the exchange in the first place. Hashcoin effectively proposed what we would call an unidirectional payment channel today. With this mechanism a user Alice could fund a multisig address between her and another user Bob together with a timelocked transaction sending all bitcoins back to Alice. @@ -73,7 +73,7 @@ Despite being rather useless in today's world we will study the unidirectional p This setup has one safety issue as transactions have been malleable without the segwit upgrade. A problem that needed to be solved for any payment channel construction that we know up till today and which has been fixed in August 2017. -During the first couple of years, the Bitcoin network was growing and the focus of many enthusiasts was on adoption, rather than the blocksize and scaling. However, in 2012 Gavin Andresen proposed the Ultra Transaction server on his blog.footnote:[Gavin Andresen's blog - July 4th 2012 - Off-the-chain transactions - http://web.archive.org/web/20190730234737/http://gavintech.blogspot.com/2012/07/off-chain-transactions.html] +During the first couple of years, the Bitcoin network was growing and the focus of many enthusiasts was on adoption, rather than the blocksize and scaling. However, in 2012 Gavin Andresen proposed the Ultra Transaction server on his blog.footnote:[Gavin Andresen's blog - July 4th 2012 - Off-the-chain transactions - http://web.archive.org/web/20190730234737/http://gavintech.blogspot.com/2012/07/off-chain-transactions.html] The Ultra Transaction server was proposed to be a trusted partner of a 2-2 multisig wallet that could not steal funds but allowed signing transactions from a 2-2 multisig wallet. Andresen observed that with such a mechanism, payments would effectively take place offchain, allowing the number of transacations which could be handled by the system to be increased. @@ -132,7 +132,7 @@ A person or platform offering content on the web. They want to install a pay wall or get tipped by their fans and consumers. This could even include music or video streaming on demand paying in real time. -John is a 9 year old boy from Australia, who wanted a games console just like his friends. However he was told by his dad 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 Lightning Network, 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 micropayment 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 games console he so very much wanted. +John is a 9 year old boy from Australia, who wanted a games console just like his friends. However he was told by his dad 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 Lightning Network, 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 micropayment 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 games console he so very much wanted. gamer:: Similar to the content creator, a gamer and live streamer would like to be tipped. @@ -167,7 +167,7 @@ Ultimately this allows her to provide a better service or to offer better pricin ==== Choosing a Lightning Network Wallet * full nodes (c-lightning, eclair, lnd) + remote controls -* phone / desktop wallets (SPV clients) +* phone / desktop wallets (SPV clients) * custodial services / wallets? // Mastering bitcoin also had a section about custodial web wallets. So it might be fair to include them. diff --git a/glossary.asciidoc b/glossary.asciidoc index 5ad759f..7d8d4bb 100644 --- a/glossary.asciidoc +++ b/glossary.asciidoc @@ -32,7 +32,7 @@ bech32:: tbd. bip:: - Bitcoin Improvement Proposals. A set of proposals that members of the bitcoin community have submitted to improve bitcoin. For example, BIP-21 is a proposal to improve the bitcoin uniform resource identifier (URI) scheme. + Bitcoin Improvement Proposals. A set of proposals that members of the bitcoin community have submitted to improve bitcoin. For example, BIP-21 is a proposal to improve the bitcoin uniform resource identifier (URI) scheme. bitcoin:: The name of the currency unit (the coin), the network, and the software. @@ -100,7 +100,7 @@ Commitment Transaction:: One output also holds a Revocable Sequence Maturity Contract which is made to disincentivize a channel partner to broadcast an old commitment transaction to the Bitcoin network. This effectively invalidates old commitment transactions. Broadcasting a commitment transaction forces a unilateral channel close. - Up to 483 Hashed Time Lock Contracts can be stored as additional outputs in the commitment transactions allow the routing of payments. + Up to 483 Hashed Time Lock Contracts can be stored as additional outputs in the commitment transactions allow the routing of payments. In order to be able to ascribe blame in the case of unilateral channel closes, each channel partner has a slightly different commitment transaction. // TODO probably don't explain the difference with the RSMC here @@ -361,7 +361,7 @@ Second stage HTLC:: tbd. secret key (aka private key):: - The secret number that unlocks bitcoin sent to the corresponding address. pass:[A secret] key looks like the following: + The secret number that unlocks bitcoin sent to the corresponding address. pass:[A secret] key looks like the following: + ---- 5J76sF8L5jTtzE96r66Sf8cka9y44wdpJjMwCxR3tzLh3ibVPxh @@ -406,7 +406,7 @@ timelocks:: Transaction:: Transactions are a binary format used by the Bitcoin protocol to transfer bitcoins from one address to another. Several transactions are built into a block which has to be confirmed by the Bitcoin network through the process of mining. - Transactions can only be included in a block if they contain a valid signature (more precisely a valid input script) matching the output script defined by the previous owner. + Transactions can only be included in a block if they contain a valid signature (more precisely a valid input script) matching the output script defined by the previous owner. The first transaction in each block is called the coinbase and generates new bitcoins. Transactions can also contain contracts and should not be confused with payments. diff --git a/preface.asciidoc b/preface.asciidoc index f7363cc..28009af 100644 --- a/preface.asciidoc +++ b/preface.asciidoc @@ -68,7 +68,7 @@ If you feel your use of code examples falls outside fair use or the permission g 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 +=== Addresses and Transactions in this Book ((("blockchain","warnings and cautions")))((("keys and addresses", seealso="cryptography; private keys; public keys")))((("QR codes")))((("transactions","warnings and cautions")))((("warnings and cautions","when using test and example material appearing in 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. diff --git a/topics.asciidoc b/topics.asciidoc index 75cb084..e869b92 100644 --- a/topics.asciidoc +++ b/topics.asciidoc @@ -173,7 +173,7 @@ Everything about the Lightning Network that is not covered by the BOLTs but impo ** JIT https://lists.linuxfoundation.org/pipermail/lightning-dev/2019-March/001891.html ** Trampoline routing https://lists.linuxfoundation.org/pipermail/lightning-dev/2019-April/001950.html ** permuteroute https://github.com/ElementsProject/lightning/pull/2890 -** Real time strategy games https://lists.linuxfoundation.org/pipermail/lightning-dev/2019-August/002095.html +** Real time strategy games https://lists.linuxfoundation.org/pipermail/lightning-dev/2019-August/002095.html === Building on top of the Lightning Network Creating Lightning Network Applications From 853c2187d01d23e5e2ec204a93b693445e92ec62 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Mon, 16 Sep 2019 19:18:31 +0200 Subject: [PATCH 07/17] travis: Use "exit 1" in case of linter failure (#62) * travis: Use "exit 1" in case of linter failure * Fix double spacing --- .travis.yml | 8 ++++---- ch01.asciidoc | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index becbf0a..8f0ae69 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,8 @@ install: - pip3 install --user codespell script: - - git grep $'\r' -- "*.asciidoc" "*.md" && echo "^ Possible Windows style line ending detected. Please use Unix style line endings (\n)." && false || true - - git grep ' $' -- "*.asciidoc" "*.md" && echo "^ Trailing space detected at end of line. Please remove." && false || true - - git grep $'\t' -- "*.asciidoc" "*.md" && echo "^ Use of tabs detected. Please use space for indentation." && false || true - - git grep "[^ ] [^ ]" -- "*.asciidoc" "*.md" && echo "^ Satoshi style double spacing detected. Sorry Satoshi, please use single spacing." && false || true + - git grep $'\r' -- "*.asciidoc" "*.md" && echo "^ Possible Windows style line ending detected. Please use Unix style line endings (\n)." && exit 1 || true + - git grep ' $' -- "*.asciidoc" "*.md" && echo "^ Trailing space detected at end of line. Please remove." && exit 1 || true + - git grep $'\t' -- "*.asciidoc" "*.md" && echo "^ Use of tabs detected. Please use space for indentation." && exit 1 || true + - git grep "[^ ] [^ ]" -- "*.asciidoc" "*.md" && echo "^ Satoshi style double spacing detected. Sorry Satoshi, please use single spacing." && exit 1 || true - codespell --ignore-words-list=que $(git ls-files -- "*.asciidoc" "*.md") diff --git a/ch01.asciidoc b/ch01.asciidoc index 59fcb72..b2eb1ba 100644 --- a/ch01.asciidoc +++ b/ch01.asciidoc @@ -132,7 +132,7 @@ A person or platform offering content on the web. They want to install a pay wall or get tipped by their fans and consumers. This could even include music or video streaming on demand paying in real time. -John is a 9 year old boy from Australia, who wanted a games console just like his friends. However he was told by his dad 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 Lightning Network, 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 micropayment 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 games console he so very much wanted. +John is a 9 year old boy from Australia, who wanted a games console just like his friends. However he was told by his dad 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 Lightning Network, 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 micropayment 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 games console he so very much wanted. gamer:: Similar to the content creator, a gamer and live streamer would like to be tipped. From 4f7b946aad4a3c9e69d502323a8041faa06c6704 Mon Sep 17 00:00:00 2001 From: yahiheb <52379387+yahiheb@users.noreply.github.com> Date: Mon, 16 Sep 2019 21:59:02 +0200 Subject: [PATCH 08/17] Fix typos (#63) --- ch01.asciidoc | 4 ++-- glossary.asciidoc | 6 +++--- topics.asciidoc | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ch01.asciidoc b/ch01.asciidoc index b2eb1ba..125115c 100644 --- a/ch01.asciidoc +++ b/ch01.asciidoc @@ -60,7 +60,7 @@ We can only speculate for reasons and guess that the overhead communication woul Also as a payment channel this system was not too useful as the channel could only at total send the total amount of provided Bitcoin in the funding transaction. Once the timelock was over or all Bitcoin were sent to B the channel would have to be closed. The obvious idea of opening two channels one from A to B and one from B to A would not have helped as each of those channels would have to be closed and reestablished once it ran dry. -The core breakthrough for the Lightning Network to become a reallity was the ability to create payment channels which technically can live forever and can send money back and forth as often as the peers wish to in combination with routing payments among several channels. +The core breakthrough for the Lightning Network to become a reality was the ability to create payment channels which technically can live forever and can send money back and forth as often as the peers wish to in combination with routing payments among several channels. [TIP] ==== @@ -118,7 +118,7 @@ Bitcoin Duplex Micropayment Channels As an electronic cash system it 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 Lightning Network Bitcoin is hard to be used concurrently by millions of people. +However, without the Lightning Network, Bitcoin is hard to be used concurrently by millions of people. Therefore, in order to fully understand the uses of the Lightning Network, 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. diff --git a/glossary.asciidoc b/glossary.asciidoc index 7d8d4bb..16b0fb6 100644 --- a/glossary.asciidoc +++ b/glossary.asciidoc @@ -170,7 +170,7 @@ Funding Transaction:: It is part of the rsmc to ensure that either side of the channel can withdraw their funds without the necessity to trust the channel partner. Globalfeatures:: - Globalfeaturess of a Lightning Network node are the features of interest for all other nodes. + Globalfeatures of a Lightning Network node are the features of interest for all other nodes. Most commonly they are related to supported routing formats. They are announced in the `_init_` message of the peer protocol as well as the `_channel_announcement_` and `_node_announcement_` messages of the gossip protocol. @@ -225,7 +225,7 @@ lnd:: It is written in Go. Localfeatures:: - Localfeaturess of a Lightning Network node are the features of direct interest of the peer. + Localfeatures of a Lightning Network node are the features of direct interest of the peer. They are announced in the `_init_` message of the peer protocol as well as the `_channel_announcement_` and `_node_announcement_` messages of the gossip protocol. Locktime:: @@ -241,7 +241,7 @@ multisignature:: In the standard case of a 2 party payment channel a 2-2 multisignature address is used. Noise_XK:: - The template of the Noise protocol framework to establish and authenticated and encrypted communication channel between two peers of the lightning network. + The template of the Noise protocol framework to establish an authenticated and encrypted communication channel between two peers of the lightning network. X means that no public key needs to be known from the initiator of the connection. K means that the public key of the receiver needs to be known. More particular (from: http://www.noiseprotocol.org/noise.html) the protocol enables. diff --git a/topics.asciidoc b/topics.asciidoc index e869b92..52a47c3 100644 --- a/topics.asciidoc +++ b/topics.asciidoc @@ -86,7 +86,7 @@ This group of topics would be end user oriented and is rather non technical While also important for end users to be aware of some of the topics here it is primarily meant for professionals and developers. * backup & restore a Lightning Network node -* configure a Lightning network Nodes +* configure a Lightning network Node ** max concurrent htlc in flight ** min channel channel size ** max channel size From e6c63788d32c016c754dcd8940ed7cee7f44c411 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Tue, 17 Sep 2019 00:32:07 +0200 Subject: [PATCH 09/17] travis: Add linter for lexical illusions (duplicate words) (#64) --- .travis.yml | 1 + glossary.asciidoc | 2 +- topics.asciidoc | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f0ae69..29306fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,4 +14,5 @@ script: - git grep ' $' -- "*.asciidoc" "*.md" && echo "^ Trailing space detected at end of line. Please remove." && exit 1 || true - git grep $'\t' -- "*.asciidoc" "*.md" && echo "^ Use of tabs detected. Please use space for indentation." && exit 1 || true - git grep "[^ ] [^ ]" -- "*.asciidoc" "*.md" && echo "^ Satoshi style double spacing detected. Sorry Satoshi, please use single spacing." && exit 1 || true + - git grep -iE '(^| )(\w+) \2(\.|,|:|;| |$)' -- "*.asciidoc" "*.md" && echo "^ Detected lexical illusion in the form of a duplicated word. Please correct." && exit 1 || true - codespell --ignore-words-list=que $(git ls-files -- "*.asciidoc" "*.md") diff --git a/glossary.asciidoc b/glossary.asciidoc index 16b0fb6..bee291a 100644 --- a/glossary.asciidoc +++ b/glossary.asciidoc @@ -233,7 +233,7 @@ Locktime:: Millisatoshi:: The smallest unit of account on the lightning network. - The the value cannot be enforced on chain. + The value cannot be enforced on chain. multisignature:: Multisignature (multisig) refers to requiring more than one key to authorize a bitcoin transaction. diff --git a/topics.asciidoc b/topics.asciidoc index 52a47c3..0920443 100644 --- a/topics.asciidoc +++ b/topics.asciidoc @@ -88,7 +88,7 @@ While also important for end users to be aware of some of the topics here it is * backup & restore a Lightning Network node * configure a Lightning network Node ** max concurrent htlc in flight -** min channel channel size +** min channel size ** max channel size ** cltv_expiry delta ** routing fees From 3da66d3d9ed1196954862e844064ee51f7e9eeb1 Mon Sep 17 00:00:00 2001 From: yahiheb <52379387+yahiheb@users.noreply.github.com> Date: Tue, 17 Sep 2019 08:51:27 +0200 Subject: [PATCH 10/17] Nitpicking (#65) --- glossary.asciidoc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/glossary.asciidoc b/glossary.asciidoc index bee291a..66d2f0e 100644 --- a/glossary.asciidoc +++ b/glossary.asciidoc @@ -6,7 +6,6 @@ This quick glossary contains many of the terms used in relation to bitcoin. Thes address:: A bitcoin address looks like +1DSrfJdB2AnWaFNgSbv3MZC2m74996JafV+. It consists of a string of letters and numbers. It's really an encoded base58check version of a public key 160-bit hash. Just as you ask others to send an email to your email address, you would ask others to send you bitcoin to one of your bitcoin addresses. - Asymmetric Cryptographic System:: Asymmetric cryptography, or public-key cryptography, is a cryptographic system that uses pairs of keys: public keys which may be disseminated widely, and private keys which are known only to the owner. The generation of such keys depends on cryptographic algorithms based on mathematical problems to produce one-way functions. @@ -123,7 +122,7 @@ Diffie Hellman Key Exchange:: This shared secret may be directly used as a key, or to derive another key. The key, or the derived key, can then be used to encrypt subsequent communications using a symmetric-key cipher. An example of the derived key would be the ephemeral key used by the SPHINX Mix Format. - via https://en.wikipedia.org/w/index.php?title=Elliptic-curve_Diffie%E2%80%93Hellman&oldid=836070673 + Via https://en.wikipedia.org/w/index.php?title=Elliptic-curve_Diffie%E2%80%93Hellman&oldid=836070673 Digital Signature:: A digital signature is a mathematical scheme for verifying the authenticity of digital messages or documents. @@ -174,7 +173,6 @@ Globalfeatures:: Most commonly they are related to supported routing formats. They are announced in the `_init_` message of the peer protocol as well as the `_channel_announcement_` and `_node_announcement_` messages of the gossip protocol. - Gossip Protocol:: Lightning Network nodes send and receive information about the topology of the Lightning Network through gossip messages which are exchanged with their peers. The gossip protocol is mainly defined in BOLT 7 and defines the format of the _node_announcement_, _channel_announcement_ and _channel_update messages_. @@ -199,7 +197,6 @@ Hash Function:: It is infeasible to find two different messages with the same hash value. https://en.wikipedia.org/w/index.php?title=Cryptographic_hash_function&oldid=868055371 - hashlocks:: A hashlock is a type of encumbrance that restricts the spending of an output until a specified piece of data is publicly revealed. Hashlocks have the useful property that once any hashlock is opened publicly, any other hashlock secured using the same key can also be opened. This makes it possible to create multiple outputs that are all encumbered by the same hashlock and which all become spendable at the same time. @@ -214,7 +211,7 @@ Invoice:: Lightning Network:: The Lightning Network is a protocol on top of bitcoin (or other cryptocurrencies). - It creates a network of payment channels which enable the trustless forwarding of payments through the network with the help of HTLCs and Onion Routing. + It creates a network of payment channels which enables the trustless forwarding of payments through the network with the help of HTLCs and Onion Routing. Other components of the lightning network are the gossip protocol, the transport layer and payment requests. Lightning Network Node:: @@ -292,7 +289,7 @@ Payment Channel:: There are currently three methods known to construct a fully duplex bidirectional payment channel. Christian Decker proposed a method in his PhD thesis based on invalidation trees. In the Lightning Network whitepaper, Joseph Poon and Tadge Dryja describe the Revocable Sequence Maturity Contract based method that is currently being implemented on the Lightning Network. -Recently Christian Decker et al. came up with the Eltoo mechanism which would require a Bitcoin softfork. + Recently Christian Decker et al. came up with the Eltoo mechanism which would require a Bitcoin softfork. peer:: Two parties which form a payment channel are called peers. @@ -416,7 +413,6 @@ Transaction Malleability:: Transport Layer:: tbd. - unspent transaction output (UTXO):: UTXO is an unspent transaction output that can be spent as an input to a new transaction. @@ -426,5 +422,4 @@ upstream payment:: wallet:: Software that holds all your bitcoin addresses and secret keys. Use it to send, receive, and store your bitcoin. - Some contributed definitions have been sourced under a CC-BY license from the https://en.bitcoin.it/wiki/Main_Page[bitcoin Wiki], https://en.wikipedia.org[Wikipedia], https://github.com/bitcoinbook/bitconbook[Mastering Bitcoin] or from other open source documentation sources. From 8cd4d1656eb930efad2ce2708499988590c269a6 Mon Sep 17 00:00:00 2001 From: yahiheb <52379387+yahiheb@users.noreply.github.com> Date: Tue, 17 Sep 2019 13:38:45 +0200 Subject: [PATCH 11/17] Use LN abbreviation for Lightning Network (ch01 file) (#57) * Use LN abbreviation for Lightning Network (ch01 file) * Update ch01.asciidoc Co-Authored-By: nopara73 --- ch01.asciidoc | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ch01.asciidoc b/ch01.asciidoc index 125115c..5b4a0c8 100644 --- a/ch01.asciidoc +++ b/ch01.asciidoc @@ -4,20 +4,20 @@ === What is the Lightning Network? -The Lightning Network is a payment system for Bitcoin. +The Lightning Network (LN) is a payment system for Bitcoin. It is a second layer protocol on top of Bitcoin that defines rules and contracts which enable fast, secure, private, trustless and permissionless transfer of Bitcoin. -Users of the Lightning Network are able to transfer Bitcoin among each other at virtually no cost and in real time. +Users of the LN are able to transfer Bitcoin among each other at virtually no cost and in real time. They are not required to wait for block confirmations for payments. Once a payment arrives, it is final and cannot be reversed. -Like a standard Bitcoin transaction, a payment on the Lightning Network can only be refunded by the recipient. -While all Bitcoin transactions are stored in the blockchain where they can be tracked, the payments on the Lightning Network are off-chain and offer more privacy than on-chain Bitcoin transactions. +Like a standard Bitcoin transaction, a payment on the LN can only be refunded by the recipient. +While all Bitcoin transactions are stored in the blockchain where they can be tracked, the payments on the LN are off-chain and offer more privacy than on-chain Bitcoin transactions. Due to the use of onion routing, which is also implemented in Tor, even the nodes involved in forwarding the payment from sender to recipient do not know for whom they deliver the payment. === History of the Lightning Network -// The following is a working draft and suggested mile stones in the history of the Lightning Network. +// The following is a working draft and suggested mile stones in the history of the LN. -The history of the Lightning Network is nearly as old as the history of Bitcoin. +The history of the LN is nearly as old as the history of Bitcoin. The first response to Satoshi Nakamoto's initial publication of the Bitcoin whitepaper on the metzdowd cryptography mailing list discussed the issue of scaling. [quote, James A. Donald, First Response to the Bitcoin whitepaper https://www.metzdowd.com/pipermail/cryptography/2008-November/014814.html ] ____ @@ -32,7 +32,7 @@ According to a Mailinglist post in 2013 by early Bitcoin developer Mike Hearn, S There were however some weaknesses in this initial formulation, which limited its potential. Firstly, the payment channel would only be open until the transaction was mined by the miners, either limiting the duration the payment channel or handing control of the payment channel to the miners. Secondly, there was no economic incentive for miners to respect the `nSequence` number, making this mechanism effectivley useless. -The Revocable Sequence Maturity Contracts (RSMC) which form the payment channels in the first version of the Lightning Network have taken part of their name from their property of fixing the `nSequence` field. +The Revocable Sequence Maturity Contracts (RSMC) which form the payment channels in the first version of the LN have taken part of their name from their property of fixing the `nSequence` field. This is achieved by creating an economic incentive via a penalty mechanism if not the most recent transaction in the payment channel is published to the Bitcoin network. Effectively the most recent update of the payment channel (encoded as a bitcoin transaction) becomes enforceable in this way. // find / add sources for some of the claims @@ -56,11 +56,11 @@ This gives Bob the security to receive more updates as long as the channel would This mechanism would allow two users to engage into several smaller transactions which all happened outside of the Bitcoin network. While this construction of the unidirectional payment channel would have solved the custody problem of exchanges it has never been widely implemented. -We can only speculate for reasons and guess that the overhead communication would have had to be standardized - as it is nowadays in the Lightning Network specification - which might have been too much overhead in the early days of Bitcoin. +We can only speculate for reasons and guess that the overhead communication would have had to be standardized - as it is nowadays in the LN specification - which might have been too much overhead in the early days of Bitcoin. Also as a payment channel this system was not too useful as the channel could only at total send the total amount of provided Bitcoin in the funding transaction. Once the timelock was over or all Bitcoin were sent to B the channel would have to be closed. The obvious idea of opening two channels one from A to B and one from B to A would not have helped as each of those channels would have to be closed and reestablished once it ran dry. -The core breakthrough for the Lightning Network to become a reality was the ability to create payment channels which technically can live forever and can send money back and forth as often as the peers wish to in combination with routing payments among several channels. +The core breakthrough for the LN to become a reality was the ability to create payment channels which technically can live forever and can send money back and forth as often as the peers wish to in combination with routing payments among several channels. [TIP] ==== @@ -68,7 +68,7 @@ You can watch a video explaining the construction and operation of unidirectiona ==== Surprisingly both properties took quite some while until the community figured them out. -Technically speaking the unidirectional payment channel has all the important ingreedients (funding transaction to a 2-2 multisignature wallet, a transaction spending from the wallet encoding the balance, a timelock to allow refunding if the other side becomes unresponsive, off chain communication and the fact that no additional trust other than the one in the bitcoin network) of modern payment channels which are used in the Lightning Network. +Technically speaking the unidirectional payment channel has all the important ingreedients (funding transaction to a 2-2 multisignature wallet, a transaction spending from the wallet encoding the balance, a timelock to allow refunding if the other side becomes unresponsive, off chain communication and the fact that no additional trust other than the one in the bitcoin network) of modern payment channels which are used in the LN. Despite being rather useless in today's world we will study the unidirectional payment channel in more depth in this book as it is an easy to understand educational example to approach the construction of today's payment channels. This setup has one safety issue as transactions have been malleable without the segwit upgrade. A problem that needed to be solved for any payment channel construction that we know up till today and which has been fixed in August 2017. @@ -89,7 +89,7 @@ The next day, probably in response to Gavin's blogpost, Meni Rosenfeld started a As Hashed Timelocked Contracts have neither been invented nor seen to solve the issue of trustless routing Rosenfeld imagined trusted routing nodes. Without mentioning the term network or routing of payments the idea of connecting payment channels and being able to send funds from anyone to anyone else even if there was no direct channel was born. In Rosenfelds solution payment providers would be the ultraservers and they would among themselves settle the transactions based on trust. -It took us another 3 years until the lightning network whitepaper emerged which had solved all the bits and bolts necessary to get rid of the trust in Rosenfelds solution. +It took us another 3 years until the LN whitepaper emerged which had solved all the bits and bolts necessary to get rid of the trust in Rosenfelds solution. It was 2013 that Bitcoin developer Mike Hearn referred to Meni Rosenfelds proposal and suggesting to reactivate the `nSequence` field which Satoshi preiviously had deactivated.footnote:HearnBitcoinDev[] Also Hearn referred to a section on the contracts article talking about the case of micropayment channels with the help of `nSequence` @@ -118,8 +118,8 @@ Bitcoin Duplex Micropayment Channels As an electronic cash system it 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 Lightning Network, Bitcoin is hard to be used concurrently by millions of people. -Therefore, in order to fully understand the uses of the Lightning Network, we'll examine it from the perspective of people using it. +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: @@ -132,7 +132,7 @@ A person or platform offering content on the web. They want to install a pay wall or get tipped by their fans and consumers. This could even include music or video streaming on demand paying in real time. -John is a 9 year old boy from Australia, who wanted a games console just like his friends. However he was told by his dad 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 Lightning Network, 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 micropayment 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 games console he so very much wanted. +John is a 9 year old boy from Australia, who wanted a games console just like his friends. However he was told by his dad 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 micropayment 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 games console he so very much wanted. gamer:: Similar to the content creator, a gamer and live streamer would like to be tipped. @@ -144,8 +144,8 @@ Characteristic for remittance is that the payments usually are cross border and However, they might happen on a monthly base as they are just a fraction of the monthly wage. professional bitcoiner:: -A person who wants to earn interest on their bitcoin without the risk of lending them to other people could decide to set up routing nodes on the lightning network. -By providing liquidity to the Lightning Network the routing capacities will be increased offering the chance to earn routing fees on the owned bitcoin. +A person who wants to earn interest on their bitcoin without the risk of lending them to other people could decide to set up routing nodes on the LN. +By providing liquidity to the LN the routing capacities will be increased offering the chance to earn routing fees on the owned bitcoin. merchants:: Merchants live on the margin of the sold goods. @@ -156,8 +156,8 @@ A merchant will be happy to get an additional payment method which is virtually An example of a merchant is Silke. Silke runs a small coffee shop in an upmarket street in Berlin. She knows about Bitcoin and wants to accept it in her shop, but has been reluctant to do so because she knows that Bitcoin payments take approx. 10 minutes to be confirmed into her account. -However with the Lightning Network, she knows that her regular clients, such as Joerg can pay for their coffee at her shop, quickly and with negligible fees. -Additionally, by using the Lightning Network, Silke has all funds deposited instantly to her wallet and with usually smaller fees on her side as well. +However with the LN, she knows that her regular clients, such as Joerg can pay for their coffee at her shop, quickly and with negligible fees. +Additionally, by using the LN, Silke has all funds deposited instantly to her wallet and with usually smaller fees on her side as well. Ultimately this allows her to provide a better service or to offer better pricing for her products. From b8d1f50eb27821ce336394bca8e78f045083635a Mon Sep 17 00:00:00 2001 From: Rene Pickhardt Date: Tue, 17 Sep 2019 21:07:57 +0200 Subject: [PATCH 12/17] added more bulletpoints and suggestions for the structure --- ch01.asciidoc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ch01.asciidoc b/ch01.asciidoc index 5b4a0c8..3c39bae 100644 --- a/ch01.asciidoc +++ b/ch01.asciidoc @@ -173,9 +173,30 @@ Ultimately this allows her to provide a better service or to offer better pricin ==== Quick Start +* We start with a mobile wallet like eclair +* Verify the authenticity of the software (e.g. App store / Acinq website / github) +** discuss that a general phising scheme might consist of tricking you to download a similar looking software + [[getting_first_bitcoin]] ==== Getting Your First Bitcoin on the Lightning Network +* Trade fiat for Bitcoin (as in Mastering Bitcoin) + +[[using_own_bitcoin]] +==== Process for people who already own Bitcoin ==== + +* send bitcoin to lightning wallet (1 onchain transaction - soon nodes / wallets may support funding a channel directly without sending bitcoins to the lightning network wallet first) +* find a node to open a channel with (Node explorer / Autopilots / ...) +* open a connection +* open a channel +* wait confirmations for the channel to become operational + [[sending_receiving]] ==== Sending and Receiving Bitcoin on the Lightning Network +* have the person who helps onbording open a payment channel (As complex as a bitcoin transaction) +* showcase how the funds now can be send back and forth +** create invoice +** decode invoice (do always before paying!) +** pay an invoice +* showcase how an arbitrary invoice can be paid e.g. https://voting.ln.rene-pickhardt.de From d83eba9dcdafbe3e5c495ecd91bfd5b96892fb1b Mon Sep 17 00:00:00 2001 From: Rene Pickhardt Date: Tue, 17 Sep 2019 21:08:50 +0200 Subject: [PATCH 13/17] proposed an outline and selectin of topics for chapter two by following the structure of mastering bitcoin but adapting it to mastering the lightning network --- ch02.asciidoc | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 ch02.asciidoc diff --git a/ch02.asciidoc b/ch02.asciidoc new file mode 100644 index 0000000..36528a3 --- /dev/null +++ b/ch02.asciidoc @@ -0,0 +1,96 @@ +[role="pagenumrestart"] +[[ch02_How_Lightning_Works]] +== How the Lightning Network Works + +=== Payment channels + +* trustless between peers +* operation takes place off chain +* throughput bound by TCP/IP traffic +* have capacity which is split into a balance sheet +* instant payments between peers + +==== Multisig address +* short review of bitcoin transactions +* review of segwit multisig addresses + +==== Funding Transaction +* opens the payment channel +* encodes the capacity of the channel +* not clear who owns what fraction of the capacity +* visible onchain transaction (even for private channels) + +==== Commitment Transaction +* encodes the balance of the payment channel +* kept secretly between channel partners +* everyone has their own set of transactions +* encumbered with a time lock to give time to penalize protocol breach +* smart contract inside which gives possability to penalize protocol breach + +==== Announcing the channel +* gossip protocol +* option to have private channels + +==== closing the channel +* the good way - mutal close +* the bad way - force close +* the ugly way - protocol breach + +=== Invoices + +an alternative structure for the subsections of the invoice section (while covering the same topics) could be: (creating, decoding, paying as 3 sub chapters) + +* creating invoices +* decoding invoices +* bech32 encoding and human readable part of invoices + +==== Payment Hash +* `pre_image` as proof of payment +* random numbers and selecting the pre_image + +==== Meta Data +* Description +* routing hints +* fallback address +* expire time +* signature + +=== Delivering the payment + +* gossip protocol +* network of payment channels +* different scope of the network +** global path finding (entire knowledge of the network necessary) +** multihop routing (onion necessary only a subset of nodes involved) +** locally setting up and setteling htlcs (only peers involved) + +==== Finding a path + +* trivial case / channel partner as destination with enough funds in the channel +* topology information from the gossip protocol +* fees and pathfinding from destination to source + +==== Onion routing + +* construct an onion using +** SPHINX +** payment hash +** path + +==== Payment Forwarding Algorithm + +* receive an incoming HTLC +* forward an HTLC +* BOLT 02 channel update protocol +* sending back errors + +=== Comparison with Bitcoin + +* select outputs vs select payment channels / finding a path +* change outputs vs no change on lightning +* mining fees vs routing fees +* public transactions on the blockchain vs. secret payments +* waiting for confirmations vs instant settlement (if everything works smoothly) +* arbitrary amounts vs capacity restrictions +* variying fees depending on the traffic vs announced fees (might become dynamic too?) +* blockchain to save all transactions vs blockchain as a court system \ No newline at end of file From b9030771844688b944555463b9ed2b11f6067058 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Fri, 20 Sep 2019 21:46:48 +0200 Subject: [PATCH 14/17] travis: Add linter to detect multiple blank lines between paragraphs (#66) * travis: Add linter to detect multiple blank lines between paragraphs * Use one blank line between paragraphs * Remove trailing spaces --- .travis.yml | 1 + CONTRIBUTING.md | 1 - ch01.asciidoc | 8 ++------ ch02.asciidoc | 4 ++-- contrib/example.asciidoc | 1 - preface.asciidoc | 5 ----- topics.asciidoc | 2 -- 7 files changed, 5 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 29306fd..9163f38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,4 +15,5 @@ script: - git grep $'\t' -- "*.asciidoc" "*.md" && echo "^ Use of tabs detected. Please use space for indentation." && exit 1 || true - git grep "[^ ] [^ ]" -- "*.asciidoc" "*.md" && echo "^ Satoshi style double spacing detected. Sorry Satoshi, please use single spacing." && exit 1 || true - git grep -iE '(^| )(\w+) \2(\.|,|:|;| |$)' -- "*.asciidoc" "*.md" && echo "^ Detected lexical illusion in the form of a duplicated word. Please correct." && exit 1 || true + - git grep "" -- "*.asciidoc" "*.md" | uniq -c | grep -1 "^ [2-9] " | cut -b9- | sed 's/:$/:[more-than-one-blank-line-here-please-remove]/' | grep ":" && echo "^ Multiple blank lines detected. Please use only one blank line between paragraphs." && exit 1 || true - codespell --ignore-words-list=que $(git ls-files -- "*.asciidoc" "*.md") diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 20ab7a7..1e2eac8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -72,7 +72,6 @@ As we saw in <>, the intro paragraph is superb! ``` - ## Line endings All submission should use Unix-like line endings: LF (not CR, not CR/LF). All the postprocessing is done on Unix-like systems. Incorrect line endings, or changes to line endings cause confusion for the diff tools and make the whole file look like it has changed. diff --git a/ch01.asciidoc b/ch01.asciidoc index 3c39bae..bdb3141 100644 --- a/ch01.asciidoc +++ b/ch01.asciidoc @@ -97,7 +97,6 @@ Also Hearn referred to a section on the contracts article talking about the case Links: * https://en.bitcoin.it/w/index.php?title=Contract&oldid=36712#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party - * Multiple white papers ** Joseph Poon, Thaddeus Dryja - The Bitcoin Lightning Network: Scalable Off-Chain Instant Payments https://lightning.network/lightning-network-paper.pdf @@ -160,10 +159,8 @@ However with the LN, she knows that her regular clients, such as Joerg can pay f Additionally, by using the LN, Silke has all funds deposited instantly to her wallet and with usually smaller fees on her side as well. Ultimately this allows her to provide a better service or to offer better pricing for her products. - === Getting Started - ==== Choosing a Lightning Network Wallet * full nodes (c-lightning, eclair, lnd) + remote controls @@ -183,7 +180,7 @@ Ultimately this allows her to provide a better service or to offer better pricin * Trade fiat for Bitcoin (as in Mastering Bitcoin) [[using_own_bitcoin]] -==== Process for people who already own Bitcoin ==== +==== Process for people who already own Bitcoin ==== * send bitcoin to lightning wallet (1 onchain transaction - soon nodes / wallets may support funding a channel directly without sending bitcoins to the lightning network wallet first) * find a node to open a channel with (Node explorer / Autopilots / ...) @@ -191,12 +188,11 @@ Ultimately this allows her to provide a better service or to offer better pricin * open a channel * wait confirmations for the channel to become operational - [[sending_receiving]] ==== Sending and Receiving Bitcoin on the Lightning Network * have the person who helps onbording open a payment channel (As complex as a bitcoin transaction) * showcase how the funds now can be send back and forth ** create invoice ** decode invoice (do always before paying!) -** pay an invoice +** pay an invoice * showcase how an arbitrary invoice can be paid e.g. https://voting.ln.rene-pickhardt.de diff --git a/ch02.asciidoc b/ch02.asciidoc index 36528a3..f9117c0 100644 --- a/ch02.asciidoc +++ b/ch02.asciidoc @@ -75,7 +75,7 @@ an alternative structure for the subsections of the invoice section (while cover * construct an onion using ** SPHINX ** payment hash -** path +** path ==== Payment Forwarding Algorithm @@ -93,4 +93,4 @@ an alternative structure for the subsections of the invoice section (while cover * waiting for confirmations vs instant settlement (if everything works smoothly) * arbitrary amounts vs capacity restrictions * variying fees depending on the traffic vs announced fees (might become dynamic too?) -* blockchain to save all transactions vs blockchain as a court system \ No newline at end of file +* blockchain to save all transactions vs blockchain as a court system diff --git a/contrib/example.asciidoc b/contrib/example.asciidoc index 8a808b0..cf8637c 100644 --- a/contrib/example.asciidoc +++ b/contrib/example.asciidoc @@ -4,7 +4,6 @@ License: CC-BY Added By: @aantonop //// - == Basis of Lightning Technology (BOLT) The Basis of Lightning Technology (BOLT) documents describe a layer-2 protocol for off-chain bitcoin transfer by mutual cooperation, relying on on-chain transactions for enforcement if necessary. diff --git a/preface.asciidoc b/preface.asciidoc index 28009af..bd6de2b 100644 --- a/preface.asciidoc +++ b/preface.asciidoc @@ -24,7 +24,6 @@ _Italic_:: Indicates new terms, URLs, email addresses, filenames, and file exten _++Constant width italic++_:: Shows text that should be replaced with user-supplied values or values determined by context. - [TIP] ==== This icon signifies a tip or suggestion. @@ -121,7 +120,6 @@ Follow us on Twitter: link:$$https://twitter.com/oreillymedia$$[] Watch us on YouTube: link:$$https://www.youtube.com/oreillymedia$$[] - ==== Contacting Andreas You can contact Andreas M. Antonopoulos on his personal site: @@ -142,7 +140,6 @@ link:$$https://linkedin.com/company/aantonop$$[] Andreas would also like to thank all of the patrons who support his work through monthly donations. You can support Andreas on Patreon at link:$$https://patreon.com/aantonop$$[]. - ==== Contacting Rene You can contact Rene Pickhardt on his personal site: @@ -162,7 +159,6 @@ link:$$https://patreon.com/renepickhardt$$[]. Or you can support his work directly with bitcoin (also via the Lightning Network) at link:$$https://tallyco.in/s/lnbook$$[] for which Rene is equally thankful as for his patreons. - [[acknowledgments_sec]] === Acknowledgments by Andreas @@ -178,7 +174,6 @@ I am also grateful to the Bitcoin and Lightning Network community who welcomed m In particular I am grateful to all the open source Bitcoin and Lightning Network protocol developers and people who fund them to make that technology possible. Last but not least I am thankful to my loved ones. - [[github_contrib]] === Contributions diff --git a/topics.asciidoc b/topics.asciidoc index 0920443..7bc959b 100644 --- a/topics.asciidoc +++ b/topics.asciidoc @@ -103,7 +103,6 @@ While also important for end users to be aware of some of the topics here it is * uptime * watchtowers - === BOLT 1.0 A summary of how the Lightning Network protocol works. @@ -137,7 +136,6 @@ A summary of how the Lightning Network protocol works. * Transaction Malleability * Transport Layer - === BOLT 1.1 / 2.0 Future trends and developments on the Lightning Network. From 4b418666e6107e9768a883dddd7a508a8b471fb8 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Fri, 20 Sep 2019 21:48:52 +0200 Subject: [PATCH 15/17] travis: Add linter to make sure all lines end with a newline character (#68) * travis: Add linter to make sure all lines end with a newline character Ending newlines make line based Unix tools such as `tail`, etc work as expected. Without ending newline: ``` prompt$ tail -1 ch02.asciidoc * blockchain to save all transactions vs blockchain as a court system prompt$ ``` With ending newline: ``` prompt$ tail -1 ch02.asciidoc * blockchain to save all transactions vs blockchain as a court system prompt$ ``` Also, makes `git` not complain about "No newline at end of file" in diffs. * Add newline at end of file * Remove trailing whitespace --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 9163f38..56845ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,5 +15,6 @@ script: - git grep $'\t' -- "*.asciidoc" "*.md" && echo "^ Use of tabs detected. Please use space for indentation." && exit 1 || true - git grep "[^ ] [^ ]" -- "*.asciidoc" "*.md" && echo "^ Satoshi style double spacing detected. Sorry Satoshi, please use single spacing." && exit 1 || true - git grep -iE '(^| )(\w+) \2(\.|,|:|;| |$)' -- "*.asciidoc" "*.md" && echo "^ Detected lexical illusion in the form of a duplicated word. Please correct." && exit 1 || true + - for FILE in $(git ls-files -- "*.asciidoc" "*.md"); do if [[ $(tail -c1 $FILE) != "" ]]; then echo "File ${FILE} does not end with a newline character (\n)."; exit 1; fi; done - git grep "" -- "*.asciidoc" "*.md" | uniq -c | grep -1 "^ [2-9] " | cut -b9- | sed 's/:$/:[more-than-one-blank-line-here-please-remove]/' | grep ":" && echo "^ Multiple blank lines detected. Please use only one blank line between paragraphs." && exit 1 || true - codespell --ignore-words-list=que $(git ls-files -- "*.asciidoc" "*.md") From 80a4fc0a08b58daca72cb2e0775e8354b80cd998 Mon Sep 17 00:00:00 2001 From: Rene Pickhardt Date: Fri, 20 Sep 2019 21:57:20 +0200 Subject: [PATCH 16/17] added turbo channels not sure about the section --- topics.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/topics.asciidoc b/topics.asciidoc index 7bc959b..cbeba16 100644 --- a/topics.asciidoc +++ b/topics.asciidoc @@ -184,6 +184,7 @@ Creating Lightning Network Applications ** streaming example ** more ideas: https://bitcoingames2019.devpost.com/submissions * btc pay server +* Turbo Channels https://medium.com/@akumaigorodski/instant-channels-enable-safe-lightning-payments-with-unconfirmed-funding-8d640defa183 === comparisons and examples The following is a loose list of potential infoboxes, tables and dropins which will most likely make it to some part of the book. From 8fe9e859b48f3c9e1ba8f4d67154aff60a269af3 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Sat, 21 Sep 2019 22:27:09 +0000 Subject: [PATCH 17/17] Remove unused file --- 01-what-is.asciidoc | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 01-what-is.asciidoc diff --git a/01-what-is.asciidoc b/01-what-is.asciidoc deleted file mode 100644 index 8342cf9..0000000 --- a/01-what-is.asciidoc +++ /dev/null @@ -1,5 +0,0 @@ -[role="pagenumrestart"] -[[whatis_chapter]] -== What is the Lightning Network? - -Initial paragraph