reformat a bunch of json things and small nitpicks.

This commit is contained in:
fiatjaf 2023-11-18 09:13:12 -03:00
parent b0df71824f
commit 5dcfe85306
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1
21 changed files with 385 additions and 365 deletions

18
11.md
View File

@ -68,7 +68,6 @@ are rejected or fail immediately.
```json ```json
{ {
...
"limitation": { "limitation": {
"max_message_length": 16384, "max_message_length": 16384,
"max_subscriptions": 20, "max_subscriptions": 20,
@ -82,7 +81,8 @@ are rejected or fail immediately.
"payment_required": true, "payment_required": true,
"created_at_lower_limit": 31536000, "created_at_lower_limit": 31536000,
"created_at_upper_limit": 3 "created_at_upper_limit": 3
} },
...
} }
``` ```
@ -181,8 +181,8 @@ flexibility is up to the client software.
```json ```json
{ {
"relay_countries": [ "CA", "US" ],
... ...
"relay_countries": [ "CA", "US" ]
} }
``` ```
@ -203,10 +203,10 @@ To support this goal, relays MAY specify some of the following values.
```json ```json
{ {
"language_tags": ["en", "en-419"],
"tags": ["sfw-only", "bitcoin-only", "anime"],
"posting_policy": "https://example.com/posting-policy.html",
... ...
"language_tags": [ "en", "en-419" ],
"tags": [ "sfw-only", "bitcoin-only", "anime" ],
"posting_policy": "https://example.com/posting-policy.html"
} }
``` ```
@ -239,13 +239,13 @@ Relays that require payments may want to expose their fee schedules.
```json ```json
{ {
...
"payments_url": "https://my-relay/payments", "payments_url": "https://my-relay/payments",
"fees": { "fees": {
"admission": [{ "amount": 1000000, "unit": "msats" }], "admission": [{ "amount": 1000000, "unit": "msats" }],
"subscription": [{ "amount": 5000000, "unit": "msats", "period": 2592000 }], "subscription": [{ "amount": 5000000, "unit": "msats", "period": 2592000 }],
"publication": [{ "kinds": [4], "amount": 100, "unit": "msats" }], "publication": [{ "kinds": [4], "amount": 100, "unit": "msats" }],
} },
...
} }
``` ```
@ -255,8 +255,8 @@ A URL pointing to an image to be used as an icon for the relay. Recommended to b
```json ```json
{ {
...
"icon": "https://nostr.build/i/53866b44135a27d624e99c6165cabd76ac8f72797209700acb189fce75021f47.jpg", "icon": "https://nostr.build/i/53866b44135a27d624e99c6165cabd76ac8f72797209700acb189fce75021f47.jpg",
...
} }
``` ```

6
13.md
View File

@ -35,11 +35,7 @@ Example mined note
"created_at": 1651794653, "created_at": 1651794653,
"kind": 1, "kind": 1,
"tags": [ "tags": [
[ ["nonce", "776797", "21"]
"nonce",
"776797",
"21"
]
], ],
"content": "It's just me mining my own business", "content": "It's just me mining my own business",
"sig": "284622fc0a3f4f1303455d5175f7ba962a3300d136085b9566801bc2e0699de0c7e31e44c81fb40ad9049173742e904713c3594a1da0fc5d2382a25c11aba977" "sig": "284622fc0a3f4f1303455d5175f7ba962a3300d136085b9566801bc2e0699de0c7e31e44c81fb40ad9049173742e904713c3594a1da0fc5d2382a25c11aba977"

4
14.md
View File

@ -9,7 +9,9 @@ Subject tag in Text events
This NIP defines the use of the "subject" tag in text (kind: 1) events. This NIP defines the use of the "subject" tag in text (kind: 1) events.
(implemented in more-speech) (implemented in more-speech)
`["subject": <string>]` ```json
["subject": <string>]
```
Browsers often display threaded lists of messages. The contents of the subject tag can be used in such lists, instead of the more ad hoc approach of using the first few words of the message. This is very similar to the way email browsers display lists of incoming emails by subject rather than by contents. Browsers often display threaded lists of messages. The contents of the subject tag can be used in such lists, instead of the more ad hoc approach of using the first few words of the message. This is very similar to the way email browsers display lists of incoming emails by subject rather than by contents.

127
15.md
View File

