Added base "unit" tag to NutZap kind:9321 event (#1915)

This commit is contained in:
Rob Woodgate
2025-10-31 13:59:35 +00:00
committed by GitHub
parent 3ec830cd23
commit 62f0b14ae8
2 changed files with 10 additions and 0 deletions

7
60.md
View File

@@ -50,6 +50,7 @@ There can be multiple `kind:7375` events for the same mint, and multiple proofs
"kind": 7375, "kind": 7375,
"content": nip44_encrypt({ "content": nip44_encrypt({
"mint": "https://stablenut.umint.cash", "mint": "https://stablenut.umint.cash",
"unit": "sat",
"proofs": [ "proofs": [
// one or more proofs in the default cashu format // one or more proofs in the default cashu format
{ {
@@ -69,6 +70,7 @@ There can be multiple `kind:7375` events for the same mint, and multiple proofs
* `.content` is a [NIP-44](44.md) encrypted payload: * `.content` is a [NIP-44](44.md) encrypted payload:
* `mint`: The mint the proofs belong to. * `mint`: The mint the proofs belong to.
* `proofs`: unencoded proofs * `proofs`: unencoded proofs
* `unit` the base unit the proofs are denominated in (eg: `sat`, `usd`, `eur`). Default: `sat` if omitted.
* `del`: token-ids that were destroyed by the creation of this token. This assists with state transitions. * `del`: token-ids that were destroyed by the creation of this token. This assists with state transitions.
When one or more proofs of a token are spent, the token event should be [NIP-09](09.md)-deleted and, if some proofs are unspent from the same token event, a new token event should be created rolling over the unspent proofs and adding any change outputs to the new token event (the change output should include a `del` field). When one or more proofs of a token are spent, the token event should be [NIP-09](09.md)-deleted and, if some proofs are unspent from the same token event, a new token event should be created rolling over the unspent proofs and adding any change outputs to the new token event (the change output should include a `del` field).
@@ -84,6 +86,7 @@ Clients SHOULD publish `kind:7376` events to create a transaction history when t
"content": nip44_encrypt([ "content": nip44_encrypt([
[ "direction", "in" ], // in = received, out = sent [ "direction", "in" ], // in = received, out = sent
[ "amount", "1" ], [ "amount", "1" ],
[ "unit", "sat" ],
[ "e", "<event-id-of-created-token>", "", "created" ] [ "e", "<event-id-of-created-token>", "", "created" ]
]), ]),
"tags": [ "tags": [
@@ -93,6 +96,7 @@ Clients SHOULD publish `kind:7376` events to create a transaction history when t
``` ```
* `direction` - The direction of the transaction; `in` for received funds, `out` for sent funds. * `direction` - The direction of the transaction; `in` for received funds, `out` for sent funds.
* `unit` the base unit of the amount (eg: `sat`, `usd`, `eur`). Default: `sat` if omitted.
Clients MUST add `e` tags to create references of destroyed and created token events along with the marker of the meaning of the tag: Clients MUST add `e` tags to create references of destroyed and created token events along with the marker of the meaning of the tag:
* `created` - A new token event was created. * `created` - A new token event was created.
@@ -121,6 +125,7 @@ If Alice spends 4 sats from this token event
"id": "event-id-1", "id": "event-id-1",
"content": nip44_encrypt({ "content": nip44_encrypt({
"mint": "https://stablenut.umint.cash", "mint": "https://stablenut.umint.cash",
"unit": "sat",
"proofs": [ "proofs": [
{ "id": "1", "amount": 1 }, { "id": "1", "amount": 1 },
{ "id": "2", "amount": 2 }, { "id": "2", "amount": 2 },
@@ -140,6 +145,7 @@ Her client:
"id": "event-id-2", "id": "event-id-2",
"content": nip44_encrypt({ "content": nip44_encrypt({
"mint": "https://stablenut.umint.cash", "mint": "https://stablenut.umint.cash",
"unit": "sat",
"proofs": [ "proofs": [
{ "id": "1", "amount": 1 }, { "id": "1", "amount": 1 },
{ "id": "2", "amount": 2 }, { "id": "2", "amount": 2 },
@@ -159,6 +165,7 @@ Her client:
"content": nip44_encrypt([ "content": nip44_encrypt([
[ "direction", "out" ], [ "direction", "out" ],
[ "amount", "4" ], [ "amount", "4" ],
[ "unit", "sat" ],
[ "e", "<event-id-1>", "", "destroyed" ], [ "e", "<event-id-1>", "", "destroyed" ],
[ "e", "<event-id-2>", "", "created" ], [ "e", "<event-id-2>", "", "created" ],
]), ]),

3
61.md
View File

@@ -51,6 +51,7 @@ Clients MUST prefix the public key they P2PK-lock with `"02"` (for nostr<>cashu
"pubkey": "<sender-pubkey>", "pubkey": "<sender-pubkey>",
"tags": [ "tags": [
[ "proof", "{\"amount\":1,\"C\":\"02277c66191736eb72fce9d975d08e3191f8f96afb73ab1eec37e4465683066d3f\",\"id\":\"000a93d6f8a1d2c4\",\"secret\":\"[\\\"P2PK\\\",{\\\"nonce\\\":\\\"b00bdd0467b0090a25bdf2d2f0d45ac4e355c482c1418350f273a04fedaaee83\\\",\\\"data\\\":\\\"02eaee8939e3565e48cc62967e2fde9d8e2a4b3ec0081f29eceff5c64ef10ac1ed\\\"}]\"}" ], [ "proof", "{\"amount\":1,\"C\":\"02277c66191736eb72fce9d975d08e3191f8f96afb73ab1eec37e4465683066d3f\",\"id\":\"000a93d6f8a1d2c4\",\"secret\":\"[\\\"P2PK\\\",{\\\"nonce\\\":\\\"b00bdd0467b0090a25bdf2d2f0d45ac4e355c482c1418350f273a04fedaaee83\\\",\\\"data\\\":\\\"02eaee8939e3565e48cc62967e2fde9d8e2a4b3ec0081f29eceff5c64ef10ac1ed\\\"}]\"}" ],
[ "unit", "sat" ],
[ "u", "https://stablenut.umint.cash" ], [ "u", "https://stablenut.umint.cash" ],
[ "e", "<nutzapped-event-id>", "<relay-hint>" ], [ "e", "<nutzapped-event-id>", "<relay-hint>" ],
[ "k", "<nutzapped-kind>"], [ "k", "<nutzapped-kind>"],
@@ -62,6 +63,7 @@ Clients MUST prefix the public key they P2PK-lock with `"02"` (for nostr<>cashu
* `.content` is an optional comment for the nutzap * `.content` is an optional comment for the nutzap
* `.tags`: * `.tags`:
* `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. * `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.
* `unit` the base unit the proofs are denominated in (eg: `sat`, `usd`, `eur`). Default: `sat` if omitted.
* `u` is the mint the URL of the mint EXACTLY as specified by the recipient's `kind:10019`. * `u` is the mint the URL of the mint EXACTLY as specified by the recipient's `kind:10019`.
* `p` is the Nostr identity public key of nutzap recipient. * `p` is the Nostr identity public key of nutzap recipient.
* `e` is the event that is being nutzapped, if any. * `e` is the event that is being nutzapped, if any.
@@ -95,6 +97,7 @@ Multiple `kind:9321` events can be tagged in the same `kind:7376` event.
"content": nip44_encrypt([ "content": nip44_encrypt([
[ "direction", "in" ], // in = received, out = sent [ "direction", "in" ], // in = received, out = sent
[ "amount", "1" ], [ "amount", "1" ],
[ "unit", "sat" ],
[ "e", "<7375-event-id>", "<relay-hint>", "created" ] // new token event that was created [ "e", "<7375-event-id>", "<relay-hint>", "created" ] // new token event that was created
]), ]),
"tags": [ "tags": [