python-nostr icon indicating copy to clipboard operation
python-nostr copied to clipboard

[Feature Request] Add Support for Nostr Zaps

Open steveboi123 opened this issue 2 years ago • 4 comments

Hi,

Would it be possible to add support for Nostr Zaps? Seems very useful.

steveboi123 avatar Feb 24 '23 03:02 steveboi123

I'd love to look into this. It seems NIP-57 covers some things about Zaps: https://github.com/nostr-protocol/nips/blob/master/57.md

I'm not yet sure how to get profile information about a pubkey in order to get the needed info to send a zap.

PlebeiusGaragicus avatar May 07 '23 01:05 PlebeiusGaragicus

Ok - I figured out how to get info from a pubkey #82.

{
    "banner": "https://nostr.build/i/nostr.build_c91bc3ae722fb9b808227c37772b1df9d829173bb56193871048baffc47d9e8f.jpeg",
    "website": "",
    "lud16": "[email protected]",
    "picture": "https://nostr.build/i/nostr.build_eb1cd3b4c84aa4a354647ddcaf5bfe13bb26761caf55d00e057b9287531e4490.jpeg",
    "display_name": "Plebeius Garagicus",
    "about": "Inspiring the next generation to build open-source #bitcoin software for the benefit of all\n\nhttps://github.com/PlebeiusGaragicus",
    "name": "PlebeiusG"
}

So now if someone has a lightning address setup we can fetch it.

Next I need to figure out how to initiate a zap...

PlebeiusGaragicus avatar May 07 '23 06:05 PlebeiusGaragicus

Ok - also refer to LUD-16: Paying to static internet identifiers.

First, we convert the LUD and send a GET request to the resulting URL

Then, after receiving the callback URL we draft an event of kind 9734 with details about our zap

Next, we sign our drafted zap request and sent it to the callback URL.

The callback URL should return an LNURL (I think) which will be the lightning invoice we then need to pay.

So, we are able to convert, for example, an lud16 of "[email protected]" into what appears to be an LNURL: lnbc10u1pj9lu24pp5xkeezk8gky ... v3gz2hhzhngpc4umnv

Next, I need to figure out how to use LND (or something similar) to pay this invoice...

There's also mention of publishing a zap receipt so that nostr relays are able to tell who zapped whom and talley total sats, etc.

PlebeiusGaragicus avatar May 13 '23 20:05 PlebeiusGaragicus

@PlebeiusGaragicus are you able to make a Pull Request with your implementation?

steveboi123 avatar May 13 '23 21:05 steveboi123