@ -1,14 +1,14 @@
NIP-15 NIP-15
====== ======
Nostr Marketplace (for resilient marketplaces) Nostr Marketplace
----------------------------------- -----------------
`draft` `optional` `draft` `optional`
> Based on https://github.com/lnbits/Diagon-Alley Based on https://github.com/lnbits/Diagon-Alley.
> Implemented in [NostrMarket](https://github.com/lnbits/nostrmarket) and [Plebeian Market](https://github.com/PlebeianTech/plebeian-market) Implemented in [NostrMarket](https://github.com/lnbits/nostrmarket) and [Plebeian Market](https://github.com/PlebeianTech/plebeian-market).
## Terms ## Terms
@ -35,27 +35,28 @@ The `merchant` admin software can be purely clientside, but for `convenience` an
A merchant can publish these events: A merchant can publish these events:
| Kind | | Description | | Kind | | Description |
| --------- | ------------------ | --------------------------------------------------------------------------------------------------------------- | | --------- | ------------------ | --------------------------------------------------------------------------------------------------------------- |
| `0 ` | `set_meta` | The merchant description (similar with any `nostr` public key). | | `0` | `set_meta` | The merchant description (similar with any `nostr` public key). |
| `30017` | `set_stall` | Create or update a stall. | | `30017` | `set_stall` | Create or update a stall. |
| `30018` | `set_product` | Create or update a product. | | `30018` | `set_product` | Create or update a product. |
| `4 ` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. | | `4` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. |
| `5 ` | `delete` | Delete a product or a stall. | | `5` | `delete` | Delete a product or a stall. |
### Event `30017`: Create or update a stall. ### Event `30017`: Create or update a stall.
**Event Content**: **Event Content**
```json ```json
{ {
"id": <String, UUID generated by the merchant. Sequential IDs (`0`, `1`, `2`...) are discouraged>, "id": <string, id generated by the merchant. Sequential IDs (`0`, `1`, `2`...) are discouraged>,
"name": <String, stall name>, "name": <string, stall name>,
"description": <String (optional), stall description>, "description": <string (optional), stall description>,
"currency": <String, currency used>, "currency": <string, currency used>,
"shipping": [ "shipping": [
{ {
"id": <String, UUID of the shipping zone, generated by the merchant>, "id": <string, id of the shipping zone, generated by the merchant>,
"name": <String (optional), zone name>, "name": <string (optional), zone name>,
"cost": <float, base cost for shipping. The currency is defined at the stall level>, "cost": <float, base cost for shipping. The currency is defined at the stall level>,
"regions": [<String, regions included in this zone>], "regions": [<string, regions included in this zone>],
} }
] ]
} }
@ -70,31 +71,36 @@ Fields that are not self-explanatory:
- each shipping zone contains the base cost for orders made to that shipping zone, but a specific shipping cost per - each shipping zone contains the base cost for orders made to that shipping zone, but a specific shipping cost per
product can also be specified if the shipping cost for that product is higher than what's specified by the base cost. product can also be specified if the shipping cost for that product is higher than what's specified by the base cost.
**Event Tags**: **Event Tags**
```json ```json
"tags": [["d", <String, id of stall]] {
"tags": [["d", <string, id of stall]],
...
}
``` ```
- the `d` tag is required, its value MUST be the same as the stall `id`. - the `d` tag is required, its value MUST be the same as the stall `id`.
### Event `30018`: Create or update a product ### Event `30018`: Create or update a product
**Event Content**: **Event Content**
```json ```json
{ {
"id": <String, UUID generated by the merchant.Sequential IDs (`0`, `1`, `2`...) are discouraged>, "id": <string, id generated by the merchant (sequential ids are discouraged)>,
"stall_id": <String, UUID of the stall to which this product belong to>, "stall_id": <string, id of the stall to which this product belong to>,
"name": <String, product name>, "name": <string, product name>,
"description": <String (optional), product description>, "description": <string (optional), product description>,
"images": <[String], array of image URLs, optional>, "images": <[string], array of image URLs, optional>,
"currency": <String, currency used>, "currency": <string, currency used>,
"price": <float, cost of product>, "price": <float, cost of product>,
"quantity": <int or null, available items>, "quantity": <int or null, available items>,
"specs": [ "specs": [
[<String, spec key>, <String, spec value>] [<string, spec key>, <string, spec value>]
], ],
"shipping": [ "shipping": [
{ {
"id": <String, UUID of the shipping zone. Must match one of the zones defined for the stall>, "id": <string, id of the shipping zone (must match one of the zones defined for the stall)>,
"cost": <float, extra cost for shipping. The currency is defined at the stall level>, "cost": <float, extra cost for shipping. The currency is defined at the stall level>,
} }
] ]
@ -116,14 +122,16 @@ Fields that are not self-explanatory:
- the `base cost from the stall` for the chosen shipping option - the `base cost from the stall` for the chosen shipping option
- the result of multiplying the product units by the `shipping costs specified in the product`, if any. - the result of multiplying the product units by the `shipping costs specified in the product`, if any.
**Event Tags**: **Event Tags**
```json ```json
"tags": [ "tags": [
["d", <String, id of product], ["d", <string, id of product],
["t", <String (optional), product category], ["t", <string (optional), product category],
["t", <String (optional), product category], ["t", <string (optional), product category],
...
],
... ...
]
``` ```
- the `d` tag is required, its value MUST be the same as the product `id`. - the `d` tag is required, its value MUST be the same as the product `id`.
@ -147,23 +155,23 @@ The below json goes in content of [NIP04](https://github.com/nostr-protocol/nips
```json ```json
{ {
"id": <String, UUID generated by the customer>, "id": <string, id generated by the customer>,
"type": 0, "type": 0,
"name": <String (optional), ???>, "name": <string (optional), ???>,
"address": <String (optional), for physical goods an address should be provided> "address": <string (optional), for physical goods an address should be provided>
"message": "<String (optional), message for merchant>, "message": "<string (optional), message for merchant>,
"contact": { "contact": {
"nostr": <32-bytes hex of a pubkey>, "nostr": <32-bytes hex of a pubkey>,
"phone": <String (optional), if the customer wants to be contacted by phone>, "phone": <string (optional), if the customer wants to be contacted by phone>,
"email": <String (optional), if the customer wants to be contacted by email>, "email": <string (optional), if the customer wants to be contacted by email>,
}, },
"items": [ "items": [
{ {
"product_id": <String, UUID of the product>, "product_id": <string, id of the product>,
"quantity": <int, how many products the customer is ordering> "quantity": <int, how many products the customer is ordering>
} }
], ],
"shipping_id": <String, UUID of the shipping zone> "shipping_id": <string, id of the shipping zone>
} }
``` ```
@ -186,21 +194,21 @@ The below json goes in `content` of [NIP04](https://github.com/nostr-protocol/ni
```json ```json
{ {
"id": <String, UUID of the order>, "id": <string, id of the order>,
"type": 1, "type": 1,
"message": <String, message to customer, optional>, "message": <string, message to customer, optional>,
"payment_options": [ "payment_options": [
{ {
"type": <String, option type>, "type": <string, option type>,
"link": <String, url, btc address, ln invoice, etc> "link": <string, url, btc address, ln invoice, etc>
}, },
{ {
"type": <String, option type>, "type": <string, option type>,
"link": <String, url, btc address, ln invoice, etc> "link": <string, url, btc address, ln invoice, etc>
}, },
{ {
"type": <String, option type>, "type": <string, option type>,
"link": <String, url, btc address, ln invoice, etc> "link": <string, url, btc address, ln invoice, etc>
} }
] ]
} }
@ -214,11 +222,11 @@ The below json goes in `content` of [NIP04](https://github.com/nostr-protocol/ni
```json ```json
{ {
"id": <String, UUID of the order>, "id": <string, id of the order>,
"type": 2, "type": 2,
"message": <String, message to customer>, "message": <string, message to customer>,
"paid": <Bool, true/false has received payment>, "paid": <bool: has received payment>,
"shipped": <Bool, true/false has been shipped>, "shipped": <bool: has been shipped>,
} }
``` ```
## Customize Marketplace ## Customize Marketplace
@ -226,18 +234,19 @@ Create a customized user experience using the `naddr` from [NIP-19](https://gith
### Event `30019`: Create or update marketplace UI/UX ### Event `30019`: Create or update marketplace UI/UX
**Event Content**: **Event Content**
```json ```json
{ {
"name": <String (optional), market name>, "name": <string (optional), market name>,
"about": <String (optional), market description>, "about": <string (optional), market description>,
"ui": { "ui": {
"picture": <String (optional), market logo image URL>, "picture": <string (optional), market logo image URL>,
"banner": <String (optional), market logo banner URL>, "banner": <string (optional), market logo banner URL>,
"theme": <String (optional), market theme>, "theme": <string (optional), market theme>,
"darkMode": <Bool, true/false> "darkMode": <bool, true/false>
}, },
"merchants": <[String] (optional), array of pubkeys>, "merchants": [array of pubkeys (optional)],
... ...
} }
``` ```

2
28.md
View File

@ -37,7 +37,7 @@ In the channel creation `content` field, Client SHOULD include basic channel met
Update a channel's public metadata. Update a channel's public metadata.
Clients and relays SHOULD handle kind 41 events similar to kind 33 replaceable events, where the information is used to update the metadata, without modifying the event id for the channel. Only the most recent kind 41 is needed to be stored. Clients and relays SHOULD handle kind 41 events similar to kind 33 replaceable events, where the information is used to update the metadata, without modifying the event id for the channel.Only the most recent kind 41 is needed to be stored.
Clients SHOULD ignore kind 41s from pubkeys other than the kind 40 pubkey. Clients SHOULD ignore kind 41s from pubkeys other than the kind 40 pubkey.

9
32.md
View File

@ -64,7 +64,8 @@ A suggestion that multiple pubkeys be associated with the `permies` topic.
["l", "permies", "#t"], ["l", "permies", "#t"],
["p", <pubkey1>, <relay_url>], ["p", <pubkey1>, <relay_url>],
["p", <pubkey2>, <relay_url>] ["p", <pubkey2>, <relay_url>]
] ],
...
} }
``` ```
@ -78,7 +79,8 @@ A report flagging violence toward a human being as defined by ontology.example.c
["l", "VI-hum", "com.example.ontology"], ["l", "VI-hum", "com.example.ontology"],
["p", <pubkey1>, <relay_url>], ["p", <pubkey1>, <relay_url>],
["p", <pubkey2>, <relay_url>] ["p", <pubkey2>, <relay_url>]
] ],
...
} }
``` ```
@ -92,6 +94,7 @@ A moderation suggestion for a chat event.
["l", "approve", "nip28.moderation"], ["l", "approve", "nip28.moderation"],
["e", <kind40_event_id>, <relay_url>] ["e", <kind40_event_id>, <relay_url>]
], ],
...
} }
``` ```
@ -105,6 +108,7 @@ Assignment of a license to an event.
["l", "MIT", "license"], ["l", "MIT", "license"],
["e", <event_id>, <relay_url>] ["e", <event_id>, <relay_url>]
], ],
...
} }
``` ```
@ -119,6 +123,7 @@ is labeling their note as being related to Milan, Italy using ISO 3166-2.
["l", "IT-MI", "ISO-3166-2"] ["l", "IT-MI", "ISO-3166-2"]
], ],
"content": "It's beautiful here in Milan!", "content": "It's beautiful here in Milan!",
...
} }
``` ```

