What is Nostr?
Rizful.com
npub1jlu…p2kq
2025-02-13 01:26:29

Rizful.com on Nostr: Super Testnet and Not Semisol 👨‍💻 and nostrband I'm tagging you because I ...

Super Testnet (npub1yxp…399s) and Not Semisol 👨‍💻 (npub1sy5…dhej) and nostrband (npub1kwh…9h5l)

I'm tagging you because I think you will most efficiently be able to tell me if I've confusing myself or if I have actually discovered an issue in the ZAP spec , nip-57 ... https://github.com/nostr-protocol/nips/blob/master/57.md ..

I am finding that when the SENDER of a zap has configured too many relays... like 10+.... then when the SENDER constructs the zap note...

https://github.com/nostr-protocol/nips/blob/6e7a618e7f873bb91e743caacc3b09edab7796a0/57.md?plain=1#L31


.... the zap note can get TOO LONG.

Because, according to the spec, the recipient's server must do this:

"the server should fetch a description hash invoice where the description is this zap request note and this note only"

https://github.com/nostr-protocol/nips/blob/6e7a618e7f873bb91e743caacc3b09edab7796a0/57.md?plain=1#L19

in other words: we need to stuff the text of this note into the description field of the invoice!

... so what happens if there are too many relays is that this note gets to be TOO LONG, and when we ask LND to make the invoice, we get...

Error creating invoice: [
503,
'AddInvoiceError',
{
err: Error: 2 UNKNOWN: memo too large: 1097 bytes (maxsize=1024)

This might seem like a theoretical problem but I can reproduce the issue by using #coracle ... adding a bunch of relays manually, and then trying to zap a note whose recipient is using an LND node... I can see that the LND node fails to generate the invoice with a "AddInvoiceError" ("memo too large").
And then, to make the problem go away, I can go back to Coracle, reduce my number of relays, and then I can send zaps fine, because the descriptions fall under LND's max-length.....

Now, of course, I could go and ask LND "why don't you allow bigger memos/descriptions" -- but, my guess is that you could do a denial of service attack against a lightning node by requesting a shit-ton of invoices with really big memos... at least you could fill up that node's database, right?

So, please tell me: Am I a pitifully confused developer, or did I discover something that needs to be added/fixed in the nip-57 spec, like should the spec say "Hey, if you are developing a client which is constructing zap requests, if your user has a ton of relays, cool, but don't put more than 4 relays into the zap note..."...

Or, am I just confusing myself and/or reading/implementing the spec, wrong? Or taking too many marijuana edibles?


thanks
Author Public Key
npub1jluy3twvf338v6zlujzzdhjkzjy8ezj34ksydr8vw8a6jwp89ygshpp2kq