Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

asynchronous Lightning network payments

8 messages, Oct 29 to Nov 4, 2019. Started by Konstantin Ketterer.

Yaacov Akiba Slama (3), Konstantin Ketterer (2), ZmnSCPxj (2), Nadav Kohen

Permalink First message in the Wayback Machine

Konstantin Ketterer permalink original

## Problem Currently, both parties have to be online at the same time to send/ receive money. This can be avoided by using something like the Lightning Rod Protocol by Breez (https://github.com/breez/LightningRod). However, funds have to be locked up longer than usual. We can do better than that.

## Solution The payer A pre-signs a transaction handing over money to their local channel partner S and sends the transaction to the payee B in an end to end encrypted communication channel. B can then sell the signature for the transaction to S using pay-for-signature made possible by payment points and scalars. ( https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2019/selling-signatures-another-reason-to-move-to-payment-points#m-e52a885b)

We will be using eltoo because we don't have to worry about toxic channel states.

A and S are online, A and S have a channel 1. A contacts S: they commit and exchange the R (= k*G) part of the Schnorr Signature for the update and settlement transaction 2. A and S sign the settlement transaction increasing the balance between them by amt + fee in favor of S and exchange the signatures 3. A signs the corresponding update transaction but does not give it so S 4. A sends the update transaction to B using an end to end encrypted asynchronous communication channel

A can go offline B comes online

4. Decrypts the update transaction and sells the signature s to S for amt

When A comes back online S gives A the invoice (with the payment point s*G) signed by B, the corresponding scalar s (the signature from A for the update transaction) and signature from S for the update transaction. They can now proceed as normal.

In addition to enabling asynchronous payments, this outsources the routing to S.

### Potential issues

#### Privacy S currently knows both the sender and the receiver of the payment. If we split the payment from S to B into two payments between S and a public routing node P and P and B by still using the same scalar + payment point, S now only knows the sender and P only knows the receiver. To further increase privacy we can split the payment multiple times but all nodes involved must support this feature.

#### Locked up capital While B hasn't yet claimed its money, the funds in the channel between A and S are essentially locked up. However, A and S could simply overwrite the payment (new update + settlement transaction), then A could send multiple payments with the remaining balance and before going offline A would do the procedure again. If A has sufficient inbound capacity in other channels it can also re-balance its channel A-S so that the outbound capacity - (amt + fees) in this channel is zero and then do the procedure.

#### Communication channel Obviously, the communication channel must be end to end encrypted otherwise this is highly insecure. Hopefully, we will have a sort of decentralized paid mail server system which is compatible across all LN wallets and part of BOLT.

#### Proof of payment The invoice by B with the payment point s*G and s are not sufficient as a PoP because S can simply give A the invoice and A already knows s.

## the other way around We can also do it in a way that A can instantly send B (who is offline) money but now A is in charge of enforcing the channel state if S cheats. Because it has more issues like who pays the transaction fees if S cheats and because I believe Lightning is generally not designed for people who are offline for a long time I prefer the first one. But here is the other one:

B and S are online, B and S have a channel

1. B and S sign a new settlement transaction increasing balance in favor of B by amt 2. B signs the corresponding update transaction, encrypts it and sends it together with the settlement transaction to A

B can go offline A comes online

3. A decrypts the transactions, A pays S to sign the update transaction which makes this new channel state valid/ enforceable 4. now A essentially acts like a watchtower while B is offline

## Conclusion

This enables truly asynchronous Lightning network payments and is yet another reason to move to payment points and scalars.

Regards Konstantin Ketterer

Github: https://github.com/ko-redtruck/async-payments-ln

Nadav Kohen in reply to Konstantin Ketterer permalink original

Hi Konstantin,

This looks cool and I haven't had a chance yet to spend time with the idea, but I would like to add that you can likely solve the PoP problem mentioned under potential issues by having S pay B with an AMP-like setup. We use the point B + x*G on one payment where x is a nonce generated by S, and the point B + s*G + x*G on the other payment. The nonce, x, is revealed to the signature seller only when they receive both onions. This way when the payment completes, S learns b + x and b + x + s so that they can compute b = (b + x) - x and s = (b + x + s) - (b + x). s is the signature that they wanted and b is the PoP.