2
36.md
View File

@ -33,7 +33,7 @@ options:
["l", "reason", "content-warning"], ["l", "reason", "content-warning"],
["L", "social.nos.ontology"], ["L", "social.nos.ontology"],
["l", "NS-nud", "social.nos.ontology"], ["l", "NS-nud", "social.nos.ontology"],
["content-warning", "reason"] /* reason is optional */ ["content-warning", "<optional reason>"]
], ],
"content": "sensitive content with #hastag\n", "content": "sensitive content with #hastag\n",
"id": "<event-id>" "id": "<event-id>"

6
39.md
View File

@ -15,15 +15,13 @@ Nostr protocol users may have other online identities such as usernames, profile
A new optional `i` tag is introduced for `kind 0` metadata event contents in addition to name, about, picture fields as included in [NIP-01](https://github.com/nostr-protocol/nips/blob/master/01.md): A new optional `i` tag is introduced for `kind 0` metadata event contents in addition to name, about, picture fields as included in [NIP-01](https://github.com/nostr-protocol/nips/blob/master/01.md):
```json ```json
{ {
"id": <id>,
"pubkey": <pubkey>,
...
"tags": [ "tags": [
["i", "github:semisol", "9721ce4ee4fceb91c9711ca2a6c9a5ab"], ["i", "github:semisol", "9721ce4ee4fceb91c9711ca2a6c9a5ab"],
["i", "twitter:semisol_public", "1619358434134196225"], ["i", "twitter:semisol_public", "1619358434134196225"],
["i", "mastodon:bitcoinhackers.org/@semisol", "109775066355589974"] ["i", "mastodon:bitcoinhackers.org/@semisol", "109775066355589974"]
["i", "telegram:1087295469", "nostrdirectory/770"] ["i", "telegram:1087295469", "nostrdirectory/770"]
] ],
...
} }
``` ```

2
40.md
View File

@ -2,7 +2,7 @@ NIP-40
====== ======
Expiration Timestamp Expiration Timestamp
----------------------------------- --------------------
`draft` `optional` `draft` `optional`

14
42.md
View File

@ -24,13 +24,13 @@ A relay may want to require clients to authenticate to access restricted resourc
This NIP defines a new message, `AUTH`, which relays can send when they support authentication and clients can send to relays when they want This NIP defines a new message, `AUTH`, which relays can send when they support authentication and clients can send to relays when they want
to authenticate. When sent by relays, the message is of the following form: to authenticate. When sent by relays, the message is of the following form:
``` ```json
["AUTH", <challenge-string>] ["AUTH", <challenge-string>]
``` ```
And, when sent by clients, of the following form: And, when sent by clients, of the following form:
``` ```json
["AUTH", <signed-event-json>] ["AUTH", <signed-event-json>]
``` ```
@ -41,16 +41,12 @@ Relays MUST exclude `kind: 22242` events from being broadcasted to any client.
```json ```json
{ {
"id": "...",
"pubkey": "...",
"created_at": 1669695536,
"kind": 22242, "kind": 22242,
"tags": [ "tags": [
["relay", "wss://relay.example.com/"], ["relay", "wss://relay.example.com/"],
["challenge", "challengestringhere"] ["challenge", "challengestringhere"]
], ],
"content": "", ...
"sig": "..."
} }
``` ```
@ -67,13 +63,13 @@ is expected to last for the duration of the WebSocket connection.
Upon receiving a message from an unauthenticated user it can't fulfill without authentication, a relay may choose to notify the client. For Upon receiving a message from an unauthenticated user it can't fulfill without authentication, a relay may choose to notify the client. For
that it can use a `NOTICE` or `OK` message with a standard prefix `"restricted: "` that is readable both by humans and machines, for example: that it can use a `NOTICE` or `OK` message with a standard prefix `"restricted: "` that is readable both by humans and machines, for example:
``` ```json
["NOTICE", "restricted: we can't serve DMs to unauthenticated users, does your client implement NIP-42?"] ["NOTICE", "restricted: we can't serve DMs to unauthenticated users, does your client implement NIP-42?"]
``` ```
or it can return an `OK` message noting the reason an event was not written using the same prefix: or it can return an `OK` message noting the reason an event was not written using the same prefix:
``` ```json
["OK", <event-id>, false, "restricted: we do not accept events from unauthenticated users, please sign up at https://example.com/"] ["OK", <event-id>, false, "restricted: we do not accept events from unauthenticated users, please sign up at https://example.com/"]
``` ```

21
45.md
View File

@ -16,29 +16,36 @@ Some queries a client may want to execute against connected relays are prohibiti
This NIP defines the verb `COUNT`, which accepts a subscription id and filters as specified in [NIP 01](01.md) for the verb `REQ`. Multiple filters are OR'd together and aggregated into a single count result. This NIP defines the verb `COUNT`, which accepts a subscription id and filters as specified in [NIP 01](01.md) for the verb `REQ`. Multiple filters are OR'd together and aggregated into a single count result.
``` ```json
["COUNT", <subscription_id>, <filters JSON>...] ["COUNT", <subscription_id>, <filters JSON>...]
``` ```
Counts are returned using a `COUNT` response in the form `{"count": <integer>}`. Relays may use probabilistic counts to reduce compute requirements. Counts are returned using a `COUNT` response in the form `{"count": <integer>}`. Relays may use probabilistic counts to reduce compute requirements.
In case a relay uses probabilistic counts, it MAY indicate it in the response with `approximate` key i.e. `{"count": <integer>, "approximate": <true|false>}`. In case a relay uses probabilistic counts, it MAY indicate it in the response with `approximate` key i.e. `{"count": <integer>, "approximate": <true|false>}`.
``` ```json
["COUNT", <subscription_id>, {"count": <integer>}] ["COUNT", <subscription_id>, {"count": <integer>}]
``` ```
Examples: ## Examples:
``` ### Followers count
# Followers count
```json
["COUNT", <subscription_id>, {"kinds": [3], "#p": [<pubkey>]}] ["COUNT", <subscription_id>, {"kinds": [3], "#p": [<pubkey>]}]
["COUNT", <subscription_id>, {"count": 238}] ["COUNT", <subscription_id>, {"count": 238}]
```
# Count posts and reactions ### Count posts and reactions
```json
["COUNT", <subscription_id>, {"kinds": [1, 7], "authors": [<pubkey>]}] ["COUNT", <subscription_id>, {"kinds": [1, 7], "authors": [<pubkey>]}]
["COUNT", <subscription_id>, {"count": 5}] ["COUNT", <subscription_id>, {"count": 5}]
```
# Count posts approximately ### Count posts approximately
```
["COUNT", <subscription_id>, {"kinds": [1]}] ["COUNT", <subscription_id>, {"kinds": [1]}]
["COUNT", <subscription_id>, {"count": 93412452, "approximate": true}] ["COUNT", <subscription_id>, {"count": 93412452, "approximate": true}]
``` ```

30
53.md
View File

@ -6,17 +6,17 @@ Live Activities
`draft` `optional` `draft` `optional`
## Abstract
Service providers want to offer live activities to the Nostr network in such a way that participants can easily logged and queried by clients. This NIP describes a general framework to advertise the involvement of pubkeys in such live activities. Service providers want to offer live activities to the Nostr network in such a way that participants can easily logged and queried by clients. This NIP describes a general framework to advertise the involvement of pubkeys in such live activities.
# Live Event ## Concepts
### Live Event
A special event with `kind:30311` "Live Event" is defined as a _parameterized replaceable event_ of public `p` tags. Each `p` tag SHOULD have a **displayable** marker name for the current role (e.g. `Host`, `Speaker`, `Participant`) of the user in the event and the relay information MAY be empty. This event will be constantly updated as participants join and leave the activity. A special event with `kind:30311` "Live Event" is defined as a _parameterized replaceable event_ of public `p` tags. Each `p` tag SHOULD have a **displayable** marker name for the current role (e.g. `Host`, `Speaker`, `Participant`) of the user in the event and the relay information MAY be empty. This event will be constantly updated as participants join and leave the activity.
For example: For example:
```js ```json
{ {
"kind": 30311, "kind": 30311,
"tags": [ "tags": [
@ -38,7 +38,7 @@ For example:
["relays", "wss://one.com", "wss://two.com", ...] ["relays", "wss://one.com", "wss://two.com", ...]
], ],
"content": "", "content": "",
...other fields ...
} }
``` ```
@ -52,7 +52,7 @@ Live Activity management clients are expected to constantly update `kind:30311`
The activity MUST be linked to using the [NIP-19](19.md) `naddr` code along with the `a` tag. The activity MUST be linked to using the [NIP-19](19.md) `naddr` code along with the `a` tag.
## Proof of Agreement to Participate ### Proof of Agreement to Participate
Event owners can add proof as the 5th term in each `p` tag to clarify the participant's agreement in joining the event. The proof is a signed SHA256 of the complete `a` Tag of the event (`kind:pubkey:dTag`) by each `p`'s private key, encoded in hex. Event owners can add proof as the 5th term in each `p` tag to clarify the participant's agreement in joining the event. The proof is a signed SHA256 of the complete `a` Tag of the event (`kind:pubkey:dTag`) by each `p`'s private key, encoded in hex.
@ -60,30 +60,28 @@ Clients MAY only display participants if the proof is available or MAY display p
This feature is important to avoid malicious event owners adding large account holders to the event, without their knowledge, to lure their followers into the malicious owner's trap. This feature is important to avoid malicious event owners adding large account holders to the event, without their knowledge, to lure their followers into the malicious owner's trap.
# Live Chat Message ### Live Chat Message
Event `kind:1311` is live chat's channel message. Clients MUST include the `a` tag of the activity with a `root` marker. Other Kind-1 tags such as `reply` and `mention` can also be used. Event `kind:1311` is live chat's channel message. Clients MUST include the `a` tag of the activity with a `root` marker. Other Kind-1 tags such as `reply` and `mention` can also be used.
```js ```json
{ {
"id": "<32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>",
"pubkey": "<32-bytes lowercase hex-encoded public key of the event creator>",
"created_at": "<Unix timestamp in seconds>",
"kind": 1311, "kind": 1311,
"tags": [ "tags": [
["a", "30311:<Community event author pubkey>:<d-identifier of the community>", "<Optional relay url>", "root"], ["a", "30311:<Community event author pubkey>:<d-identifier of the community>", "<Optional relay url>", "root"],
], ],
"content": "Zaps to live streams is beautiful." "content": "Zaps to live streams is beautiful.",
...
} }
``` ```
# Use Cases ## Use Cases
Common use cases include meeting rooms/workshops, watch-together activities, or event spaces, such as [live.snort.social](https://live.snort.social) and [nostrnests.com](https://nostrnests.com). Common use cases include meeting rooms/workshops, watch-together activities, or event spaces, such as [live.snort.social](https://live.snort.social) and [nostrnests.com](https://nostrnests.com).
# Example ## Example
Live Streaming ### Live Streaming
```json ```json
{ {
@ -107,7 +105,7 @@ Live Streaming
} }
``` ```
Live Streaming chat message ### Live Streaming chat message
```json ```json
{ {

1
56.md
View File

@ -1,4 +1,3 @@
NIP-56 NIP-56
====== ======

14
72.md
View File

@ -14,7 +14,6 @@ The goal of this NIP is to create moderator-approved public communities around a
```json ```json
{ {
...
"created_at": <Unix timestamp in seconds>, "created_at": <Unix timestamp in seconds>,
"kind": 34550, "kind": 34550,
"tags": [ "tags": [
@ -34,7 +33,8 @@ The goal of this NIP is to create moderator-approved public communities around a
["relay", "<relay where to send and receive requests>", "requests"], ["relay", "<relay where to send and receive requests>", "requests"],
["relay", "<relay where to send and receive approvals>", "approvals"], ["relay", "<relay where to send and receive approvals>", "approvals"],
["relay", "<relay where to post requests to and fetch approvals from>"] ["relay", "<relay where to post requests to and fetch approvals from>"]
] ],
...
} }
``` ```
@ -44,12 +44,12 @@ Any Nostr event can be submitted to a community by anyone for approval. Clients
```json ```json
{ {
...
"kind": 1, "kind": 1,
"tags": [ "tags": [
["a", "34550:<community event author pubkey>:<community-d-identifier>", "<optional-relay-url>"], ["a", "34550:<community event author pubkey>:<community-d-identifier>", "<optional-relay-url>"],
], ],
"content": "hello world" "content": "hello world",
...
} }
``` ```
@ -61,7 +61,6 @@ The post-approval event MUST include `a` tags of the communities the moderator i
```json ```json
{ {
...
"pubkey": "<32-bytes lowercase hex-encoded public key of the event creator>", "pubkey": "<32-bytes lowercase hex-encoded public key of the event creator>",
"kind": 4550, "kind": 4550,
"tags": [ "tags": [
@ -70,7 +69,8 @@ The post-approval event MUST include `a` tags of the communities the moderator i
["p", "<port-author-pubkey>", "<optional-relay-url>"], ["p", "<port-author-pubkey>", "<optional-relay-url>"],
["k", "<post-request-kind>"] ["k", "<post-request-kind>"]
], ],
"content": "<the full approved event, JSON-encoded>" "content": "<the full approved event, JSON-encoded>",
...
} }
``` ```
@ -86,7 +86,7 @@ Community clients SHOULD display posts that have been approved by at least 1 mod
The following filter displays the approved posts. The following filter displays the approved posts.
```js ```json
[ [
"REQ", "REQ",
"_", "_",

17
75.md
View File

@ -1,6 +1,8 @@
# NIP-75 NIP-75
======
## Zap Goals Zap Goals
---------
`draft` `optional` `draft` `optional`
@ -27,7 +29,7 @@ Example event:
["amount", "210000"], ["amount", "210000"],
], ],
"content": "Nostrasia travel expenses", "content": "Nostrasia travel expenses",
...other fields ...
``` ```
The following tags are OPTIONAL. The following tags are OPTIONAL.
@ -43,7 +45,8 @@ The following tags are OPTIONAL.
["closed_at", "<unix timestamp in seconds>"], ["closed_at", "<unix timestamp in seconds>"],
], ],
"content": "Nostrasia travel expenses", "content": "Nostrasia travel expenses",
...other fields ...
}
``` ```
The goal MAY include an `r` or `a` tag linking to a URL or parameterized replaceable event. The goal MAY include an `r` or `a` tag linking to a URL or parameterized replaceable event.
@ -54,12 +57,14 @@ Parameterized replaceable events can link to a goal by using a `goal` tag specif
```json ```json
{ {
"kind": 3XXXX, ...
"kind": 3xxxx,
"tags": [ "tags": [
... ...
["goal", "<event id>", "<Relay URL (optional)>"], ["goal", "<event id>", "<Relay URL (optional)>"],
], ],
...other fields ...
}
``` ```
## Client behavior ## Client behavior

11
84.md
View File

@ -27,9 +27,14 @@ useful when highlighting non-nostr content for which the client might be able to
last value of the tag. last value of the tag.
```json ```json
[ "p", "<pubkey-hex>", "<relay-url>", "author" ], {
[ "p", "<pubkey-hex>", "<relay-url>", "author" ], "tags": [
[ "p", "<pubkey-hex>", "<relay-url>", "editor" ], ["p", "<pubkey-hex>", "<relay-url>", "author"],
["p", "<pubkey-hex>", "<relay-url>", "author"],
["p", "<pubkey-hex>", "<relay-url>", "editor"]
],
...
}
``` ```
### Context ### Context

64
89.md
View File

@ -9,10 +9,12 @@ Recommended Application Handlers
This NIP describes `kind:31989` and `kind:31990`: a way to discover applications that can handle unknown event-kinds. This NIP describes `kind:31989` and `kind:31990`: a way to discover applications that can handle unknown event-kinds.
## Rationale ## Rationale
Nostr's discoverability and transparent event interaction is one of its most interesting/novel mechanics. Nostr's discoverability and transparent event interaction is one of its most interesting/novel mechanics.
This NIP provides a simple way for clients to discover applications that handle events of a specific kind to ensure smooth cross-client and cross-kind interactions. This NIP provides a simple way for clients to discover applications that handle events of a specific kind to ensure smooth cross-client and cross-kind interactions.
### Parties involved ### Parties involved
There are three actors to this workflow: There are three actors to this workflow:
* application that handles a specific event kind (note that an application doesn't necessarily need to be a distinct entity and it could just be the same pubkey as user A) * application that handles a specific event kind (note that an application doesn't necessarily need to be a distinct entity and it could just be the same pubkey as user A)
@ -22,17 +24,17 @@ There are three actors to this workflow:
* user B, who seeks a recommendation for an app that handles a specific event kind * user B, who seeks a recommendation for an app that handles a specific event kind
* Queries for `kind:31989` and, based on results, queries for `kind:31990` * Queries for `kind:31989` and, based on results, queries for `kind:31990`
# Events ## Events
## Recommendation event ### Recommendation event
```json ```json
{ {
"kind": 31989, "kind": 31989,
"pubkey": <recommender-user-pubkey>, "pubkey": <recommender-user-pubkey>,
"tags": [ "tags": [
[ "d", <supported-event-kind> ], ["d", <supported-event-kind>],
[ "a", "31990:app1-pubkey:<d-identifier>", "wss://relay1", "ios" ], ["a", "31990:app1-pubkey:<d-identifier>", "wss://relay1", "ios"],
[ "a", "31990:app2-pubkey:<d-identifier>", "wss://relay2", "web" ] ["a", "31990:app2-pubkey:<d-identifier>", "wss://relay2", "web"]
] ]
} }
``` ```
@ -48,33 +50,31 @@ The third value of the tag SHOULD be the platform where this recommendation migh
```json ```json
{ {
"kind": 31990, "kind": 31990,
"pubkey": <pubkey>, "pubkey": "<application-pubkey>",
"content": "<optional-kind:0-style-metadata>", "content": "<optional-kind:0-style-metadata>",
"tags": [ "tags": [
[ "d", <random-id> ], ["d", <random-id>],
[ "k", <supported-event-kind> ], ["k", <supported-event-kind>],
[ "web", "https://..../a/<bech32>", "nevent" ], ["web", "https://..../a/<bech32>", "nevent"],
[ "web", "https://..../p/<bech32>", "nprofile" ], ["web", "https://..../p/<bech32>", "nprofile"],
[ "web", "https://..../e/<bech32>" ], ["web", "https://..../e/<bech32>"],
[ "ios", ".../<bech32>" ] ["ios", ".../<bech32>"]
] ]
} }
``` ```
* `content` is an optional `metadata`-like stringified JSON object, as described in NIP-01. This content is useful when the pubkey creating the `kind:31990` is not an application. If `content` is empty, the `kind:0` of the pubkey should be used to display application information (e.g. name, picture, web, LUD16, etc.) * `content` is an optional `metadata`-like stringified JSON object, as described in NIP-01. This content is useful when the pubkey creating the `kind:31990` is not an application. If `content` is empty, the `kind:0` of the pubkey should be used to display application information (e.g. name, picture, web, LUD16, etc.)
* `k` tags' value is the event kind that is supported by this `kind:31990`. * `k` tags' value is the event kind that is supported by this `kind:31990`.
Using a `k` tag(s) (instead of having the kind onf the NIP-33 `d` tag) provides: Using a `k` tag(s) (instead of having the kind onf the NIP-33 `d` tag) provides:
* Multiple `k` tags can exist in the same event if the application supports more than one event kind and their handler URLs are the same. * Multiple `k` tags can exist in the same event if the application supports more than one event kind and their handler URLs are the same.
* The same pubkey can have multiple events with different apps that handle the same event kind. * The same pubkey can have multiple events with different apps that handle the same event kind.
* `bech32` in a URL MUST be replaced by clients with the NIP-19-encoded entity that should be loaded by the application. * `bech32` in a URL MUST be replaced by clients with the NIP-19-encoded entity that should be loaded by the application.
Multiple tags might be registered by the app, following NIP-19 nomenclature as the second value of the array. Multiple tags might be registered by the app, following NIP-19 nomenclature as the second value of the array.
A tag without a second value in the array SHOULD be considered a generic handler for any NIP-19 entity that is not handled by a different tag. A tag without a second value in the array SHOULD be considered a generic handler for any NIP-19 entity that is not handled by a different tag.
# Client tag ## Client tag
When publishing events, clients MAY include a `client` tag in the same format as the recommendation event's `a` tags. This has privacy implications for users, so clients SHOULD allow users to opt-out of using this tag. When publishing events, clients MAY include a `client` tag in the same format as the recommendation event's `a` tags. This has privacy implications for users, so clients SHOULD allow users to opt-out of using this tag.
```json ```json
@ -87,43 +87,45 @@ When publishing events, clients MAY include a `client` tag in the same format as
} }
``` ```
# User flow ## User flow
A user A who uses a non-`kind:1`-centric nostr app could choose to announce/recommend a certain kind-handler application. A user A who uses a non-`kind:1`-centric nostr app could choose to announce/recommend a certain kind-handler application.
When user B sees an unknown event kind, e.g. in a social-media centric nostr client, the client would allow user B to interact with the unknown-kind event (e.g. tapping on it). When user B sees an unknown event kind, e.g. in a social-media centric nostr client, the client would allow user B to interact with the unknown-kind event (e.g. tapping on it).
The client MIGHT query for the user's and the user's follows handler. The client MIGHT query for the user's and the user's follows handler.
# Example ## Example
## User A recommends a `kind:31337`-handler ### User A recommends a `kind:31337`-handler
User A might be a user of Zapstr, a `kind:31337`-centric client (tracks). Using Zapstr, user A publishes an event recommending Zapstr as a `kind:31337`-handler. User A might be a user of Zapstr, a `kind:31337`-centric client (tracks). Using Zapstr, user A publishes an event recommending Zapstr as a `kind:31337`-handler.
```json ```json
{ {
"kind": 31989, "kind": 31989,
"tags": [ "tags": [
[ "d", "31337" ], ["d", "31337"],
[ "a", "31990:1743058db7078661b94aaf4286429d97ee5257d14a86d6bfa54cb0482b876fb0:abcd", <relay-url>, "web" ] ["a", "31990:1743058db7078661b94aaf4286429d97ee5257d14a86d6bfa54cb0482b876fb0:abcd", <relay-url>, "web"]
] ],
...
} }
``` ```
## User B interacts with a `kind:31337`-handler ### User B interacts with a `kind:31337`-handler
User B might see in their timeline an event referring to a `kind:31337` event User B might see in their timeline an event referring to a `kind:31337` event (e.g. a `kind:1` tagging a `kind:31337`).
(e.g. a `kind:1` tagging a `kind:31337`).
User B's client, not knowing how to handle a `kind:31337` might display the event User B's client, not knowing how to handle a `kind:31337` might display the event using its `alt` tag (as described in NIP-31). When the user clicks on the event, the application queries for a handler for this `kind`:
using its `alt` tag (as described in NIP-31). When the user clicks on the event,
the application queries for a handler for this `kind`:
`["REQ", <id>, '[{ "kinds": [31989], "#d": ["31337"], 'authors': [<user>, <users-contact-list>] }]']` ```json
["REQ", <id>, '[{ "kinds": [31989], "#d": ["31337"], 'authors': [<user>, <users-contact-list>] }]']
```
User B, who follows User A, sees that `kind:31989` event and fetches the `a`-tagged event for the app and handler information. User B, who follows User A, sees that `kind:31989` event and fetches the `a`-tagged event for the app and handler information.
User B's client sees the application's `kind:31990` which includes the information to redirect the user to the relevant URL with the desired entity replaced in the URL. User B's client sees the application's `kind:31990` which includes the information to redirect the user to the relevant URL with the desired entity replaced in the URL.
## Alternative query bypassing `kind:31989` ### Alternative query bypassing `kind:31989`
Alternatively, users might choose to query directly for `kind:31990` for an event kind. Clients SHOULD be careful doing this and use spam-prevention mechanisms to avoid directing users to malicious handlers. Alternatively, users might choose to query directly for `kind:31990` for an event kind. Clients SHOULD be careful doing this and use spam-prevention mechanisms or querying high-quality restricted relays to avoid directing users to malicious handlers.
`["REQ", <id>, '[{ "kinds": [31990], "#k": [<desired-event-kind>], 'authors': [...] }]']` ```json
["REQ", <id>, '[{ "kinds": [31990], "#k": [<desired-event-kind>], 'authors': [...] }]']
```

