<oembed><type>rich</type><version>1.0</version><author_name>npub1rmlhmgvxk3p6kv9dgr9tpccm8uh9hejycjm5wag033fvhtpn0jqslw5exr</author_name><author_url>https://nostr.ae/npub1rmlhmgvxk3p6kv9dgr9tpccm8uh9hejycjm5wag033fvhtpn0jqslw5exr</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2022-10-03&#xA;📝 Original message:&#xA;This is the first in a series of posts on ideas to improve the usability&#xA;and scalability of the Lightning Network. This post presents a new channel&#xA;protocol that allows casual users to send and receive Lightning payments&#xA;without having to meet onerous availability requirements or use a&#xA;watchtower service. This new Watchtower-Free (WF) protocol can also be&#xA;used to simplify the reception of Lightning payments for casual users. No&#xA;change to the underlying Bitcoin protocol is required.&#xA;&#xA;A paper with a more complete description of the protocol, including&#xA;figures, is available [5].&#xA;&#xA;Properties&#xA;==========&#xA;&#xA;The user-visible properties of the WF protocol can be expressed using&#xA;two parameters:&#xA;* I_S: a short time interval (e.g., 10 minutes) for communicating with&#xA;  peers, checking the blockchain, and submitting transactions to the&#xA;  blockchain, and&#xA;* I_L: a long time interval (e.g., 1-3 months).&#xA;&#xA;The casual user must be online for up to:&#xA;* I_S every I_L (e.g., 10 minutes every 1-3 months) to safeguard the funds&#xA;  in their Lightning channel.&#xA;&#xA;With the WF protocol, the latency for payments is unchanged from the&#xA;current protocol, but the latency for getting a payment receipt from an&#xA;uncooperative channel partner is increased. In addition, the casual user&#xA;may have to pay their channel partner for the partner&#39;s cost of capital&#xA;(which depends on I_L). If the casual user and their channel partner&#xA;follow the protocol, the channel can remain off-chain arbitrarily long.&#xA;&#xA;First Attempt: Use The Current Lightning Protocol&#xA;=================================================&#xA;&#xA;In order to motivate the new protocol, first consider what would happen if&#xA;a casual user attempted to achieve the above properties with the current&#xA;Lightning channel protocol. The casual user would set their&#xA;&#34;to_self_delay&#34; (which controls how quickly their channel partner can&#xA;receive funds from a transaction they put on-chain) and&#xA;&#34;cltv_expiry_delta&#34; (which controls the staggering of timeouts between&#xA;successive hops) parameters to values approaching I_L (because the casual&#xA;user could be unavailable for nearly that long). This would create three&#xA;problems:&#xA;&#xA;* Problem 1: The casual user&#39;s proposed channel partner would likely&#xA;  reject the creation of the channel due to the excessive &#34;to_self_delay&#34;&#xA;  value.&#xA;&#xA;* Problem 2: If a channel were created with these parameters, Lightning&#xA;  payments would not be routed through it due to the excessive&#xA;  &#34;cltv_expiry_delta&#34; value.&#xA;&#xA;* Problem 3: If a channel were created with these parameters and if the&#xA;  casual user sent a payment on that channel, their partner could have to&#xA;  go on-chain in order to pull the payment from the casual user. In&#xA;  particular, the casual user could be offline for nearly I_L (e.g., 1-3&#xA;  months) when their partner receives the receipt, thus forcing their&#xA;  partner to go on-chain to receive payment before the expiry of the&#xA;  associated HTLC.&#xA;&#xA;The WF Protocol&#xA;===============&#xA;&#xA;The WF protocol solves these problems by modifying the Lightning protocol&#xA;as follows:&#xA;&#xA;* Problem 1 is solved by having the casual user pre-pay their channel&#xA;  partner for the cost of the partner&#39;s capital that&#39;s tied up in the&#xA;  channel due to the very large &#34;to_self_delay&#34; value. This pre-payment is&#xA;  included in the initial channel state and is updated at least once every&#xA;  I_L to reflect the additional cost of capital due to the partner not yet&#xA;  going on-chain.&#xA;&#xA;* Problem 2 is solved by allowing casual users to designate themselves as&#xA;  Casual-Lightning-Users (CLUs), while the remaining users are&#xA;  Dedicated-Lightning-Users (DLUs). CLUs can only partner with DLUs to&#xA;  open channels, such channels must be unannounced, and CLUs must not&#xA;  route (as opposed to send or receive) payments. These constraints fit&#xA;  naturally with the desires of casual users who want to send and receive&#xA;  their Lightning payments, but not route payments for others. Support for&#xA;  CLUs is analogous to support for SPV (Simplified-Payment-Verification)&#xA;  nodes in Bitcoin.&#xA;&#xA;* Problem 3 is solved by modifying both users&#39; Commitment transactions in&#xA;  the channel that sends the payment so the CLU can be offline for nearly&#xA;  I_L without forcing their DLU partner to go on-chain. A simple approach&#xA;  would be to delay the expiry of the HTLC for each payment in the sending&#xA;  channel by I_L. This approach works, but it has the downside of delaying&#xA;  (by I_L) the CLU&#39;s ability to force production of a payment receipt. A&#xA;  better approach is to add a relative delay before the CLU can time out&#xA;  the HTLC output of a Commitment transaction, thus enabling the DLU to&#xA;  safely stay off-chain even after the expiry of the HTLC. That&#39;s the&#xA;  approach taken here.&#xA;&#xA;Let Alice be a CLU who shares a channel with DLU Bob. Bob sets his channel&#xA;parameters as he would in the current Lightning protocol, while Alice sets&#xA;her &#34;to_self_delay&#34; parameter (controlling Bob&#39;s payments to himself) to&#xA;I_L greater than it would be in the current Lightning protocol. Consider&#xA;the case where Alice sends a Lightning payment on the channel she shares&#xA;with Bob.&#xA;&#xA;Let:&#xA;  - eAB denote the expiry for this payment in the channel shared by Alice&#xA;    and Bob,&#xA;  - tsdA denote the &#34;to_self_delay&#34; parameter set by Alice, and&#xA;  - tsdB denote the &#34;to_self_delay&#34; parameter set by Bob.&#xA;&#xA;Three changes are made relative to the current Lightning protocol:&#xA;  - a relative delay of tsdB is enforced before Alice can spend the HTLC&#xA;    output for this payment in either Commitment transaction,&#xA;  - after eAB, only Alice&#39;s (rather than both parties&#39;) signature is&#xA;    required to spend the HTLC output in Alice&#39;s Commitment transaction,&#xA;    and that output doesn&#39;t need to be spent using an HTLC-timeout&#xA;    transaction that can be revoked (because the relative delay added&#xA;    above guarantees Bob can prevent Alice from spending the HTLC output&#xA;    in a revoked Commitment transaction that she puts on-chain), and&#xA;  - both parties update the channel state off-chain at least once every&#xA;    I_L to reflect Bob&#39;s cost of capital, as described above.&#xA;&#xA;The resulting protocol, with a single payment from Alice outstanding, is&#xA;shown below:&#xA;&#xA;+-+ AB      +----+ A&#xA;|F|----+---&gt;| CC |---&gt;&#xA;+-+    |    |    |&#xA;       .    |    | B&#xA;       .    |    |---&gt;&#xA;       .    +----+&#xA;       |&#xA;       |&#xA;       |              revkeyBi&#xA;       |            +----------&gt;&#xA;       |            |&#xA;       |    +----+  | tsdB &amp; A&#xA;       +---&gt;|C_Ai|--+----------&gt;&#xA;       |    |    |&#xA;       |    |    |    B&#xA;       |    |    |-------------&gt;&#xA;       |    |    |&#xA;       |    |    |    revkeyBi&#xA;       |    |    |  +----------&gt;&#xA;       |    |    |  |&#xA;       |    |    |  | tsdB &amp; (eAB) &amp; A&#xA;       |    |    |--+-------------------&gt;&#xA;       |    +----+  |&#xA;       |            | Preimage(X) &amp; B&#xA;       |            +-------------------&gt;&#xA;       |&#xA;       |&#xA;       |&#xA;       |              revkeyAi&#xA;       |            +----------&gt;&#xA;       |            |&#xA;       |    +----+  | tsdA &amp; B&#xA;       +---&gt;|C_Bi|--+----------&gt;&#xA;       |    |    |&#xA;       |    |    |    A&#xA;       |    |    |-------------&gt;&#xA;       |    |    |&#xA;       |    |    |    revkeyAi&#xA;       |    |    |  +----------&gt;&#xA;       .    |    |  |&#xA;       .    |    |  | tsdB &amp; (eAB) &amp; A              revkeyAi&#xA;       .    |    |--+-------------------&gt;         +----------&gt;&#xA;       |    +----+  |                             |&#xA;       |            | Preimage(X) &amp; AB   +-----+  | tsdA &amp; B&#xA;       V            +-------------------&gt;|Hs_Bi|--+----------&gt;&#xA;                                         +-----+&#xA;&#xA;where:&#xA;F is the Funding transaction,&#xA;CC is the Cooperative Close transaction,&#xA;C_Ai is Alice&#39;s Commitment transaction for state i,&#xA;C_Bi is Bob&#39;s Commitment transaction for state i, and&#xA;Hs_Bi is Bob&#39;s HTLC-success transaction for state i.&#xA;&#xA;The F transaction is on-chain, while the remaining transactions are&#xA;off-chain during normal protocol operation.&#xA;&#xA;Requirements for output cases are as follows:&#xA;A: Alice&#39;s signature,&#xA;B: Bob&#39;s signature,&#xA;AB: Alice&#39;s and Bob&#39;s signatures,&#xA;revkeyAi: a signature using a revocation key that Alice can use to revoke&#xA;          Bob&#39;s state i transaction,&#xA;revkeyBi: a signature using a revocation key that Bob can use to revoke&#xA;          Alice&#39;s state i transaction,&#xA;tsdA: a relative delay equal to Alice&#39;s to_self_delay parameter,&#xA;tsdB: a relative delay equal to Bob&#39;s to_self_delay parameter,&#xA;(eAB): an absolute timelock equal to the expiry of the outstanding HTLC&#xA;       offered by Alice, and&#xA;Preimage(X): the hash preimage of X.&#xA;&#xA;Once Bob knows Preimage(X), he sends Preimage(X) to Alice and attempts to&#xA;update both parties&#39; Commitment transactions to show payment of the HTLC.&#xA;If he has spent I_L time unsuccessfully trying to update those Commitment&#xA;transactions, he can submit his Commitment and HTLC-success transactions&#xA;to the blockchain. If at any point he sees Alice&#39;s Commitment transaction&#xA;on-chain, he stops trying to update the Commitment transactions off-chain&#xA;and he puts his transaction that reveals Preimage(X) and spends the HTLC&#xA;output in her Commitment transaction on-chain as soon as possible.&#xA;&#xA;Alice implements the WF channel protocol as she would the current&#xA;Lightning channel protocol, except:&#xA; - she can choose to be intentionally unavailable, provided she is&#xA;   available (or at least not intentionally unavailable) for at least I_S&#xA;   every I_L (to update her pre-payment for Bob&#39;s cost of capital and to&#xA;   revoke any old transactions put on-chain by Bob), and&#xA; - she does not put her Commitment transaction on-chain until she has&#xA;   been available (or at least not intentionally unavailable) for at least&#xA;   a grace period of G following the expiry of her offered HTLC (where G&#xA;   is the same grace period as is used in the current Lightning protocol&#xA;   and G &lt;= I_S).&#xA;&#xA;Correctness&#xA;===========&#xA;&#xA;When Alice sends a payment on the channel she shares with Bob, the WF&#xA;protocol matches the Lightning protocol except the parties stay off-chain&#xA;longer with the WF protocol (to accommodate Alice&#39;s intentional&#xA;unavailability). Staying off-chain longer is safe for Alice, as she&#xA;originated the payment and thus does not have to time out the HTLC at any&#xA;specific time in order receive payment in an earlier hop. Staying&#xA;off-chain longer is also safe for Bob, because whenever Alice&#39;s (or Bob&#39;s)&#xA;Commitment transaction is put on-chain, the tsdB relative delay before&#xA;Alice can time out the HTLC output is long enough to allow Bob to put his&#xA;transaction on-chain that takes payment for the HTLC.&#xA;&#xA;Finally, the WF protocol requires that Alice and Bob stay off-chain long&#xA;enough to guarantee that Alice will be available (or at least not&#xA;intentionally unavailable) for at least G, which is sufficient for both&#xA;parties to update the channel state off-chain. As a result, if both&#xA;parties follow the protocol, the channel will remain off-chain despite&#xA;Alice&#39;s intentional unavailability.&#xA;&#xA;A more detailed proof of correctness is given in the paper [5].&#xA;&#xA;One-Shot Receives&#xA;=================&#xA;&#xA;While eliminating watchtowers is helpful for casual users, the protocol&#xA;for receiving Lightning payments could still be awkward for such users.&#xA;With the current Lightning protocol, when a user receives a payment and&#xA;their channel partner is unresponsive, the user must submit their&#xA;Commitment and HTLC-success transactions to the blockchain. However, if&#xA;their partner&#39;s conflicting Commitment transaction wins the race and is&#xA;included in the blockchain, the user then has to submit a different&#xA;transaction that reveals the HTLC&#39;s secret and spends the HTLC output in&#xA;their partner&#39;s Commitment transaction. The requirement to wait and check&#xA;the blockchain for the winning Commitment transaction (which might not be&#xA;determined until multiple blocks have been added to the blockchain) is&#xA;awkward for a casual user. It would be far preferable if the casual user&#xA;could always receive a payment by performing a sequence of off-chain&#xA;message exchanges and at most one submission to the blockchain. A protocol&#xA;that has this property will be said to support &#34;one-shot receives&#34;.&#xA;&#xA;The WF protocol can be made to support one-short receives (and to simplify&#xA;the process of getting a receipt) for CLU Alice by making the following&#xA;change whenever a new Commitment transaction for DLU Bob is signed by&#xA;Alice:&#xA; - if Bob has one or more outstanding HTLCs offered to Alice, the&#xA;   nLocktime field of Bob&#39;s Commitment transaction is set to the expiry of&#xA;   the earliest such HTLC,&#xA; - otherwise, the nLocktime field of Bob&#39;s Commitment transaction is set&#xA;   to I_L in the future (relative to when Bob&#39;s Commitment transaction is&#xA;   signed by Alice).&#xA;&#xA;Before examining how this change supports one-shot receives, it&#39;s&#xA;important to resolve a technical issue. In the current Lightning protocol,&#xA;the nLocktime field in the Commitment transaction provides 24 bits of the&#xA;channel&#39;s state number in order to allow efficient revocation of old&#xA;on-chain Commitments (with the remaining 24 bits being provided by the&#xA;nSequence field of the Commitment transaction&#39;s sole input). Because we&#39;re&#xA;now using the nLocktime field to enforce an absolute timelock, those 24&#xA;bits of state number can no longer be encoded in the nLocktime field.&#xA;There are two solutions to this problem:&#xA; - add a second input to Bob&#39;s Commitment transaction that spends a UTXO&#xA;   owned by Bob (the value of which is arbitrary and is refunded to Bob in&#xA;   the Commitment transaction) and use the nSequence field of that input&#xA;   to encode 24 bits of state number, or&#xA; - support only 24-bit state numbers, as 16 million channel states are&#xA;   likely sufficient for most casual users.&#xA;&#xA;In addition, the following constraints are added in order to guarantee&#xA;one-shot receives:&#xA;1. Whenever a new HTLC is offered to Alice, its expiry is set to exactly&#xA;   her min_final_cltv_expiry parameter in the future. This constraint&#xA;   guarantees that new HTLCs have expiries that are monotonically&#xA;   nondecreasing.&#xA;2. Whenever Alice gives Bob a secret for an HTLC, that HTLC has the&#xA;   earliest expiry of all the HTLCs in Alice&#39;s current Commitment&#xA;   transaction.&#xA;3. Whenever a new channel state i+1 is created, Alice&#39;s partial signature&#xA;   for Bob&#39;s Commitment transaction for state i+1 is given to Bob, and the&#xA;   revocation key for Bob&#39;s Commitment transaction for state i is given to&#xA;   Alice, before Bob&#39;s partial signature for Alice&#39;s Commitment&#xA;   transaction for state i+1 is given to Alice.&#xA;&#xA;Given these constraints and the setting of the nLocktime field in Bob&#39;s&#xA;Commitment transaction, Alice can always put her Commitment transaction&#xA;on-chain before Bob can put a conflicting current Commitment transaction&#xA;on-chain, thus providing one-shot receives. The details are provided in&#xA;the paper [5].&#xA;&#xA;Finally, it&#39;s important to verify that the delay of Bob&#39;s Commitment&#xA;transaction (caused by the setting of its nLocktime field) does not create&#xA;any problems for Bob. First, for HTLCs offered to Alice (that is, payments&#xA;received by Alice), the current Lightning protocol requires that Bob wait&#xA;until after the expiry of his offered HTLC before he goes on-chain with&#xA;his Commitment and HTLC-timeout transactions. Therefore, the nLocktime&#xA;field has no impact on Bob&#39;s actions regarding HTLCs offered to Alice.&#xA;Second, for HTLCs offered by Alice (that is, payments sent by Alice), the&#xA;WF protocol does not force Bob to put his Commitment and associated&#xA;HTLC-success transactions on-chain before any specific time in order&#xA;guarantee the success of any HTLCs. As a result, Bob&#39;s ability to force&#xA;payment for HTLCs offered by Alice is unaffected by the nLocktime field in&#xA;his Commitment transactions. Note that the Lightning protocol does&#xA;require Bob to put his Commitment and associated HTLC-success transactions&#xA;on-chain by a specific time, which is why the changes described here&#xA;cannot be made to the Lightning protocol to support one-shot receives.&#xA;&#xA;Getting A Payment Receipt&#xA;=========================&#xA;&#xA;Consider again the case where casual user Alice has offered an HTLC to&#xA;Bob. At any time after the expiry of the HTLC, if Alice needs to get a&#xA;payment receipt and Bob is uncooperative, Alice can put her Commitment&#xA;transaction on-chain and then attempt to spend the HTLC output of her&#xA;Commitment transaction tsdB later. As was shown above, she is guaranteed&#xA;to win the race in putting her Commitment transaction on-chain due to the&#xA;nLocktime field in Bob&#39;s Commitment transaction. Therefore, she will&#xA;either get her receipt before she is able to spend the HTLC output or she&#xA;will not have to make her payment (because she succeeded in spending the&#xA;HTLC output). This procedure for getting a payment receipt isn&#39;t one-shot&#xA;and may be awkward for casual users. Fortunately, it&#39;s only required when&#xA;there&#39;s both a payment dispute (or other need to get a receipt quickly)&#xA;and an uncooperative channel partner.&#xA;&#xA;Asynchronous Payments&#xA;=====================&#xA;&#xA;The WF protocol gives significant flexibility to when CLUs have to be&#xA;online, but it still requires that the sender and receiver are both online&#xA;simultaneously. This requirement can be eliminated by keeping the relative&#xA;delay but removing the absolute delay in Alice&#39;s transaction that times&#xA;out an HTLC for a payment that she initiates. The details are given in the&#xA;paper [5].&#xA;&#xA;Related Work&#xA;============&#xA;&#xA;The protocol presented here is based extensively on previously-published&#xA;work, namely the Poon-Dryja Lightning channel protocol [1] and the BOLT&#xA;specifications [2]. The asynchronous payments protocol is based on&#xA;Corallo&#39;s proposal for sending tips to an offline receiver [3], but&#xA;differs by using only a relative delay in the sender&#39;s HTLC.&#xA;&#xA;The idea of eliminating watchtowers for a casual user by delaying their&#xA;partner&#39;s ability to put transactions on-chain was described by Law [4],&#xA;but the interaction of that delay with HTLCs was not analyzed and that&#xA;paper assumed modifications to the underlying Bitcoin protocol.&#xA;&#xA;Conclusions&#xA;===========&#xA;&#xA;This post presents the idea of dividing users into Casual-Lightning-Users&#xA;(CLUs) that only send and receive payments, and Dedicated-Lightning-Users&#xA;(DLUs) that can also route payments. It gives a new protocol that allows&#xA;casual users to send and receive Lightning payments in a trust-free manner&#xA;without requiring a watchtower service. It also allows CLUs to receive&#xA;payments in a one-shot manner (that is, without having to wait for blocks&#xA;to be added to the blockchain). No changes to the Bitcoin protocol are&#xA;required.&#xA;&#xA;The new protocol does have some disadvantages, such as increasing the cost&#xA;of capital for DLUs that partner with CLUs and increasing the latency for&#xA;CLUs to get payment receipts from uncooperative partners. Hopefully, the&#xA;elimination of watchtowers for casual users, and their ability to do&#xA;one-shot receives, will more than make up for these drawbacks.&#xA;&#xA;I&#39;m not an expert in the area, so I might have missed something.&#xA;&#xA;Corrections and comments are greatly appreciated.&#xA;&#xA;Regards,&#xA;John&#xA;&#xA;References&#xA;==========&#xA;&#xA;[1] Poon and Dryja, The Bitcoin Lightning Network, available at&#xA;    https://lightning.network/lightning-network-paper.pdf.&#xA;[2] BOLT specifications, available at&#xA;    https://github.com/lightningnetwork/lightning-rfc.&#xA;[3] Corallo, A Mobile Lightning User Goes to Pay a Mobile Lightning&#xA;    User..., available at https://lists.linuxfoundation.org/pipermail/lightning-dev/2021-October/003307.html.&#xA;[4] Law, Section 3.6 of Scaling Bitcoin With Inherited IDs, available at&#xA;    https://github.com/JohnLaw2/btc-iids.&#xA;[5] Law, Watchtower-Free Lightning Channels For Casual Users, available at&#xA;    https://github.com/JohnLaw2/ln-watchtower-free.&#xA;&#xA;Sent with [Proton Mail](https://proton.me/) secure email.&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20221003/ee49228d/attachment-0001.html&gt;</html></oembed>