{"id":14854,"date":"2021-08-28T01:00:00","date_gmt":"2021-08-28T01:00:00","guid":{"rendered":"http:\/\/ci028bbbc7d00025a2"},"modified":"2021-08-28T01:00:00","modified_gmt":"2021-08-28T01:00:00","slug":"gentle-introduction-to-lightning-network","status":"publish","type":"post","link":"https:\/\/bitcoinmagazine.com\/technical\/gentle-introduction-to-lightning-network","title":{"rendered":"A Gentle Introduction To The Lightning Network"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div><p><em>*This article assumes the reader already has a basic understanding of the Bitcoin protocol, as well as how nodes, users and miners interact within it.<\/em><\/p>\n<p>Bitcoin is extremely secure, but this initially came at a trade-off: It\u2019s slow. On its base layer, there\u2019s no getting around the immense computing power and 10-minute average block time \u2014 and that\u2019s the point. Bitcoin\u2019s maximum transactions per second (TPS) is about <a href=\"https:\/\/en.wikipedia.org\/wiki\/Bitcoin_scalability_problem\" target=\"_blank\" rel=\"noopener\">five<\/a>, which immediately raises concerns about scalability that enable millions of users to take advantage of its <a href=\"https:\/\/bitcoin.org\/bitcoin.pdf\" target=\"_blank\" rel=\"noopener\">use case<\/a>: a permissionless, peer-to-peer currency.<\/p>\n<p>Enter the Lightning Network. Lightning was proposed in a <a href=\"https:\/\/lightning.network\/lightning-network-paper.pdf\" target=\"_blank\" rel=\"noopener\">white paper<\/a> by Joseph Poon and Thaddeus Dryja in 2016. At 59 pages, it\u2019s a serious read, but it\u2019s nothing short of genius. It overcomes this scalability problem without sacrificing security or trustlessness, and increases anonymity in the process.<\/p>\n<p>There is often discussion regarding protocols built on Bitcoin, and whether or not its users are interacting with \u201creal\u201d bitcoin. This is a fair question in this context, as it\u2019s not immediately obvious how Lightning users are interacting with \u201creal\u201d bitcoin while having near-instant transaction times and almost zero fees.<\/p>\n<p>The Lightning Network itself consists of two things: nodes and the channels between them. These nodes must also serve as nodes for Bitcon\u2019s base layer, as that\u2019s how they open and close channels between nodes.<\/p>\n<p>Bitcoin can only be added to the Lightning Network by creating a channel between two nodes. The bitcoin is placed in an unbroadcasted transaction which both nodes verify and sign. This channel can be funded by one or both of the nodes. This means that<\/p>\n<p>1. This bitcoin cannot be used for anything else until that transaction is broadcast to the network.<\/p>\n<p>2. Both nodes have the ability to \u201credeem\u201d this transaction at any time in order to get back their initial channel funding amounts.<\/p>\n<p>There is a lot of effort and nuance in operating a Lightning node. Node operators are incentivized, if nothing else, to establish many channels by the accrual of routing fees. Fees must be competitively priced, though, in order to have transactions routed through their node. It\u2019s also suggested that operators have multiple channels to increase network connectivity and make channel rebalancing easier.<\/p>\n<p>A natural side effect of Lightning Network operation is the pooling of funds in one channel or another. This restricts liquidity in certain neighborhoods and so necessitates the \u201crebalancing\u201d of channels in order to have a more even liquidity gradient across the network. Maximum transaction size \u2014 at least used to be \u2014 limited by the smallest channel balance. This is, interestingly, being worked on by <a href=\"https:\/\/arxiv.org\/abs\/2107.05322\" target=\"_blank\" rel=\"noopener\">Rene Pickhardt and Stefan Richter<\/a>. Operators are also encouraged to open large channels \u2014 usually at least one million satoshis \u2014 in order to allow for larger transactions through their channel(s). Operators are also incentivized to keep their channels open for as long as possible, as closing them requires a drop back down to the base layer, incurring potentially high transaction fees.<\/p>\n<p>Channel operators are incentivized to cooperate with each other. The largest concern is a channel constituent closing the channel by themselves, broadcasting an incorrect transaction (i.e., channel state, which shows the channel balance per side at any given time) back to the base layer. But they aren\u2019t able to access that bitcoin for a period of time. If, during that time, the other channel constituent can show a more recent channel state, the malicious channel constituent loses all of their bitcoin. This can also be enforced by <a href=\"https:\/\/wiki.ion.radar.tech\/tech\/research\/watchtowers\" target=\"_blank\" rel=\"noopener\">Watchtower<\/a> nodes.<\/p>\n<p>Smoothly operating Lightning nodes and channels can be very time consuming. Thankfully, there are large <a href=\"https:\/\/twitter.com\/kycjelly?lang=en\" target=\"_blank\" rel=\"noopener\">communities<\/a> devoted to education and getting everyone, including your grandma, into Lightning.<\/p>\n<p>Lightning improvements are currently made by several organizations, including <a href=\"https:\/\/lightning.engineering\/\" target=\"_blank\" rel=\"noopener\">Lightning Labs<\/a>, <a href=\"https:\/\/blockstream.com\/\" target=\"_blank\" rel=\"noopener\">Blockstream<\/a> and <a href=\"https:\/\/acinq.co\/\" target=\"_blank\" rel=\"noopener\">ACINQ<\/a>. Despite being individual groups, they keep their products interoperable by utilizing agreed-upon <a href=\"https:\/\/wiki.ion.radar.tech\/tech\/lightning\/basics-of-lightning-technology-bolt\" target=\"_blank\" rel=\"noopener\">development rules<\/a>.<\/p>\n<p>As Lightning is still very much a work in progress, security issues and vulnerabilities will inevitably arise. That being said, it has come a very long way in just a few years. At the time of writing, it has over <a href=\"https:\/\/1ml.com\/\" target=\"_blank\" rel=\"noopener\">20,000 public nodes, 60,000 channels and 2,000 bitcoin in capacity<\/a>.<\/p>\n<p>As Lightning makes it unnecessary to confirm every transaction on the base layer blockchain, the possible upper bound of TPS steadily trends toward infinity. This also pushes transaction fees to near-zero.<\/p>\n<p>Interacting with Lightning is not very different from interacting on the base layer. You can still use your own node, or someone else\u2019s via a custodial or noncustodial wallet. Now, instead of trading addresses, we exchange invoices, which encode, among other things, where the bitcoin is going, and how much is going there. These transactions are sent via <a href=\"https:\/\/en.wikipedia.org\/wiki\/Onion_routing\" target=\"_blank\" rel=\"noopener\">onion routing<\/a>, which means no node between the sender and recipient knows who is sending and who is receiving. Lightning dramatically increases fungibility this way. With the enactment of <a href=\"https:\/\/bitcoinmagazine.com\/technical\/taproot-coming-what-it-and-how-it-will-benefit-bitcoin\">Taproot<\/a>, it will become difficult to even ascertain whether or not bitcoin is being transacted on the Lightning Network.<\/p>\n<p>In order to remove bitcoin from Lightning back to the base layer, a channel must be closed, a <a href=\"https:\/\/lightning.engineering\/loop\/\" target=\"_blank\" rel=\"noopener\">loop out<\/a> can be performed, or a <a href=\"https:\/\/blog.muun.com\/a-closer-look-at-submarine-swaps-in-the-lightning-network\/\" target=\"_blank\" rel=\"noopener\">submarine swap<\/a> can be performed. You can do these yourself, if you are utilizing your own Lightning node, or you can let someone else do it via an aforementioned wallet.<\/p>\n<p>Luckily, there is a flurry of activity surrounding Lightning onboarding and development. Worldwide adoption is in the sights and in range, and it\u2019s going to need all hands on deck.<\/p>\n<p><em>This is a guest post by Nameless. Opinions expressed are entirely their own and do not necessarily reflect those of BTC Inc. or <\/em>Bitcoin Magazine<em>.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Often seen as the path forward for Bitcoin\u2019s scalability, this is a simple description of the Lightning Network.<\/p>\n","protected":false},"author":3241,"featured_media":4078,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[130,460,1459],"class_list":{"0":"post-14854","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-technical","8":"tag-lightning","9":"tag-lightning-network","10":"tag-node"},"author_data":{"id":3241,"name":"Nameless","nicename":"nameless","avatar_url":"https:\/\/bitcoinmagazine.com\/wp-content\/uploads\/2024\/12\/screen-shot-2021-04-10-at-70511-pm-96x96.png"},"featured_image_url":"https:\/\/bitcoinmagazine.com\/wp-content\/uploads\/2024\/11\/img_6220.png","_links":{"self":[{"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/posts\/14854","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/users\/3241"}],"replies":[{"embeddable":true,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/comments?post=14854"}],"version-history":[{"count":0,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/posts\/14854\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/media\/4078"}],"wp:attachment":[{"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/media?parent=14854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/categories?post=14854"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/tags?post=14854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}