upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/61.md
diff options
context:
space:
mode:
Diffstat (limited to '61.md')
-rw-r--r--61.md26
1 files changed, 15 insertions, 11 deletions
diff --git a/61.md b/61.md
index ebb8af3..5842d6b 100644
--- a/61.md
+++ b/61.md
@@ -8,19 +8,19 @@ Nutzaps
8 8
9A Nutzap is a P2PK Cashu token in which the payment itself is the receipt. 9A Nutzap is a P2PK Cashu token in which the payment itself is the receipt.
10 10
11# High-level flow 11## High-level flow
12Alice wants to nutzap 1 sat to Bob because of an event `event-id-1` she liked. 12Alice wants to nutzap 1 sat to Bob because of an event `event-id-1` she liked.
13 13
14## Alice nutzaps Bob 14### Alice nutzaps Bob
151. Alice fetches event `kind:10019` from Bob to see the mints Bob trusts. 151. Alice fetches event `kind:10019` from Bob to see the mints Bob trusts.
162. 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`. 162. 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`.
173. She publishes a `kind:9321` event to the relays Bob indicated with the proofs she minted. 173. She publishes a `kind:9321` event to the relays Bob indicated with the proofs she minted.
18 18
19## Bob receives the nutzap 19### Bob receives the nutzap
201. At some point, Bob's client fetches `kind:9321` events p-tagging him from his relays. 201. At some point, Bob's client fetches `kind:9321` events p-tagging him from his relays.
212. Bob's client swaps the token into his wallet. 212. Bob's client swaps the token into his wallet.
22 22
23# Nutzap informational event 23## Nutzap informational event
24```jsonc 24```jsonc
25{ 25{
26 "kind": 10019, 26 "kind": 10019,
@@ -39,7 +39,7 @@ Alice wants to nutzap 1 sat to Bob because of an event `event-id-1` she liked.
39* `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. 39* `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.
40* `pubkey`: Public key that MUST be used to P2PK-lock receiving nutzaps -- implementations MUST NOT use the target user's main Nostr public key. This public key corresponds to the `privkey` field encrypted in a user's [nip-60](60.md) _wallet event_. 40* `pubkey`: Public key that MUST be used to P2PK-lock receiving nutzaps -- implementations MUST NOT use the target user's main Nostr public key. This public key corresponds to the `privkey` field encrypted in a user's [nip-60](60.md) _wallet event_.
41 41
42## Nutzap event 42### Nutzap event
43Event `kind:9321` is a nutzap event published by the sender, p-tagging the recipient. The outputs are P2PK-locked to the public key the recipient indicated in their `kind:10019` event. 43Event `kind:9321` is a nutzap event published by the sender, p-tagging the recipient. The outputs are P2PK-locked to the public key the recipient indicated in their `kind:10019` event.
44 44
45Clients MUST prefix the public key they P2PK-lock with `"02"` (for nostr<>cashu compatibility). 45Clients MUST prefix the public key they P2PK-lock with `"02"` (for nostr<>cashu compatibility).
@@ -51,8 +51,10 @@ Clients MUST prefix the public key they P2PK-lock with `"02"` (for nostr<>cashu
51 "pubkey": "<sender-pubkey>", 51 "pubkey": "<sender-pubkey>",
52 "tags": [ 52 "tags": [
53 [ "proof", "{\"amount\":1,\"C\":\"02277c66191736eb72fce9d975d08e3191f8f96afb73ab1eec37e4465683066d3f\",\"id\":\"000a93d6f8a1d2c4\",\"secret\":\"[\\\"P2PK\\\",{\\\"nonce\\\":\\\"b00bdd0467b0090a25bdf2d2f0d45ac4e355c482c1418350f273a04fedaaee83\\\",\\\"data\\\":\\\"02eaee8939e3565e48cc62967e2fde9d8e2a4b3ec0081f29eceff5c64ef10ac1ed\\\"}]\"}" ], 53 [ "proof", "{\"amount\":1,\"C\":\"02277c66191736eb72fce9d975d08e3191f8f96afb73ab1eec37e4465683066d3f\",\"id\":\"000a93d6f8a1d2c4\",\"secret\":\"[\\\"P2PK\\\",{\\\"nonce\\\":\\\"b00bdd0467b0090a25bdf2d2f0d45ac4e355c482c1418350f273a04fedaaee83\\\",\\\"data\\\":\\\"02eaee8939e3565e48cc62967e2fde9d8e2a4b3ec0081f29eceff5c64ef10ac1ed\\\"}]\"}" ],
54 [ "unit", "sat" ],
54 [ "u", "https://stablenut.umint.cash" ], 55 [ "u", "https://stablenut.umint.cash" ],
55 [ "e", "<nutzapped-event-id>", "<relay-hint>" ], 56 [ "e", "<nutzapped-event-id>", "<relay-hint>" ],
57 [ "k", "<nutzapped-kind>"],
56 [ "p", "e9fbced3a42dcf551486650cc752ab354347dd413b307484e4fd1818ab53f991" ], // recipient of nutzap 58 [ "p", "e9fbced3a42dcf551486650cc752ab354347dd413b307484e4fd1818ab53f991" ], // recipient of nutzap
57 ] 59 ]
58} 60}
@@ -61,29 +63,30 @@ Clients MUST prefix the public key they P2PK-lock with `"02"` (for nostr<>cashu
61* `.content` is an optional comment for the nutzap 63* `.content` is an optional comment for the nutzap
62* `.tags`: 64* `.tags`:
63 * `proof` is one or more proofs P2PK-locked to the public key the recipient specified in their `kind:10019` event and including a DLEQ proof. 65 * `proof` is one or more proofs P2PK-locked to the public key the recipient specified in their `kind:10019` event and including a DLEQ proof.
66 * `unit` the base unit the proofs are denominated in (eg: `sat`, `usd`, `eur`). Default: `sat` if omitted.
64 * `u` is the mint the URL of the mint EXACTLY as specified by the recipient's `kind:10019`. 67 * `u` is the mint the URL of the mint EXACTLY as specified by the recipient's `kind:10019`.
65 * `p` is the Nostr identity public key of nutzap recipient. 68 * `p` is the Nostr identity public key of nutzap recipient.
66 * `e` is the event that is being nutzapped, if any. 69 * `e` is the event that is being nutzapped, if any.
67 70
68# Sending a nutzap 71## Sending a nutzap
69 72
70* The sender fetches the recipient's `kind:10019`. 73* The sender fetches the recipient's `kind:10019`.
71* The sender mints/swaps ecash on one of the recipient's listed mints. 74* The sender mints/swaps ecash on one of the recipient's listed mints.
72* The sender P2PK-locks to the recipient's specified public key in their `kind:10019` 75* The sender P2PK-locks to the recipient's specified public key in their `kind:10019`
73 76
74# Receiving nutzaps 77## Receiving nutzaps
75 78
76Clients should REQ for nutzaps: 79Clients should REQ for nutzaps:
77* Filtering with `#u` for mints they expect to receive ecash from. 80* Filtering with `#u` for mints they expect to receive ecash from.
78 * this is to prevent even interacting with mints the user hasn't explicitly signaled. 81 * this is to prevent even interacting with mints the user hasn't explicitly signaled.
79* Filtering with `since` of the most recent `kind:7376` event the same user has created. 82* Filtering with `since` of the most recent `kind:7376` event the same user has created.
80 * this can be used as a marker of the nutzaps 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. 83 * this can be used as a marker of the nutzaps that have already been swapped by the user -- clients might choose to use other kinds of markers, including internal state -- this is just a guidance of one possible approach.
81 84
82`{ "kinds": [9321], "#p": ["my-pubkey"], "#u": ["<mint-1>", "<mint-2>"], "since": <latest-created_at-of-kind-7376> }`. 85`{ "kinds": [9321], "#p": ["my-pubkey"], "#u": ["<mint-1>", "<mint-2>"], "since": <latest-created_at-of-kind-7376> }`.
83 86
84Upon receiving a new nutzap, the client should swap the tokens into a wallet the user controls, either a [NIP-60](60.md) wallet, their own LN wallet or anything else. 87Upon receiving a new nutzap, the client should swap the tokens into a wallet the user controls, either a [NIP-60](60.md) wallet, their own LN wallet or anything else.
85 88
86## Updating nutzap-redemption history 89### Updating nutzap-redemption history
87When claiming a token the client SHOULD create a `kind:7376` event and `e` tag the original nutzap 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. 90When claiming a token the client SHOULD create a `kind:7376` event and `e` tag the original nutzap 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.
88 91
89Multiple `kind:9321` events can be tagged in the same `kind:7376` event. 92Multiple `kind:9321` events can be tagged in the same `kind:7376` event.
@@ -94,6 +97,7 @@ Multiple `kind:9321` events can be tagged in the same `kind:7376` event.
94 "content": nip44_encrypt([ 97 "content": nip44_encrypt([
95 [ "direction", "in" ], // in = received, out = sent 98 [ "direction", "in" ], // in = received, out = sent
96 [ "amount", "1" ], 99 [ "amount", "1" ],
100 [ "unit", "sat" ],
97 [ "e", "<7375-event-id>", "<relay-hint>", "created" ] // new token event that was created 101 [ "e", "<7375-event-id>", "<relay-hint>", "created" ] // new token event that was created
98 ]), 102 ]),
99 "tags": [ 103 "tags": [
@@ -105,7 +109,7 @@ Multiple `kind:9321` events can be tagged in the same `kind:7376` event.
105 109
106Events that redeem a nutzap SHOULD be published to the sender's [NIP-65](65.md) "read" relays. 110Events that redeem a nutzap SHOULD be published to the sender's [NIP-65](65.md) "read" relays.
107 111
108## Verifying a Cashu Zap 112### Verifying a Cashu Zap
109When listing or counting zaps received by any given event, observer clients SHOULD: 113When listing or counting zaps received by any given event, observer clients SHOULD:
110 114
111* check that the receiving user has issued a `kind:10019` tagging the mint where the cashu has been minted. 115* check that the receiving user has issued a `kind:10019` tagging the mint where the cashu has been minted.
@@ -115,7 +119,7 @@ When listing or counting zaps received by any given event, observer clients SHOU
115 119
116All these checks can be done offline (as long as the observer has the receiver mints' keyset and their `kind:10019` event), so the process should be reasonably fast. 120All these checks can be done offline (as long as the observer has the receiver mints' keyset and their `kind:10019` event), so the process should be reasonably fast.
117 121
118## Final Considerations 122### Final Considerations
1191. Clients SHOULD guide their users to use NUT-11 (P2PK) and NUT-12 (DLEQ proofs) compatible-mints in their `kind:10019` event to avoid receiving nutzaps anyone can spend. 1231. Clients SHOULD guide their users to use NUT-11 (P2PK) and NUT-12 (DLEQ proofs) compatible-mints in their `kind:10019` event to avoid receiving nutzaps anyone can spend.
1202. Clients SHOULD normalize and deduplicate mint URLs as described in NIP-65. 1242. Clients SHOULD normalize and deduplicate mint URLs as described in NIP-65.
1213. A nutzap event MUST include proofs in one of the mints the recipient has listed in their `kind:10019` and published 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. 1253. A nutzap event MUST include proofs in one of the mints the recipient has listed in their `kind:10019` and published 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.