Best, Nadav

On Tue, Oct 29, 2019 at 3:47 PM Konstantin Ketterer < ketterer.konstantin at gmail.com> wrote:

Quoted text (106 lines)
> ## Problem
> Currently, both parties have to be online at the same time to send/
> receive money. This can be avoided by using something like the Lightning
> Rod Protocol by Breez (https://github.com/breez/LightningRod). However,
> funds have to be locked up longer than usual. We can do better than that.
>
> ## Solution
> The payer A pre-signs a transaction handing over money to their local
> channel partner S and sends the transaction to the payee B in an end to end
> encrypted communication channel. B can then sell the signature for the
> transaction to S using pay-for-signature made possible by payment points
> and scalars. (
> https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2019/selling-signatures-another-reason-to-move-to-payment-points#m-e52a885b)
>
>
> We will be using eltoo because we don't have to worry about toxic channel
> states.
>
> A and S are online, A and S have a channel
> 1. A contacts S: they commit and exchange the R (= k*G) part of the
> Schnorr Signature for the update and settlement transaction
> 2. A and S sign the settlement transaction increasing the balance between
> them by amt + fee in favor of S and exchange the signatures
> 3. A signs the corresponding update transaction but does not give it so S
> 4. A sends the update transaction to B using an end to end encrypted
> asynchronous communication channel
>
> A can go offline
> B comes online
>
> 4. Decrypts the update transaction and sells the signature s to S for amt
>
> When A comes back online S gives A the invoice (with the payment point
> s*G) signed by B, the corresponding scalar s (the signature from A for the
> update transaction) and signature from S for the update transaction. They
> can now proceed as normal.
>
> In addition to enabling asynchronous payments, this outsources the routing
> to S.
>
> ### Potential issues
>
> #### Privacy
> S currently knows both the sender and the receiver of the payment. If we
> split the payment from S to B into two payments between S and a public
> routing node P and P and B by still using the same scalar + payment point,
> S now only knows the sender and P only knows the receiver. To further
> increase privacy we can split the payment multiple times but all nodes
> involved must support this feature.
>
> #### Locked up capital
> While B hasn't yet claimed its money, the funds in the channel between A
> and S are essentially locked up. However, A and S could simply overwrite
> the payment (new update + settlement transaction), then A could send
> multiple payments with the remaining balance and before going offline A
> would do the procedure again. If A has sufficient inbound capacity in other
> channels it can also re-balance its channel A-S so that the outbound
> capacity - (amt + fees) in this channel is zero and then do the procedure.
>
> #### Communication channel
> Obviously, the communication channel must be end to end encrypted
> otherwise this is highly insecure. Hopefully, we will have a sort of
> decentralized paid mail server system which is compatible across all LN
> wallets and part of BOLT.
>
> #### Proof of payment
> The invoice by B with the payment point s*G and s are not sufficient as a
> PoP because S can simply give A the invoice and A already knows s.
>
> ## the other way around
> We can also do it in a way that A can instantly send B (who is offline)
> money but now A is in charge of enforcing the channel state if S cheats.
> Because it has more issues like who pays the transaction fees if S cheats
> and because I believe Lightning is generally not designed for people who
> are offline for a long time I prefer the first one. But here is the other
> one:
>
> B and S are online, B and S have a channel
>
> 1. B and S sign a new settlement transaction increasing balance in favor
> of B by amt
> 2. B signs the corresponding update transaction, encrypts it and sends it
> together with the settlement transaction to A
>
> B can go offline
> A comes online
>
> 3. A decrypts the transactions, A pays S to sign the update transaction
> which makes this new channel state valid/ enforceable
> 4. now A essentially acts like a watchtower while B is offline
>
> ## Conclusion
>
> This enables truly asynchronous Lightning network payments and is yet
> another reason to move to payment points and scalars.
>
>
> Regards
> Konstantin Ketterer
>
> Github: https://github.com/ko-redtruck/async-payments-ln
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
ZmnSCPxj in reply to Konstantin Ketterer permalink original

Good morning Konstantin,

Quoted text (13 lines)
> ## Solution
> The payer A pre-signs a transaction handing over money to their local channel partner S and sends the transaction to the payee B in an end to end encrypted communication channel. B can then sell the signature for the transaction to S using pay-for-signature made possible by payment points and scalars. (https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2019/selling-signatures-another-reason-to-move-to-payment-points#m-e52a885b)
>
> We will be using eltoo because we don't have to worry about toxic channel states.
>
> A and S are online, A and S have a channel
> 1. A contacts S: they commit and exchange the R (= k*G) part of the Schnorr Signature for the update and settlement transaction
> 2. A and S sign the settlement transaction increasing the balance between them by amt + fee in favor of S and exchange the signatures
> 3. A signs the corresponding update transaction but does not give it so S
> 4. A sends the update transaction to B using an end to end encrypted asynchronous communication channel
>
> A can go offline
> B comes online

How does S learn that B has come online?

Presumably there is some kind of polling involved. What do you imagine the polling rate to be? One block? 100 blocks? One difficulty adjustment? One halving period?

Quoted text (14 lines)
>
> 4. Decrypts the update transaction and sells the signature s to S for amt
>
> When A comes back online S gives A the invoice (with the payment point s*G) signed by B, the corresponding scalar s (the signature from A for the update transaction) and signature from S for the update transaction. They can now proceed as normal.
>
> In addition to enabling asynchronous payments, this outsources the routing to S.
>
> ### Potential issues
>
> #### Privacy
> S currently knows both the sender and the receiver of the payment. If we split the payment from S to B into two payments between S and a public routing node P and P and B by still using the same scalar + payment point, S now only knows the sender and P only knows the receiver. To further increase privacy we can split the payment multiple times but all nodes involved must support this feature.
>
> #### Locked up capital
> While B hasn't yet claimed its money, the funds in the channel between A and S are essentially locked up. However, A and S could simply overwrite the payment (new update + settlement transaction), then A could send multiple payments with the remaining balance and before going offline A would do the procedure again. If A has sufficient inbound capacity in other channels it can also re-balance its channel A-S so that the outbound capacity - (amt + fees) in this channel is zero and then do the procedure.

An issue is when the channel is forced onchain by either A or S. For example, what if S is attacked by an army of shiny robots which destroys the keys of S? (Disclaimer: I do not control, nor have I ever controlled, an army of shiny robots to take over the world. Shininess does not increase combat capability, thus not useful property of robots to have.) Obviously S can no longer participate in the channel update, thus A *must* force the channel onchain and execute the contract there.

Thus, the UTXO for this should be claimable in both a secret-revelation path and a timeout path, both enforceable onchain, else S could hold the funds hostage by threatening unilateral close of the channel. i.e. you still need a PTLC for this.

Indeed, it seems to me that much of the advantage of this lies solely in S being directly a peer of the payer. It seems doable with just HTLCs and a normal BOLT11 invoice from B (possibly sent in plaintext to A via a deferred messaging service such as email --- invoices contain no private data anyway). Then the arrangement boils down to A and S agreeing that S will do all the routing (by polling the network) until just before the timeout indicated by the HTLC occurs. Trampoline routing can then be used to mask B from S.

Regards, ZmnSCPxj

Konstantin Ketterer in reply to ZmnSCPxj permalink original

Hi ZmnSCPxj,

Quoted text (9 lines)
How does S learn that B has come online?
>
> Presumably there is some kind of polling involved.
> What do you imagine the polling rate to be?
> One block?
> 100 blocks?
> One difficulty adjustment?
> One halving period?
>

I imagined that A somehow send the IP address of S or any information to contact S alongside the transaction and then B would connect to S and request the payment. If it had to be a polling rate I would choose something like 6 blocks.

Quoted text (24 lines)
> > #### Locked up capital
> > While B hasn't yet claimed its money, the funds in the channel between A
> and S are essentially locked up. However, A and S could simply overwrite
> the payment (new update + settlement transaction), then A could send
> multiple payments with the remaining balance and before going offline A
> would do the procedure again. If A has sufficient inbound capacity in other
> channels it can also re-balance its channel A-S so that the outbound
> capacity - (amt + fees) in this channel is zero and then do the procedure.
>
> An issue is when the channel is forced onchain by either A or S.
> For example, what if S is attacked by an army of shiny robots which
> destroys the keys of S?
> (Disclaimer: I do not control, nor have I ever controlled, an army of
> shiny robots to take over the world.
> Shininess does not increase combat capability, thus not useful property of
> robots to have.)
> Obviously S can no longer participate in the channel update, thus A *must*
> force the channel onchain and execute the contract there.
>
> Thus, the UTXO for this should be claimable in both a secret-revelation
> path and a timeout path, both enforceable onchain, else S could hold the
> funds hostage by threatening unilateral close of the channel.
> i.e. you still need a PTLC for this.
>

I don't think I understand what you are trying to say. Because we are using eltoo A can at any point in time publish the trigger transaction, the previous update transaction and the corresponding settlement transaction without any repercussions and recover its money after some amount of time. This essentially allows A to cancel the payment to B until B has claimed the payment from S. Because if S has already paid B and has not lost its keys ( or already signed the new update transaction beforehand) it can double spend the older settlement transaction from A with its newer update and settlement transaction. All in all, A can still force the channel to settle on chain even if S does not cooperate anymore and doesn't tell A about the new update + settlement transaction.

Regards Konstantin

Yaacov Akiba Slama in reply to Konstantin Ketterer permalink original
Yaacov Akiba Slama in reply to Konstantin Ketterer permalink original

[Resending in Plain Text. Sorry for the spam] Hello Konstantin,

In asynchronous payments we want to be sure that there are only two states: 1) Before B received the payment. 2) After B received the payment. In state 1), we want A to still have the control of the amount, and at the same time we want to let B decide (until a certain timeout) to receive the payment. In this state, S can only help B to be paid, or cancel the whole transfer, but in this case, A cannot lose the amount. In state 2), we want to be sure that no money is lost by S (and consequently that the amount in A wallet is decremented by amt). As ZmnSCPxj wrote in https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2019/asynchronous-lightning-network-payments#m-6261934c (as I understand the last sentences), there is no way to do that without locking the amount.

