Research/Bitcoin Dev Archive / lightning-dev list
Sphinx and Push Notifications
4 messages, Feb 2 to 4, 2020. Started by Pavol Rusnak.
Pavol Rusnak, Antoine Poinsot, Johan Torås Halseth, Christian Decker
Hi all!
I have a couple of unrelated questions, hope you can give me some pointers.
1) Is c-lightning going to support Sphinx or other form of spontaneous payments?
2) Can a lightning node (such as lnd or c-lightning) send a push notification (e.g. to a webhook) when it receives or routes a payment? If yes, is this notification cryptographically signed (for example with the node's private key)? Is this documented somewhere?
Thanks!
Hi Pavol,
Quoted text (1 line)
> 1) Is c-lightning going to support Sphinx or other form of spontaneous payments?
I think cdecker is working on integrating keysend to his noise plugin (https://github.com/lightningd/plugins/pull/68).
Quoted text (1 line)
> 2) Can a lightning node (such as lnd or c-lightning) send a push notification (e.g. to a webhook) when it receives or routes a payment? If yes, is this notification cryptographically signed (for example with the node's private key)? Is this documented somewhere?
C-lightning sends notifications (and hooks, but it doesn't seem to be your usecase here) for typical events such as "I received an HTLC !". You can make a plugin which registers to these lightningd notifications sends encrypted push notifs. Doc here https://lightning.readthedocs.io/PLUGINS.html#event-notifications :-).
Darosior
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ Le dimanche, février 2, 2020 1:39 PM, Pavol Rusnak via Lightning-dev <lightning-dev at lists.linuxfoundation.org> a écrit :
Quoted text (15 lines)
> Hi all! > > I have a couple of unrelated questions, hope you can give me some pointers. > > 1) Is c-lightning going to support Sphinx or other form of spontaneous payments? > > 2) Can a lightning node (such as lnd or c-lightning) send a push notification (e.g. to a webhook) when it receives or routes a payment? If yes, is this notification cryptographically signed (for example with the node's private key)? Is this documented somewhere? > > Thanks! > > -- > Best Regards / S pozdravom, > > Pavol "stick" Rusnak > CTO, SatoshiLabs
2) lnd is getting the API you need in the next release (v0.10), that let you subscribe to HTLC events. See PR https://github.com/lightningnetwork/lnd/pull/3848. The notification won't be signed (but the stream uses TLS), but that can easily be added using the `signmessage` API: https://api.lightning.community/#signmessage
Cheers, Johan
On Sun, Feb 2, 2020 at 1:46 PM Pavol Rusnak via Lightning-dev <lightning-dev at lists.linuxfoundation.org> wrote:
Quoted text (20 lines)
> > Hi all! > > I have a couple of unrelated questions, hope you can give me some pointers. > > 1) Is c-lightning going to support Sphinx or other form of spontaneous payments? > > 2) Can a lightning node (such as lnd or c-lightning) send a push notification (e.g. to a webhook) when it receives or routes a payment? If yes, is this notification cryptographically signed (for example with the node's private key)? Is this documented somewhere? > > Thanks! > > -- > Best Regards / S pozdravom, > > Pavol "stick" Rusnak > CTO, SatoshiLabs > _______________________________________________ > Lightning-dev mailing list > Lightning-dev at lists.linuxfoundation.org > https://www.learnbitcoin.com/archive/lists/lightning-dev
darosior via Lightning-dev <lightning-dev at lists.linuxfoundation.org> writes:
Quoted text (7 lines)
> Hi Pavol, > >> 1) Is c-lightning going to support Sphinx or other form of >> spontaneous payments? > > I think cdecker is working on integrating keysend to his noise plugin > (https://github.com/lightningd/plugins/pull/68).
The keysend functionality is implemented in the noise plugin and I am planning to pull the keysend part out of the plugin, since that part is really trivial to implement (`htlc_accepted` hook that checkes the payment_hash against the preimage in the onion, then tell `lightningd` to resolve directly).
As a side note: Sphinx-send is a terrible misnomer, since sphinx is the name of our onion construction, keysend is the proper name to use in this case.
Quoted text (10 lines)
>> 2) Can a lightning node (such as lnd or c-lightning) send a push >> notification (e.g. to a webhook) when it receives or routes a >> payment? If yes, is this notification cryptographically signed (for >> example with the node's private key)? Is this documented somewhere? > > C-lightning sends notifications (and hooks, but it doesn't seem to be > your usecase here) for typical events such as "I received an HTLC > !". You can make a plugin which registers to these lightningd > notifications sends encrypted push notifs. Doc here > https://lightning.readthedocs.io/PLUGINS.html#event-notifications :-).
You can have a plugin subscribe to HTLC related events (such as `forward_event` [1], or `invoice_payment` [2], to get notified about forwardings or invoices being paid. What you do with that notification then is up to you. It could queue the event in kafka, call out to a webhook, or log a message with a log management system. You can arbitrarily transform the event in the plugin, including issuing calls to `signmessage` which will create a signature for the event message, thus allowing you to prove authenticity of the message. You'd most likely need to canonicalize the message before signing, since JSON is not the best format for canonical serialization, i.e., decoding and re-encoding can result in subtle changes, which could then fail signature verification, but that should not be a major issue.
Cheers, Christian