LightningRod
LightningRod copied to clipboard
Async Lightning payments protocol
Introduction
In order to make a payment transaction between two Lightning Network nodes, the two nodes need to be online.
This restriction presents a challenge when the two nodes are not always online, for instance in the case of mobile devices.
The proposed protocol is a way to circumvent this limitation by using LSPs which are always online and can intercept incoming/outgoing HTLCs and break the payment flow to an asynchronous flow (payer and the payee are don't have to be simultaneously online). LSPs have also the advantage of being able to send notifications to their users.
It's an attempt to formalize a solution proposed by Matt Corallo here.
Protocol
Definitions
A: the payer which is not always online.B: the payee which is not always online.LSP_a(respLSP_b): the LSP thatA(respB) is connected to.
Notifications
A(respB) can register itself using a platform dependantdeviceid_a(respdevideid_b) toLSP_a(respLSP_b).LSP_a(respLSP_b) can usedeviceid_a(respdevideid_b) to send a notification toA(respB) in order to askA(respB) to go online.- We assume here that
LSP_a(respLSP_b) sends a notification toA(respB) in the following case:- when an Onion Message needs to be forwarded to
A(respB). - when an preimage needs to be sent to
Ain order to settle a payment.
- when an Onion Message needs to be forwarded to
Payment Workflow
A wants to pay amt to B using an invoice created by B and with a payment_hash h - this can be the result of an offer message. Naturally,A is online, but B may be offline.
Agenerates a secret payment idpid.Asends a onion message toLSP_a, asking it to intercept and block the HTLC for the payment with the payment_hashh. This can be a list of payment_hashes when the payment usesMPP.Asends the payment with the payment_hashhtoB.LSP_aintercepts and blocks the HTLC(s).Asends an onion message toB, containingpid.Acan go offline.LSP_bnotifiesB.Bgoes online.Bsends a message toAwith apidvalue for the fieldpayment_unblockin theencrypted_data_tlvtlvstream forLSP_aLSP_aintercepts this message and unblocks the HTLC(s) which reachesB.Bsettles the payment and sends back the preimage corresponding toh.- When the preimage reaches
LSP_a, it notifiesA, so whenAis back online it finally settles the payment.
