pull down to refresh

Send your message, no email required

I don't like contact pages. Either they rely on ugly forms that get dumped into databases and are full of spam or they force you to open a popup or an email client. Sometimes they just leave it up to you to copy and paste the email or whatever.

I have therefore taken up the vibecoder's mantle and made myself a contact page that let's you send an encrypted DM to my npub directly from the page. Is this much better than traditional contact pages? Not sure. But it is kinda cool that I can get my Contact Page form submissions in my nostr client.

While not exactly revolutionary, I also like that it makes it so I don't have to use email.

Make them pay

...and it also allows me to require that you pay 21 sats before the send button unlocks.

The page still mostly relies on cloudflare for rate-limiting, but my goal (in the long run) is to use the sats payment instead of any kind of captcha or rate-limiting. I think I'm pretty far away from achieving this at the moment, but someday I'm hoping to run this site using sats as the primary defense.

I think the flow still needs some work, so I'm curious to hear your suggestions there.

The hardest part of this was verifying that the lightning payment actually took place.

At first I was going to use LNBits or I thought perhaps Lexe's sidecar functionality would work for me or even phoenixd. But all of these make me a little nervous and sound like overkill for what I'm want to achieve.

So then it occurred to me that I could try to use a nostr zap...except those can be faked.

As far as I understand, nostr zaps do not necessarily check to see if the lightning invoice was actually paid. They mostly check to see if a lightning invoice was created and, if you are zapping a lightning address, nostr trusts on the lnurl provider to confirm that the zap happened.

(I have long wanted to make myself a nostr client that relies on my own lnurl server and lets me zap myself 42 million bitcoin, but unfortunately, this is not at the top of my priority list.)

But...for the purposes of my little contact page, trusting my LNURL provider seems a worthwhile trade-off (especially since it is SN).

So, the current way my contact I've made page works (or is supposed to work) is that it creates a zap request tied to my npub and then checks to see if my LNURL server verifies that the zap has taken place, and only then does it let you send the DM.

Questions

  • Obviously, my npub is publicly known and I'm currently using this known npub for the contact page, but I think it's possible to set this up so that it uses an npub that is not publicly associated with me and that therefore makes it more difficult to reach this "secret" npub.
  • @MaxFangX suggested I use LNURL-verify -- do you think there's a more streamlined way to achieve a payment gated message?
  • are payment-gated contact pages just a bad idea? (Last time I asked about it, the SN opinion was negative #1231355)

Sent a message....

reply

Interesting. Yours is different than the expected outcome.

reply

What was the expected outcome?

reply

Mostly, when people click send, I see a zap and then a nostr DM. In your case I only see the zap.

reply

my message was "hello from simplestacker". did you get that?

reply

No, so something must be wrong on my end.

It still works when I teat it. I wonder of the relays had a hiccup when you sent.

reply

I tried again, but didn't get the "message sent" confirmation that others got below. Didn't get it the first time either. Did get a "payment received" on the page.

Also here's the log

Payment and relay diagnostics

6:16:16 PM Cloudflare registered payment attempt d4185ab0-371f-4a72-a4d8-84e8f9735ae1
6:16:16 PM Created request 49ab645536d0f0b36f16821aa4312355e8ad2b81c90708a1d934a8dba281d707
6:16:16 PM Connected to receipt relay wss://relay.damus.io
6:16:17 PM Connected to receipt relay wss://relay.primal.net
6:16:30 PM Checking receipt 40dd93b14c26e142829b68685cc6545fad819a976d7e86631e72799b6cd154b9 with Cloudflare (wss://relay.primal.net)
6:16:31 PM Cloudflare confirmed payment in D1.
reply

Thanks for trying again. I see the payments and even the zaps in my nostr client, but no message.

There must be something weird going on with the message sending part.

Its helpful to know that its not showing you message sent. I need to see what check that requires.

Edit: I think it may be that my script tries to create the nip17 message is doing something wrong in your browser.

Sent a message hopefully you got it!

reply

received!

Currently, it creates a throwaway nostr keypair for you when you send me a message, so I only know what a person tells me.

I could see a world where I let people use their own keypairs, but what I like about this throwaway method is taht you don't need to know that you are using nostr or anything. it's just sending me a message.

reply

Indeed I’ll keep this handy to contact you!

reply

Nice work ser 🫡

reply

received! glad to see it works!

reply
4 sats \ 0 replies \ @06bc1a977d 30 Oct -23 sats

The post is about a contact page that uses nostr DMs with a 21-sat zap requirement to unlock sending. Over on /~lightning/r/06bc1a977d people argue about this constantly.

226 sats \ 10 replies \ @justin_shocknet 30 Oct -420 sats
verifying the payment

Shame for not CLINK maxxing

Disabling the send button doesn't do much, need a whitelist only relay you listen for DMs on, payment whitelists the sender (CLINK fired hook to strfry plugin)