Why Nostr? What is Njump?
Kind 30818
This is a wiki article about NIP-61: Nutzaps You can read it on https://wikifreedia.xyz/a/naddr1qvzqqqrcvgpqqqgmwaehxw309a6xsetxdaex2um59ehx7um5wgcjucm0d5hsqrtrv9eksafd0fshqttwd9cqhxsfr4
Author Public Key
npub1l2vyh47mk2p0qlsku7hg0vn29faehy9hy34ygaclpn66ukqp3afqutajft
Published at
2024-08-07 13:31:09
Kind type
30818
Event JSON
{ "id": "24dc5c4e46420a63544d2f0fcae958456f3a5940ebcf9767f65be043f5c6d509", "pubkey": "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52", "created_at": 1723037469, "kind": 30818, "tags": [ [ "d", "cashu-zap-nip" ], [ "client", "wikifreedia", "31990:fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52:1716498133442" ], [ "alt", "This is a wiki article about NIP-61: Nutzaps\n\nYou can read it on https://wikifreedia.xyz/a/naddr1qvzqqqrcvgpqqqgmwaehxw309a6xsetxdaex2um59ehx7um5wgcjucm0d5hsqrtrv9eksafd0fshqttwd9cqhxsfr4" ], [ "title", "NIP-61: Nutzaps" ], [ "c", "Nostr" ], [ "published_at", "1723037469" ] ], "content": "# NIP-61:\n## Nut Zaps\n\nA Nut Zap is a P2PK cashu token where the payment itself is the receipt.\n\n# High-level flow\nAlice wants to nutzap 1 sat to Bob because of an event `event-id-1` she liked.\n\n## Alice nutzaps Bob\n1. Alice fetches event `kind:10019` from Bob to see the mints Bob trusts.\n2. She mints a token at that mint (or swaps some tokens she already had in that mint) p2pk-locked to the pubkey Bob has listed in his `kind:10019`.\n3. She publishes a `kind:9321` event to the relays Bob indicated with the proofs she minted.\n\n## Bob receives the nutzap\n1. At some point, Bob's client fetches `kind:9321` events p-tagging him from his relays.\n2. Bob's client swaps the token into his wallet.\n\n# Nutzap informational event\n```jsonc\n{\n \"kind\": 10019,\n \"tags\": [\n [ \"relay\", \"wss://relay1\" ],\n [ \"relay\", \"wss://relay2\" ],\n [ \"mint\", \"https://mint1\", \"usd\", \"sat\" ],\n [ \"mint\", \"https://mint2\", \"sat\" ],\n [ \"pubkey\", \"\u003cp2pk-pubkey\u003e\" ]\n ]\n}\n```\n\n`kind:10019` is an event that is useful for others to know how to send money to the user.\n\n* `relay` - Relays where the user will be reading token events from. If a user wants to send money to the user, they should write to these relays.\n* `mint` - Mints the user is explicitly agreeing to use to receive funds on. Clients SHOULD not send money on mints not listed here or risk burning their money. Additional markers can be used to list the supported base units of the mint.\n* `pubkey` - Pubkey that SHOULD be used to P2PK-lock receiving nutzaps. If not present, clients SHOULD use the pubkey of the recipient. This is explained in Appendix 1.\n\n## Nutzap event\nEvent `kind:9321` is a nutzap event published by the sender, p-tagging the recipient. The outputs are P2PK-locked to the pubkey the recipient indicated in their `kind:10019` event or to the recipient pubkey if the `kind:10019` event doesn't have a explicit pubkey.\n\nClients MUST prefix the pubkey they p2pk-lock with `\"02\"` (for nostr\u003c\u003ecashu pubkey compatibility).\n\n```jsonc\n{\n kind: 9321,\n content: \"Thanks for this great idea.\",\n pubkey: \"sender-pubkey\",\n tags: [\n [ \"amount\", \"1\" ],\n [ \"unit\", \"sat\" ],\n [ \"proof\", \"{\\\"amount\\\":1,\\\"C\\\":\\\"02277c66191736eb72fce9d975d08e3191f8f96afb73ab1eec37e4465683066d3f\\\",\\\"id\\\":\\\"000a93d6f8a1d2c4\\\",\\\"secret\\\":\\\"[\\\\\\\"P2PK\\\\\\\",{\\\\\\\"nonce\\\\\\\":\\\\\\\"b00bdd0467b0090a25bdf2d2f0d45ac4e355c482c1418350f273a04fedaaee83\\\\\\\",\\\\\\\"data\\\\\\\":\\\\\\\"02eaee8939e3565e48cc62967e2fde9d8e2a4b3ec0081f29eceff5c64ef10ac1ed\\\\\\\"}]\\\"}\" ],\n [ \"u\", \"https://stablenut.umint.cash\", ],\n [ \"e\", \"\u003czapped-event-id\u003e\", \"\u003crelay-hint\u003e\" ],\n [ \"p\", \"e9fbced3a42dcf551486650cc752ab354347dd413b307484e4fd1818ab53f991\" ], // recipient of nut zap\n ]\n}\n```\n\n* `.content` is an optional comment for the nutzap\n* `amount` is a shorthand for the combined amount of all outputs. -- Clients SHOULD validate that the sum of the amounts in the outputs matches.\n* `unit` is the base unit of the amount.\n* `proof` is one ore more proofs p2pk-locked to the pubkey the recipient specified in their `kind:10019` event.\n* `u` is the mint the URL of the mint EXACTLY as specified by the recipient's `kind:10019`.\n* `e` zero or one event that is being nutzapped.\n* `p` exactly one pubkey, specifying the recipient of the nutzap.\n\nWIP: Clients SHOULD embed a DLEQ proof in the nutzap event to make it possible to verify nutzaps without talking to the mint.\n\n# Sending a nutzap\n\n* The sender fetches the recipient's `kind:10019`.\n* The sender mints/swaps ecash on one of the recipient's listed mints.\n* The sender p2pk locks to the recipient's specified pubkey in their\n\n# Receiving nutzaps\n\nClients should REQ for nut zaps:\n* Filtering with `#u` for mints they expect to receive ecash from.\n * this is to prevent even interacting with mints the user hasn't explicitly signaled.\n* Filtering with `since` of the most recent `kind:7376` event the same user has created.\n * this can be used as a marker of the nut zaps that have already been swaped by the user -- clients might choose to use other kinds of markers, including internal state -- this is just a guidance of one possible approach.\n\nClients MIGHT choose to use some kind of filtering (e.g. WoT) to ignore spam.\n\n`{ \"kinds\": [9321], \"#p\": \"my-pubkey\", \"#u\": [ \"\u003cmint-1\u003e\", \"\u003cmint-2\u003e\"], \"since\": \u003clatest-created_at-of-kind-7376\u003e }`.\n\nUpon receiving a new nut zap, the client should swap the tokens into a wallet the user controls, either a [[NIP-60]] wallet, their own LN wallet or anything else.\n\n## Updating nutzap-redemption history\nWhen claiming a token the client SHOULD create a `kind:7376` event and `e` tag the original nut zap event. This is to record that this token has already been claimed (and shouldn't be attempted again) and as signaling to the recipient that the ecash has been redeemed.\n\nMultiple `kind:9321` events can be tagged in the same `kind:7376` event.\n\n```jsonc\n{\n \"kind\": 7376,\n \"content\": nip44_encrypt([\n [ \"direction\", \"in\" ], // in = received, out = sent\n [ \"amount\", \"1\", \"sat\" ],\n [ \"e\", \"\u003c7375-event-id\u003e\", \"relay-hint\", \"created\" ] // new token event that was created\n ]),\n \"tags\": [\n [ \"a\", \"37375:\u003cpubkey\u003e:my-wallet\" ], // an optional wallet tag\n [ \"e\", \"\u003c9321-event-id\u003e\", \"relay-hint\", \"redeemed\" ], // nutzap event that has been redeemed\n [ \"p\", \"sender-pubkey\" ] // pubkey of the author of the 9321 event (nutzap sender)\n ]\n}\n```\n\nEvents that redeem a nutzap SHOULD be published to the sender's [[NIP-65]] relays.\n\n## Verifying a Cashu Zap\n* Clients SHOULD check that the receiving user has issued a `kind:10019` tagging the mint where the cashu has been minted.\n* Clients SHOULD check that the token is locked to the pubkey the user has listed in their `kind:10019`.\n\n## Final Considerations\n\n1. Clients SHOULD guide their users to use NUT-11 (P2PK) compatible-mints in their `kind:10019` event to avoid receiving nut zaps anyone can spend\n\n2. Clients SHOULD normalize and deduplicate mint URLs as described in NIP-65.\n\n3. A nut zap MUST be sent to a mint the recipient has listed in their `kind:10019` event or to the NIP-65 relays of the recipient, failure to do so may result in the recipient donating the tokens to the mint since the recipient might never see the event.\n\n## Appendix 1: Alternative P2PK pubkey\nClients might not have access to the user's private key (i.e. NIP-07, NIP-46 signing) and, as such, the private key to sign cashu spends might not be available, which would make spending the P2PK incoming nutzaps impossible.\n\nFor this scenarios clients can:\n\n* add a `pubkey` tag to the `kind:10019` (indicating which pubkey senders should P2PK to)\n* store the private key in the `kind:37375` event in the nip44-encrypted `content` field.\n\nThis is to avoid depending on NIP-07/46 adaptations to sign cashu payloads.", "sig": "d0ac9eff0a7f674fe689feec0320d55c0de6ecfc2b59b9143183f7e8a81ef4bfc31cc2f0fd60a195e3cf0cd5832f303bc2ea577ba9844939841a22486967fdb0" }