-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add support for Nostr Zaps #9
Conversation
Pending blc-org/una#37. |
Also pending jb55/nostr-js#11, currently the zap request signature is not verified. |
This is fine to run on LND unless you have |
Does this work if I run the branch or do I need to wait for the issues you mentioned to get fixed as well? |
I ran into a problem because of The other issue is that it currently doesn't verify the signature on the zap request. |
Each new zap will create a zap request Lines 76 to 78 in 216d0e2
which the server will remember (i.e. store in RAM) until it either expires or is paid. What is preventing someone from DDoS-ing via an endless stream of zap requests? |
Good point, although this is already a DDoS vector for any lightning address handler. I don't see a rate limit option, as one can generate a new pubkey for every request and make valid zap requests. A simple way of at least preventing OOM would be to define a max number of entries and remove them FIFO. |
Hey, thanks for your work, this is truly amazing! Got it the zaps to work. To the other rookies out there, these are some steps I had to do additionally to the README.md instructions (other than checking out the specific pull request (ID=9) from github):
Remember to use HEX (!) values for the macaroons and nostr private key. Again, thank you so much, this is fun! |
@mutatrum yes, configuring a "max number of pending zaps" limit can defend against OOM. But ironically that enables another kind of DoS attack, whereby the attacker floods with enough requests to reach that limit. At that point, nobody else can zap to this receiver. Is there a way to defend against that? There's a similar thread in the BTCPay repo: btcpayserver/btcpayserver#4642 (reply in thread) |
I used npm for the install, and that was a straightforward Adding support for npriv and custom ports can be done, but probably outside the scope on the current PR. Both are trivial to add but I don't want to make this changeset much larger. |
Not that I can think of, other than rate-limiting the HTTP requests, the rest is trivial to generate. Either way at some point the service will be unavailable during the attack, but that's the nature of open internet I guess. Thanks for the thread link, added a comment there. |
Looking at the relevant code: Line 75 in d8c7162
You should be able to change the binding port by passing the environment variable PORT=<some other port other than the default(3000)> |
Can confirm the zaps are working here, it's running now for two days. Some people had some errors but I think it's due their used clients. Still debugging with them but nothing has come out relevant for this integration of zaps. |
Some clients are buggy. I just had a zap request without any relays, so it didn't send the zap note. |
It's working for me: note17pfxx953dym0lzlf5flxu6ztdnjgdfqsuk83ghu7f9fmxv0vkmvq0dglaf |
Should it return an error if the zap request fails any of the verifications? Currently it logs the issue, but still creates the invoice. Problem with this is that it leads to silent failures of zaps not working. Upside is that even with buggy implementations, payment will work, just not the zap. |
All all pending PRs have been resolved and dependencies have been bumped. I also changed the error handling to return an error on any invalid zap requests. Running this version now, to see if anything weird pops up. |
No description provided.