77
90.md
View File

@ -73,28 +73,28 @@ If the user wants to keep the input parameters a secret, they can encrypt the `i
```json ```json
[ [
[ "i", "what is the capital of France? ", "text" ], ["i", "what is the capital of France? ", "text"],
[ "param", "model", "LLaMA-2" ], ["param", "model", "LLaMA-2"],
[ "param", "max_tokens", "512" ], ["param", "max_tokens", "512"],
[ "param", "temperature", "0.5" ], ["param", "temperature", "0.5"],
[ "param", "top-k", "50" ], ["param", "top-k", "50"],
[ "param", "top-p", "0.7" ], ["param", "top-p", "0.7"],
[ "param", "frequency_penalty", "1" ] ["param", "frequency_penalty", "1"]
] ]
``` ```
This param data will be encrypted and added to the `content` field and `p` tag should be present This param data will be encrypted and added to the `content` field and `p` tag should be present
``` ```json
"content": "BE2Y4xvS6HIY7TozIgbEl3sAHkdZoXyLRRkZv4fLPh3R7LtviLKAJM5qpkC7D6VtMbgIt4iNcMpLtpo...", {
"content": "BE2Y4xvS6HIY7TozIgbEl3sAHkdZoXyLRRkZv4fLPh3R7LtviLKAJM5qpkC7D6VtMbgIt4iNcMpLtpo...",
"tags": [ "tags": [
["p", "04f74530a6ede6b24731b976b8e78fb449ea61f40ff10e3d869a3030c4edc91f"], ["p", "04f74530a6ede6b24731b976b8e78fb449ea61f40ff10e3d869a3030c4edc91f"],
["encrypted"] ["encrypted"]
] ],
...
}
``` ```
@ -108,12 +108,13 @@ Service providers publish job results, providing the output of the job result. T
"content": "<payload>", "content": "<payload>",
"kind": 6xxx, "kind": 6xxx,
"tags": [ "tags": [
[ "request", "<job-request>" ], ["request", "<job-request>"],
[ "e", "<job-request-id>", "<relay-hint>" ], ["e", "<job-request-id>", "<relay-hint>"],
[ "i", "<input-data>" ], ["i", "<input-data>"],
[ "p", "<customer's-pubkey>" ], ["p", "<customer's-pubkey>"],
[ "amount", "requested-payment-amount", "<optional-bolt11>" ] ["amount", "requested-payment-amount", "<optional-bolt11>"]
] ],
...
} }
``` ```
@ -125,24 +126,25 @@ Service providers publish job results, providing the output of the job result. T
If the request has encrypted params, then output should be encrypted and placed in `content` field. If the output is encrypted, then avoid including `i` tag with input-data as clear text. If the request has encrypted params, then output should be encrypted and placed in `content` field. If the output is encrypted, then avoid including `i` tag with input-data as clear text.
Add a tag encrypted to mark the output content as `encrypted` Add a tag encrypted to mark the output content as `encrypted`
```json ```json
{ {
"pubkey": "<service-provider pubkey>", "pubkey": "<service-provider pubkey>",
"content": "<encrypted payload>", "content": "<encrypted payload>",
"kind": 6xxx, "kind": 6xxx,
"tags": [ "tags": [
[ "request", "<job-request>" ], ["request", "<job-request>"],
[ "e", "<job-request-id>", "<relay-hint>" ], ["e", "<job-request-id>", "<relay-hint>"],
[ "p", "<customer's-pubkey>" ], ["p", "<customer's-pubkey>"],
[ "amount", "requested-payment-amount", "<optional-bolt11>" ], ["amount", "requested-payment-amount", "<optional-bolt11>"],
["encrypted"] ["encrypted"]
],
] ...
} }
``` ```
## Job feedback ## Job feedback
Service providers can give feedback about a job back to the customer. Service providers can give feedback about a job back to the customer.
```json ```json
@ -150,11 +152,12 @@ Service providers can give feedback about a job back to the customer.
"kind": 7000, "kind": 7000,
"content": "<empty-or-payload>", "content": "<empty-or-payload>",
"tags": [ "tags": [
[ "status", "<status>", "<extra-info>" ], ["status", "<status>", "<extra-info>"],
[ "amount", "requested-payment-amount", "<bolt11>" ], ["amount", "requested-payment-amount", "<bolt11>"],
[ "e", "<job-request-id>", "<relay-hint>" ], ["e", "<job-request-id>", "<relay-hint>"],
[ "p", "<customer's-pubkey>" ], ["p", "<customer's-pubkey>"],
] ],
...
} }
``` ```
@ -167,7 +170,7 @@ Service providers can give feedback about a job back to the customer.
### Job feedback status ### Job feedback status
| status | description | | status | description |
|--------|-------------| | -------- | ------------- |
| `payment-required` | Service Provider requires payment before continuing. | | `payment-required` | Service Provider requires payment before continuing. |
| `processing` | Service Provider is processing the job. | | `processing` | Service Provider is processing the job. |
| `error` | Service Provider was unable to process the job. | | `error` | Service Provider was unable to process the job. |
@ -178,6 +181,7 @@ Any job feedback event MIGHT include results in the `.content` field, as describ
# Protocol Flow # Protocol Flow
* Customer publishes a job request (e.g. `kind:5000` speech-to-text). * Customer publishes a job request (e.g. `kind:5000` speech-to-text).
* Service Providers MAY submit `kind:7000` job-feedback events (e.g. `payment-required`, `processing`, `error`, etc.). * Service Providers MAY submit `kind:7000` job-feedback events (e.g. `payment-required`, `processing`, `error`, etc.).
* Upon completion, the service provider publishes the result of the job with a `kind:6000` job-result event. * Upon completion, the service provider publishes the result of the job with a `kind:6000` job-result event.
@ -207,7 +211,7 @@ This gives a higher level of flexibility to service providers (which sophisticat
# Appendix 2: Service provider discoverability # Appendix 2: Service provider discoverability
Service Providers MAY use NIP-89 announcements to advertise their support for job kinds: Service Providers MAY use NIP-89 announcements to advertise their support for job kinds:
```json ```js
{ {
"kind": 31990, "kind": 31990,
"pubkey": "<pubkey>", "pubkey": "<pubkey>",
@ -216,9 +220,10 @@ Service Providers MAY use NIP-89 announcements to advertise their support for jo
\"about\": \"I'm a DVM specialized in translating Bitcoin content.\" \"about\": \"I'm a DVM specialized in translating Bitcoin content.\"
}", }",
"tags": [ "tags": [
[ "k", "5005" ], // e.g. translation ["k", "5005"], // e.g. translation
[ "t", "bitcoin" ] // e.g. optionally advertises it specializes in bitcoin audio transcription that won't confuse "Drivechains" with "Ridechains" ["t", "bitcoin"] // e.g. optionally advertises it specializes in bitcoin audio transcription that won't confuse "Drivechains" with "Ridechains"
] ],
...
} }
``` ```

7
94.md
View File

@ -28,9 +28,6 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr
```json ```json
{ {
"id": <32-bytes lowercase hex-encoded sha256 of the the serialized event data>,
"pubkey": <32-bytes lowercase hex-encoded public key of the event creator>,
"created_at": <unix timestamp in seconds>,
"kind": 1063, "kind": 1063,
"tags": [ "tags": [
["url",<string with URI of file>], ["url",<string with URI of file>],
@ -47,8 +44,8 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr
["summary", <excerpt>], ["summary", <excerpt>],
["alt", <description>] ["alt", <description>]
], ],
"content": <caption>, "content": "<caption>",
"sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> ...
} }
``` ```

12
98.md
View File

@ -2,7 +2,7 @@ NIP-98
====== ======
HTTP Auth HTTP Auth
------------------------- ---------
`draft` `optional` `draft` `optional`
@ -30,14 +30,8 @@ Example event:
"kind": 27235, "kind": 27235,
"created_at": 1682327852, "created_at": 1682327852,
"tags": [ "tags": [
[ ["u", "https://api.snort.social/api/v1/n5sp/list"],
"u", ["method", "GET"]
"https://api.snort.social/api/v1/n5sp/list"
],
[
"method",
"GET"
]
], ],
"sig": "5ed9d8ec958bc854f997bdc24ac337d005af372324747efe4a00e24f4c30437ff4dd8308684bed467d9d6be3e5a517bb43b1732cc7d33949a3aaf86705c22184" "sig": "5ed9d8ec958bc854f997bdc24ac337d005af372324747efe4a00e24f4c30437ff4dd8308684bed467d9d6be3e5a517bb43b1732cc7d33949a3aaf86705c22184"
} }

6
99.md
View File

@ -1,6 +1,8 @@
# NIP-99 NIP-99
======
## Classified Listings Classified Listings
-------------------
`draft` `optional` `draft` `optional`