-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Method for retrieving past payment preimages #25
Comments
Here's a use case for retrieving payment preimages: At Suredbits, we are working on APIs that require payment over LN, but send the data before payment is made. The data is sent encrypted, and the decryption key is the payment preimage. We're working on including this in our online API explorer. It'd be very cool to be able to receive an encrypted blob of information + an invoice, and then decrypt the information locally after the invoice is paid. One simple thing that would help with this use case is simply returning the preimage in the response when paying an invoice. I don't really see any downsides to this. For looking up past preimages it would make sense to be able to query by payment hash/invoice, IMO. |
I see now that Lightning Joule returns the preimage when paying an invoice: webln.sendPayment("lnbc100n1pw5q727pp594697u97esh5uau7vj42z7u4z4vdk2lzm4yj3k2u5y0fzt3cfl3sd8y0v3xgatjv96xjmmwygarydfsxqczcgnrdpskumn9ds3r5gn5d93kketjwv3zcgn9wejkuapz8g38xatzwd3hy6tzv53zcgn4w45kgg36yf3rwdfnxcexgdedvscnqc3dxsmxzcfd893kyvfdx4jkxwp4xdnrzcf4xsmzytpzv4uxx6rpdenk2g36yf3xjardv4uzytpzwduk6cn0ds3r5gj923y9256yyf7sxqrrsswzcgdts9fpr8v0l4ac7rk7v9n65ghk5yxgkemh5z85fn3q6j63s9udrnfe8h78lf2ywl9248ampuk9c3zyus6v3ukemk85ewtmvngrcq76nges").then(res => console.log("send payment result: %O", res))
send payment result:
Object { preimage: "4fcd6da9c87220276626bb7c9b347b583333103ed2857bdc14e7891d483cf670" } This does not seem to line up with what's on webln.dev: https://webln.dev/#/api/send-payment Am I misunderstanding something here? |
Looks like that's a misdocumentation, sorry about that. The typescript types show the real truth of it: https://github.com/joule-labs/webln/blob/master/src/provider.ts#L15-L17 |
Maintaining lightning purchases in a decentralized way has been a big use case for WebLN for me, but going the node identity route poses some obvious privacy issues (that I appreciate everyone raising concerns about!) However, with preimages, we can provide proof that we paid for something without revealing our node. Distilling this process into a WebLN method could allow for accessing things we've paid for while maintaining our anonymity.
This poses a few problems though:
I'd be interested to hear if anyone has particular suggestions around these issues, or of there's anything coming up around the protocol to make this use-case easier.
The text was updated successfully, but these errors were encountered: