{"id":20019,"date":"2019-06-03T14:43:45","date_gmt":"2019-06-03T14:43:45","guid":{"rendered":"http:\/\/ci027cfe70100f26c3"},"modified":"2019-06-03T14:43:45","modified_gmt":"2019-06-03T14:43:45","slug":"watchtowers-are-coming-lightning","status":"publish","type":"post","link":"https:\/\/bitcoinmagazine.com\/technical\/watchtowers-are-coming-lightning","title":{"rendered":"Watchtowers Are Coming to Lightning"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div><figure><img decoding=\"async\" src=\"https:\/\/bitcoinmagazine.com\/wp-content\/uploads\/2024\/11\/watchtowers-are-coming-to-lightning.jpg\" title=\"\"><\/figure>\n<p><em>\u201cThe Eye of Sauron casts its gaze upon the Lightning Network.\u201d<\/em><\/p>\n<p>This is how Lightning Labs CTO Olaoluwa Osuntokun (aka, roasbeef) has heralded <a href=\"https:\/\/github.com\/lightningnetwork\/lnd\/pull\/3133\" target=\"_blank\" rel=\"noopener\">the coming of Watchtowers to the Lightning Network<\/a>. Though comparing the technical feature to the demonic gaze of Tolkien\u2019s primary antagonist sounds disconcerting, the analogy holds up on the surface: Watchtowers, as the name implies, will keep an eye on Lightning Network channels and potential bad actors.<\/p>\n<p>Why the need for them? Well, if you\u2019re using a custodial Lightning wallet, there isn\u2019t one. But if you\u2019re running your own channels with your own node, then there\u2019s the slim but conceivable chance that the party on the other side of your channel could cheat you when the channel is closing.<\/p>\n<p>For instance, say Molly has a channel with Angela and they each deposit 10,000 sats into it, for a total of 20,000 sats. During the channel\u2019s lifetime, Angela pays Molly 5,000 sats, bringing the total to 15,000 sats for Molly and 5,000 for Angela.<\/p>\n<p>But suddenly, for whatever reason, Molly is unable to access her Lightning wallet (maybe her node is offline, her computer has a malfunction or she\u2019s on vacation), so Angela decides to be a bit mischievous \u2014 when it comes time to broadcast the final state of the channel to the blockchain, she decides to broadcast the first state of the channel (the original 10,000 sat balances that they both deposited) to cheat Molly out of what she was paid.<\/p>\n<p>Since Molly is on a remote island in the Gulf of Mexico and not at her computer, she can\u2019t check Angela\u2019s bad behavior and verify the actual state of the channel, so she loses 5,000 sats.<\/p>\n<p>Not the end of the world but still a bummer.<\/p>\n<h3><strong>A Check on Bad Behavior<\/strong><\/h3>\n<p>Watchtowers effectively neutralize this threat by monitoring payment channels and the blockchain to make sure acts of fraud don\u2019t slip through unnoticed. They work like this:<\/p>\n<p>Every time a channel\u2019s state is updated, the payment produces an encrypted \u201cblob\u201d for each channel user, which is basically a secret signature that corresponds to the user\u2019s public key, and sends it to the watchtower. At the same time, the watchtower receives half of the transaction ID of the channel\u2019s <strong>previous<\/strong> state, and this acts as a decryption key for the blob. The watchtower stores all of these blobs and decryption keys within its database, so if an impish actor tries to broadcast an older state to the mempool, the watchtower will see that the transaction ID matches up with the other transaction ID half it holds. Now that it has both halves of this transaction ID, the watchtower can decrypt the corresponding blob and punish the bad actor by sending the funds to the honest channel user\u2019s wallet.<\/p>\n<p>All of this can be done without the watchtower knowing who the channel users are and how much is being transacted in the channel beforehand (obviously, once the transaction is broadcasted on-chain, the public key and the fund amount is revealed).<\/p>\n<p>\u201cThey don&#8217;t know anything about a client\u2019s payment history; instead, the client sends them an encrypted blob that can only be decrypted if a breach actually happens,\u201d Osuntokun told <em>Bitcoin Magazine<\/em>.<\/p>\n<p>Technical innovators have floated the concept for a while, but Lightning Labs\u2019 Lightning Network Daemon (LND) implementation of the technology is the first production-ready iteration available, though Osuntokun said that it is still very much in its infancy.<\/p>\n<p>\u201cIt can be used on mainnet as is today, but it&#8217;s still at an early phase. We&#8217;ve been running the set of changes on our nodes for a few months now, but only until this week did we put out the public pull request,\u201d he told <em>Bitcoin Magazine<\/em>.<\/p>\n<p>In the initial rollout, the default version features so-called \u201caltruistic\u201d watchtowers, meaning that they operate without promise of payment for their services. Osuntokun said that it also features an operational \u201cbasic reward watchtower,\u201d which would allow the watchtower to charge a fee if it acts on a breach, but this has to be activated manually.<\/p>\n<p>The service, Osuntokun continued, is opt-in for both clients and the watchtower operators themselves, and clients have to manually search for towers if they want to make use of them. In the future, the team plans to implement an \u201cautomatic discovery system\u201d to streamline this process.<\/p>\n<p>While the initial version will rely on the good graces of watchers to keep users honest, free of charge, Lightning Labs has a three-stage plan for letting watchers monetize their service. The first is the altruistic phase, followed by a reward system, which will be variable depending on market factors like how much watchtowers charge and how much clients are willing to pay. Lastly, Lightning Labs is devising a mechanism that will allow users to prepay for a given number for backups of their payment channel states.<\/p>\n<p>\u201cWhen it is integrated, it will probably resemble a Chaumian scheme where you pay via Lightning to acquire blinded tokens redeemable at the tower,\u201d Conner Fromknecht, head of cryptographic engineering at Lightning Labs, told <em>Bitcoin Magazine<\/em>.<\/p>\n<p>This token scheme, Fromknecht continued, also has some nifty uses for whitelisting participants while maintaining privacy. If a watchtower operator only wanted to serve their friends, for instance, they could \u201cauthenticate users up front but from then on it wouldn\u2019t be able to pinpoint which users are renewing or backing up to the tower\u201d because the tokens are \u201cblinded\u201d and payments can\u2019t be traced to a particular user.<\/p>\n<p>Osuntokun said that the primary cost for running a watchtower is storage, though the 1 TB hard drives users would need to run a Lightning node are fairly cheap at $40 and the blobs watchtowers need to store are \u201conly a few hundred bytes.\u201d Now, depending on how many channels a watchtower decides to monitor, this data burden becomes heavier; one channel obviously requires less space than 100 or 1,000 channels would.<\/p>\n<p>Still, storage space is a bit of a trade-off, Osuntokun said, one that sacrifices storage for privacy since \u201cthe tower doesn&#8217;t know which channel it\u2019s watching, so it ends up using more storage space.\u201d Another tricky piece of building the technology, he said, is finalizing the automatic discovery protocol for finding towers and devising the e-cash token so towers can be paid for each state update. Right now, they can only be paid if they catch a user cheating.<\/p>\n<p>Another hurdle is hash time locked contracts (HTLC), Fromknecht expressed. For the first release, only manually closed channels can be monitored for the sake of privacy and efficiency. Lightning Labs plans to add support for HTLC monitoring in the future, though, which will \u201cprevent an attacker from claiming them after the relative timelock elapses,\u201d Fromknecht said.<\/p>\n<p>Still, even with this room for improvement, the implementation is a big step toward making Lightning safer and trustless.<\/p>\n<p>\u201cWith what&#8217;s implemented in the to-be-merged pull request, any routing node, application or business on the network can start to run their own private tower to back up their public node. This can be a standalone instance or a more advanced deployment on dedicated hardware,\u201d Osuntokun said.<\/p>\n<p>So the best-case scenario with this technology, actually, is that every user has their <em>own<\/em> Eye of Sauron watching over their Lightning channels in the future \u2014 and that\u2019s actually a very good thing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Watchtowers, a new technical feature from Lightning Labs, will keep an eye on Lightning Network channels and potential bad actors.<\/p>\n","protected":false},"author":2566,"featured_media":20020,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[130,1252,460,2782],"class_list":["post-20019","post","type-post","status-publish","format-standard","has-post-thumbnail","category-technical","tag-lightning","tag-lightning-labs","tag-lightning-network","tag-watchtowers"],"author_data":{"id":2566,"name":"Colin Harper","nicename":"colin-harper","avatar_url":"https:\/\/bitcoinmagazine.com\/wp-content\/uploads\/2024\/12\/MjEwMTYzMzc3Njg5ODYzNjQ2-96x96.webp"},"featured_image_url":"https:\/\/bitcoinmagazine.com\/wp-content\/uploads\/2024\/11\/watchtowers-are-coming-to-lightning.jpg","_links":{"self":[{"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/posts\/20019","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\/2566"}],"replies":[{"embeddable":true,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/comments?post=20019"}],"version-history":[{"count":0,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/posts\/20019\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/media\/20020"}],"wp:attachment":[{"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/media?parent=20019"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/categories?post=20019"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/tags?post=20019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}