In order to increase the privacy, we are improving the specification to be be able to use several Rod nodes: a list of nodes chosen by the payer and another list by the payee. The Rod nodes are supposed to be almost always online, so standard https can be used to communicate with them and between them. --yas

On 29/10/2019 22:46, Konstantin Ketterer wrote:

Quoted text (108 lines)
> ## Problem
> Currently, both parties have to be online at the same time to send/
> receive money. This can be avoided by using something like the
> Lightning Rod Protocol by Breez
> (https://github.com/breez/LightningRod). However, funds have to be
> locked up longer than usual. We can do better than that.
>
> ## Solution
> The payer A pre-signs a transaction handing over money to their local
> channel partner S and sends the transaction to the payee B in an end
> to end encrypted communication channel. B can then sell the signature
> for the transaction to S using pay-for-signature made possible by
> payment points and scalars.
> (https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2019/selling-signatures-another-reason-to-move-to-payment-points#m-e52a885b)
>
>
> We will be using eltoo because we don't have to worry about toxic
> channel states.
>
> A and S are online, A and S have a channel
> 1. A contacts S: they commit and exchange the R (= k*G) part of the
> Schnorr Signature for the update and settlement transaction
> 2. A and S sign the settlement transaction increasing the balance
> between them by amt + fee in favor of S and exchange the signatures
> 3. A signs the corresponding update transaction but does not give it so S
> 4. A sends the update transaction to B using an end to end encrypted
> asynchronous communication channel
>
> A can go offline
> B comes online
>
> 4. Decrypts the update transaction and sells the signature s to S for amt
>
> When A comes back online S gives A the invoice (with the payment point
> s*G) signed by B, the corresponding scalar s (the signature from A for
> the update transaction) and signature from S for the update
> transaction. They can now proceed as normal.
>
> In addition to enabling asynchronous payments, this outsources the
> routing to S.
>
> ### Potential issues
>
> #### Privacy
> S currently knows both the sender and the receiver of the payment. If
> we split the payment from S to B into two payments between S and a
> public routing node P and P and B by still using the same scalar +
> payment point, S now only knows the sender and P only knows the
> receiver. To further increase privacy we can split the payment
> multiple times but all nodes involved must support this feature.
>
> #### Locked up capital
> While B hasn't yet claimed its money, the funds in the channel between
> A and S are essentially locked up. However, A and S could simply
> overwrite the payment (new update + settlement transaction), then A
> could send multiple payments with the remaining balance and before
> going offline A would do the procedure again. If A has sufficient
> inbound capacity in other channels it can also re-balance its channel
> A-S so that the outbound capacity - (amt + fees) in this channel is
> zero and then do the procedure.
>
> #### Communication channel
> Obviously, the communication channel must be end to end encrypted
> otherwise this is highly insecure. Hopefully, we will have a sort of
> decentralized paid mail server system which is compatible across all
> LN wallets and part of BOLT.
>
> #### Proof of payment
> The invoice by B with the payment point s*G and s are not sufficient
> as a PoP because S can simply give A the invoice and A already knows s.
>
> ## the other way around
> We can also do it in a way that A can instantly send B (who is
> offline) money but now A is in charge of enforcing the channel state
> if S cheats. Because it has more issues like who pays the transaction
> fees if S cheats and because I believe Lightning is generally not
> designed for people who are offline for a long time I prefer the first
> one. But here is the other one:
>
> B and S are online, B and S have a channel
>
> 1. B and S sign a new settlement transaction increasing balance in
> favor of B by amt
> 2. B signs the corresponding update transaction, encrypts it and sends
> it together with the settlement transaction to A
>
> B can go offline
> A comes online
>
> 3. A decrypts the transactions, A pays S to sign the update
> transaction which makes this new channel state valid/ enforceable
> 4. now A essentially acts like a watchtower while B is offline
>
> ## Conclusion
>
> This enables truly asynchronous Lightning network payments and is yet
> another reason to move to payment points and scalars.
>
>
> Regards
> Konstantin Ketterer
>
> Github: https://github.com/ko-redtruck/async-payments-ln
>
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
ZmnSCPxj in reply to Yaacov Akiba Slama permalink original

Good morning Konstantin and yas,

Indeed, yas is quite correct: the money is still locked, and all that this proposal adds is to limit the funds locked by having S be a direct peer of the payer. In the case proposed by Konstantin, this is simply locked between both A and S only, but it *must* be locked, or else timing shenanigans can be performed to defraud S.

A proposal, is to add some sort of `please_poll` flag TLV to Trampoline onions, where if `please_poll` is enabled for a Trampoline node, it will perform the above-mentioned polling of once every 6 blocks. That way, any node that supports Trampoline *and* `please_poll` can work as an S (or Rod) for a possibly-offline next step.

Alternatively, Trampoline implementations might actually just implement the polling behavior automatically without a `please_poll` flag; this might be viable especially if the Trampoline is given a substantial fee and time budget anyway.

The only thing needed is for Trampoline to allow prepending of onions, then even the payee gets privacy from the payer.

Regards, ZmnSCPxj

Quoted text (153 lines)
> [Resending in Plain Text. Sorry for the spam]
> Hello Konstantin,
>
> In asynchronous payments we want to be sure that there are only two states:
>
> 1.  Before B received the payment.
> 2.  After B received the payment.
>     In state 1), we want A to still have the control of the amount, and at
>     the same time we want to let B decide (until a certain timeout) to
>     receive the payment. In this state, S can only help B to be paid, or
>     cancel the whole transfer, but in this case, A cannot lose the amount.
>     In state 2), we want to be sure that no money is lost by S (and
>     consequently that the amount in A wallet is decremented by amt).
>     As ZmnSCPxj wrote in
>     https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2019/asynchronous-lightning-network-payments#m-6261934c
>     (as I understand the last sentences), there is no way to do that without
>     locking the amount.
>
>     In order to increase the privacy, we are improving the specification to
>     be be able to use several Rod nodes: a list of nodes chosen by the payer
>     and another list by the payee.
>     The Rod nodes are supposed to be almost always online, so standard https
>     can be used to communicate with them and between them.
>     --yas
>
>     On 29/10/2019 22:46, Konstantin Ketterer wrote:
>
>
> > Problem
> >
> > --------
> >
> > Currently, both parties have to be online at the same time to send/
> > receive money. This can be avoided by using something like the
> > Lightning Rod Protocol by Breez
> > (https://github.com/breez/LightningRod). However, funds have to be
> > locked up longer than usual. We can do better than that.
> >
> > Solution
> >
> > ---------
> >
> > The payer A pre-signs a transaction handing over money to their local
> > channel partner S and sends the transaction to the payee B in an end
> > to end encrypted communication channel. B can then sell the signature
> > for the transaction to S using pay-for-signature made possible by
> > payment points and scalars.
> > (https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2019/selling-signatures-another-reason-to-move-to-payment-points#m-e52a885b)
> > We will be using eltoo because we don't have to worry about toxic
> > channel states.
> > A and S are online, A and S have a channel
> >
> > 1.  A contacts S: they commit and exchange the R (= k*G) part of the
> >     Schnorr Signature for the update and settlement transaction
> >
> > 2.  A and S sign the settlement transaction increasing the balance
> >     between them by amt + fee in favor of S and exchange the signatures
> >
> > 3.  A signs the corresponding update transaction but does not give it so S
> > 4.  A sends the update transaction to B using an end to end encrypted
> >     asynchronous communication channel
> >
> >
> > A can go offline
> > B comes online
> >
> > 4.  Decrypts the update transaction and sells the signature s to S for amt
> >
> > When A comes back online S gives A the invoice (with the payment point
> > s*G) signed by B, the corresponding scalar s (the signature from A for
> > the update transaction) and signature from S for the update
> > transaction. They can now proceed as normal.
> > In addition to enabling asynchronous payments, this outsources the
> > routing to S.
> >
> > ### Potential issues
> >
> > #### Privacy
> >
> > S currently knows both the sender and the receiver of the payment. If
> > we split the payment from S to B into two payments between S and a
> > public routing node P and P and B by still using the same scalar +
> > payment point, S now only knows the sender and P only knows the
> > receiver. To further increase privacy we can split the payment
> > multiple times but all nodes involved must support this feature.
> >
> > #### Locked up capital
> >
> > While B hasn't yet claimed its money, the funds in the channel between
> > A and S are essentially locked up. However, A and S could simply
> > overwrite the payment (new update + settlement transaction), then A
> > could send multiple payments with the remaining balance and before
> > going offline A would do the procedure again. If A has sufficient
> > inbound capacity in other channels it can also re-balance its channel
> > A-S so that the outbound capacity - (amt + fees) in this channel is
> > zero and then do the procedure.
> >
> > #### Communication channel
> >
> > Obviously, the communication channel must be end to end encrypted
> > otherwise this is highly insecure. Hopefully, we will have a sort of
> > decentralized paid mail server system which is compatible across all
> > LN wallets and part of BOLT.
> >
> > #### Proof of payment
> >
> > The invoice by B with the payment point s*G and s are not sufficient
> > as a PoP because S can simply give A the invoice and A already knows s.
> >
> > the other way around
> >
> > ---------------------
> >
> > We can also do it in a way that A can instantly send B (who is
> > offline) money but now A is in charge of enforcing the channel state
> > if S cheats. Because it has more issues like who pays the transaction
> > fees if S cheats and because I believe Lightning is generally not
> > designed for people who are offline for a long time I prefer the first
> > one. But here is the other one:
> > B and S are online, B and S have a channel
> >
> > 1.  B and S sign a new settlement transaction increasing balance in
> >     favor of B by amt
> >
> > 2.  B signs the corresponding update transaction, encrypts it and sends
> >     it together with the settlement transaction to A
> >
> >
> > B can go offline
> > A comes online
> >
> > 3.  A decrypts the transactions, A pays S to sign the update
> >     transaction which makes this new channel state valid/ enforceable
> >
> > 4.  now A essentially acts like a watchtower while B is offline
> >
> > Conclusion
> >
> > -----------
> >
> > This enables truly asynchronous Lightning network payments and is yet
> > another reason to move to payment points and scalars.
> > Regards
> > Konstantin Ketterer
> > Github: https://github.com/ko-redtruck/async-payments-ln
> >
> > Lightning-dev mailing list
> > Lightning-dev at lists.linuxfoundation.org
> > https://www.learnbitcoin.com/archive/lists/lightning-dev
>
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
Yaacov Akiba Slama in reply to ZmnSCPxj permalink original

Good Morning ZmnSCPxj,

The problem with polling is that the payee can be online between two attempts and offline when the trampoline node polls. We need a way for the payee to notify the trampoline node when online. This is another reason to implement sooner than later messaging in LN. Meantime, other communication mechanisms need to be used. Thanks, --yas

On 04/11/2019 09:31, ZmnSCPxj wrote:

Quoted text (171 lines)
> Good morning Konstantin and yas,
>
> Indeed, yas is quite correct: the money is still locked, and all that this proposal adds is to limit the funds locked by having S be a direct peer of the payer.
> In the case proposed by Konstantin, this is simply locked between both A and S only, but it *must* be locked, or else timing shenanigans can be performed to defraud S.
>
>
> A proposal, is to add some sort of `please_poll` flag TLV to Trampoline onions, where if `please_poll` is enabled for a Trampoline node, it will perform the above-mentioned polling of once every 6 blocks.
> That way, any node that supports Trampoline *and* `please_poll` can work as an S (or Rod) for a possibly-offline next step.
>
> Alternatively, Trampoline implementations might actually just implement the polling behavior automatically without a `please_poll` flag; this might be viable especially if the Trampoline is given a substantial fee and time budget anyway.
>
>
> The only thing needed is for Trampoline to allow prepending of onions, then even the payee gets privacy from the payer.
>
>
> Regards,
> ZmnSCPxj
>
>> [Resending in Plain Text. Sorry for the spam]
>> Hello Konstantin,
>>
>> In asynchronous payments we want to be sure that there are only two states:
>>
>> 1.  Before B received the payment.
>> 2.  After B received the payment.
>>      In state 1), we want A to still have the control of the amount, and at
>>      the same time we want to let B decide (until a certain timeout) to
>>      receive the payment. In this state, S can only help B to be paid, or
>>      cancel the whole transfer, but in this case, A cannot lose the amount.
>>      In state 2), we want to be sure that no money is lost by S (and
>>      consequently that the amount in A wallet is decremented by amt).
>>      As ZmnSCPxj wrote in
>>      https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2019/asynchronous-lightning-network-payments#m-6261934c
>>      (as I understand the last sentences), there is no way to do that without
>>      locking the amount.
>>
>>      In order to increase the privacy, we are improving the specification to
>>      be be able to use several Rod nodes: a list of nodes chosen by the payer
>>      and another list by the payee.
>>      The Rod nodes are supposed to be almost always online, so standard https
>>      can be used to communicate with them and between them.
>>      --yas
>>
>>      On 29/10/2019 22:46, Konstantin Ketterer wrote:
>>
>>
>>> Problem
>>>
>>> --------
>>>
>>> Currently, both parties have to be online at the same time to send/
>>> receive money. This can be avoided by using something like the
>>> Lightning Rod Protocol by Breez
>>> (https://github.com/breez/LightningRod). However, funds have to be
>>> locked up longer than usual. We can do better than that.
>>>
>>> Solution
>>>
>>> ---------
>>>
>>> The payer A pre-signs a transaction handing over money to their local
>>> channel partner S and sends the transaction to the payee B in an end
>>> to end encrypted communication channel. B can then sell the signature
>>> for the transaction to S using pay-for-signature made possible by
>>> payment points and scalars.
>>> (https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2019/selling-signatures-another-reason-to-move-to-payment-points#m-e52a885b)
>>> We will be using eltoo because we don't have to worry about toxic
>>> channel states.
>>> A and S are online, A and S have a channel
>>>
>>> 1.  A contacts S: they commit and exchange the R (= k*G) part of the
>>>      Schnorr Signature for the update and settlement transaction
>>>
>>> 2.  A and S sign the settlement transaction increasing the balance
>>>      between them by amt + fee in favor of S and exchange the signatures
>>>
>>> 3.  A signs the corresponding update transaction but does not give it so S
>>> 4.  A sends the update transaction to B using an end to end encrypted
>>>      asynchronous communication channel
>>>
>>>
>>> A can go offline
>>> B comes online
>>>
>>> 4.  Decrypts the update transaction and sells the signature s to S for amt
>>>
>>> When A comes back online S gives A the invoice (with the payment point
>>> s*G) signed by B, the corresponding scalar s (the signature from A for
>>> the update transaction) and signature from S for the update
>>> transaction. They can now proceed as normal.
>>> In addition to enabling asynchronous payments, this outsources the
>>> routing to S.
>>>
>>> ### Potential issues
>>>
>>> #### Privacy
>>>
>>> S currently knows both the sender and the receiver of the payment. If
>>> we split the payment from S to B into two payments between S and a
>>> public routing node P and P and B by still using the same scalar +
>>> payment point, S now only knows the sender and P only knows the
>>> receiver. To further increase privacy we can split the payment
>>> multiple times but all nodes involved must support this feature.
>>>
>>> #### Locked up capital
>>>
>>> While B hasn't yet claimed its money, the funds in the channel between
>>> A and S are essentially locked up. However, A and S could simply
>>> overwrite the payment (new update + settlement transaction), then A
>>> could send multiple payments with the remaining balance and before
>>> going offline A would do the procedure again. If A has sufficient
>>> inbound capacity in other channels it can also re-balance its channel
>>> A-S so that the outbound capacity - (amt + fees) in this channel is
>>> zero and then do the procedure.
>>>
>>> #### Communication channel
>>>
>>> Obviously, the communication channel must be end to end encrypted
>>> otherwise this is highly insecure. Hopefully, we will have a sort of
>>> decentralized paid mail server system which is compatible across all
>>> LN wallets and part of BOLT.
>>>
>>> #### Proof of payment
>>>
>>> The invoice by B with the payment point s*G and s are not sufficient
>>> as a PoP because S can simply give A the invoice and A already knows s.
>>>
>>> the other way around
>>>
>>> ---------------------
>>>
>>> We can also do it in a way that A can instantly send B (who is
>>> offline) money but now A is in charge of enforcing the channel state
>>> if S cheats. Because it has more issues like who pays the transaction
>>> fees if S cheats and because I believe Lightning is generally not
>>> designed for people who are offline for a long time I prefer the first
>>> one. But here is the other one:
>>> B and S are online, B and S have a channel
>>>
>>> 1.  B and S sign a new settlement transaction increasing balance in
>>>      favor of B by amt
>>>
>>> 2.  B signs the corresponding update transaction, encrypts it and sends
>>>      it together with the settlement transaction to A
>>>
>>>
>>> B can go offline
>>> A comes online
>>>
>>> 3.  A decrypts the transactions, A pays S to sign the update
>>>      transaction which makes this new channel state valid/ enforceable
>>>
>>> 4.  now A essentially acts like a watchtower while B is offline
>>>
>>> Conclusion
>>>
>>> -----------
>>>
>>> This enables truly asynchronous Lightning network payments and is yet
>>> another reason to move to payment points and scalars.
>>> Regards
>>> Konstantin Ketterer
>>> Github: https://github.com/ko-redtruck/async-payments-ln
>>>
>>> Lightning-dev mailing list
>>> Lightning-dev at lists.linuxfoundation.org
>>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>> Lightning-dev mailing list
>> Lightning-dev at lists.linuxfoundation.org
>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>