From 5dcfe85306434f21ecb1e7a47edd92b2e3e64f9a Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 18 Nov 2023 09:13:12 -0300 Subject: [PATCH] reformat a bunch of json things and small nitpicks. --- 11.md | 18 +++--- 13.md | 6 +- 14.md | 8 ++- 15.md | 205 ++++++++++++++++++++++++++++++---------------------------- 28.md | 46 ++++++------- 32.md | 9 ++- 36.md | 26 ++++---- 39.md | 28 ++++---- 40.md | 24 +++---- 42.md | 14 ++-- 45.md | 21 ++++-- 53.md | 30 ++++----- 56.md | 1 - 72.md | 14 ++-- 75.md | 17 +++-- 84.md | 11 +++- 89.md | 84 ++++++++++++------------ 90.md | 147 +++++++++++++++++++++-------------------- 94.md | 7 +- 98.md | 28 ++++---- 99.md | 6 +- 21 files changed, 385 insertions(+), 365 deletions(-) diff --git a/11.md b/11.md index e05cb1fa..ab05f31d 100644 --- a/11.md +++ b/11.md @@ -68,7 +68,6 @@ are rejected or fail immediately. ```json { - ... "limitation": { "max_message_length": 16384, "max_subscriptions": 20, @@ -82,7 +81,8 @@ are rejected or fail immediately. "payment_required": true, "created_at_lower_limit": 31536000, "created_at_upper_limit": 3 - } + }, + ... } ``` @@ -181,8 +181,8 @@ flexibility is up to the client software. ```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 { + "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 { - ... "payments_url": "https://my-relay/payments", "fees": { "admission": [{ "amount": 1000000, "unit": "msats" }], "subscription": [{ "amount": 5000000, "unit": "msats", "period": 2592000 }], "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 { - ... "icon": "https://nostr.build/i/53866b44135a27d624e99c6165cabd76ac8f72797209700acb189fce75021f47.jpg", + ... } ``` diff --git a/13.md b/13.md index 4b15bbe5..53c4d1b6 100644 --- a/13.md +++ b/13.md @@ -35,11 +35,7 @@ Example mined note "created_at": 1651794653, "kind": 1, "tags": [ - [ - "nonce", - "776797", - "21" - ] + ["nonce", "776797", "21"] ], "content": "It's just me mining my own business", "sig": "284622fc0a3f4f1303455d5175f7ba962a3300d136085b9566801bc2e0699de0c7e31e44c81fb40ad9049173742e904713c3594a1da0fc5d2382a25c11aba977" diff --git a/14.md b/14.md index 72e5e396..480c4c57 100644 --- a/14.md +++ b/14.md @@ -6,14 +6,16 @@ Subject tag in Text events `draft` `optional` -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) -`["subject": ]` +```json +["subject": ] +``` 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. When replying to a message with a subject, clients SHOULD replicate the subject tag. Clients MAY adorn the subject to denote -that it is a reply. e.g. by prepending "Re:". +that it is a reply. e.g. by prepending "Re:". Subjects should generally be shorter than 80 chars. Long subjects will likely be trimmed by clients. diff --git a/15.md b/15.md index 0ee000fa..51b7792e 100644 --- a/15.md +++ b/15.md @@ -1,14 +1,14 @@ 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 @@ -35,29 +35,30 @@ The `merchant` admin software can be purely clientside, but for `convenience` an A merchant can publish these events: | 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. | | `30018` | `set_product` | Create or update a product. | -| `4 ` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. | -| `5 ` | `delete` | Delete a product or a stall. | +| `4` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. | +| `5` | `delete` | Delete a product or a stall. | ### Event `30017`: Create or update a stall. -**Event Content**: +**Event Content** + ```json { - "id": , - "name": , - "description": , - "currency": , - "shipping": [ - { - "id": , - "name": , - "cost": , - "regions": [], - } - ] + "id": , + "name": , + "description": , + "currency": , + "shipping": [ + { + "id": , + "name": , + "cost": , + "regions": [], + } + ] } ``` @@ -70,34 +71,39 @@ 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 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 - "tags": [["d", , - "stall_id": , - "name": , - "description": , - "images": <[String], array of image URLs, optional>, - "currency": , - "price": , - "quantity": , - "specs": [ - [, ] - ], - "shipping": [ - { - "id": , - "cost": , - } - ] + "id": , + "stall_id": , + "name": , + "description": , + "images": <[string], array of image URLs, optional>, + "currency": , + "price": , + "quantity": , + "specs": [ + [, ] + ], + "shipping": [ + { + "id": , + "cost": , + } + ] } ``` @@ -114,16 +120,18 @@ Fields that are not self-explanatory: - the `id` should match the id of the shipping zone, as defined in the `shipping` field of the stall - to calculate the total cost of shipping for an order, the user will choose a shipping option during checkout, and then the client must consider this costs: - 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 "tags": [ - ["d", , - "type": 0, - "name": , - "address": - "message": ", - "contact": { - "nostr": <32-bytes hex of a pubkey>, - "phone": , - "email": , - }, - "items": [ - { - "product_id": , - "quantity": - } - ], - "shipping_id": + "id": , + "type": 0, + "name": , + "address": + "message": ", + "contact": { + "nostr": <32-bytes hex of a pubkey>, + "phone": , + "email": , + }, + "items": [ + { + "product_id": , + "quantity": + } + ], + "shipping_id": } ``` @@ -186,23 +194,23 @@ The below json goes in `content` of [NIP04](https://github.com/nostr-protocol/ni ```json { - "id": , - "type": 1, - "message": , - "payment_options": [ - { - "type": , - "link": - }, - { - "type": , - "link": - }, - { - "type": , - "link": - } - ] + "id": , + "type": 1, + "message": , + "payment_options": [ + { + "type": , + "link": + }, + { + "type": , + "link": + }, + { + "type": , + "link": + } + ] } ``` @@ -214,11 +222,11 @@ The below json goes in `content` of [NIP04](https://github.com/nostr-protocol/ni ```json { - "id": , - "type": 2, - "message": , - "paid": , - "shipped": , + "id": , + "type": 2, + "message": , + "paid": , + "shipped": , } ``` ## Customize Marketplace @@ -226,19 +234,20 @@ Create a customized user experience using the `naddr` from [NIP-19](https://gith ### Event `30019`: Create or update marketplace UI/UX -**Event Content**: +**Event Content** + ```json { - "name": , - "about": , - "ui": { - "picture": , - "banner": , - "theme": , - "darkMode": - }, - "merchants": <[String] (optional), array of pubkeys>, - ... + "name": , + "about": , + "ui": { + "picture": , + "banner": , + "theme": , + "darkMode": + }, + "merchants": [array of pubkeys (optional)], + ... } ``` diff --git a/28.md b/28.md index 59e9389b..2dcf8003 100644 --- a/28.md +++ b/28.md @@ -27,8 +27,8 @@ In the channel creation `content` field, Client SHOULD include basic channel met ```json { - "content": "{\"name\": \"Demo Channel\", \"about\": \"A test channel.\", \"picture\": \"https://placekitten.com/200/200\"}", - ... + "content": "{\"name\": \"Demo Channel\", \"about\": \"A test channel.\", \"picture\": \"https://placekitten.com/200/200\"}", + ... } ``` @@ -37,7 +37,7 @@ In the channel creation `content` field, Client SHOULD include basic channel met 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. @@ -53,9 +53,9 @@ Clients SHOULD use [NIP-10](10.md) marked "e" tags to recommend a relay. ```json { - "content": "{\"name\": \"Updated Demo Channel\", \"about\": \"Updating a test channel.\", \"picture\": \"https://placekitten.com/201/201\"}", - "tags": [["e", , ]], - ... + "content": "{\"name\": \"Updated Demo Channel\", \"about\": \"Updating a test channel.\", \"picture\": \"https://placekitten.com/201/201\"}", + "tags": [["e", , ]], + ... } ``` @@ -72,9 +72,9 @@ Root message: ```json { - "content": , - "tags": [["e", , , "root"]], - ... + "content": , + "tags": [["e", , , "root"]], + ... } ``` @@ -82,14 +82,14 @@ Reply to another message: ```json { - "content": , - "tags": [ - ["e", , , "root"], - ["e", , , "reply"], - ["p", , ], - ... - ], - ... + "content": , + "tags": [ + ["e", , , "root"], + ["e", , , "reply"], + ["p", , ], + ... + ], + ... } ``` @@ -108,9 +108,9 @@ Clients MAY hide event 42s for other users other than the user who sent the even ```json { - "content": "{\"reason\": \"Dick pic\"}", - "tags": [["e", ]], - ... + "content": "{\"reason\": \"Dick pic\"}", + "tags": [["e", ]], + ... } ``` @@ -126,9 +126,9 @@ Clients MAY hide event 42s for users other than the user who sent the event 44. ```json { - "content": "{\"reason\": \"Posting dick pics\"}", - "tags": [["p", ]], - ... + "content": "{\"reason\": \"Posting dick pics\"}", + "tags": [["p", ]], + ... } ``` diff --git a/32.md b/32.md index dfcb35ea..be4e8724 100644 --- a/32.md +++ b/32.md @@ -64,7 +64,8 @@ A suggestion that multiple pubkeys be associated with the `permies` topic. ["l", "permies", "#t"], ["p", , ], ["p", , ] - ] + ], + ... } ``` @@ -78,7 +79,8 @@ A report flagging violence toward a human being as defined by ontology.example.c ["l", "VI-hum", "com.example.ontology"], ["p", , ], ["p", , ] - ] + ], + ... } ``` @@ -92,6 +94,7 @@ A moderation suggestion for a chat event. ["l", "approve", "nip28.moderation"], ["e", , ] ], + ... } ``` @@ -105,6 +108,7 @@ Assignment of a license to an event. ["l", "MIT", "license"], ["e", , ] ], + ... } ``` @@ -119,6 +123,7 @@ is labeling their note as being related to Milan, Italy using ISO 3166-2. ["l", "IT-MI", "ISO-3166-2"] ], "content": "It's beautiful here in Milan!", + ... } ``` diff --git a/36.md b/36.md index db4c4f2f..b10262c2 100644 --- a/36.md +++ b/36.md @@ -24,18 +24,18 @@ options: ```json { - "pubkey": "", - "created_at": 1000000000, - "kind": 1, - "tags": [ - ["t", "hastag"], - ["L", "content-warning"], - ["l", "reason", "content-warning"], - ["L", "social.nos.ontology"], - ["l", "NS-nud", "social.nos.ontology"], - ["content-warning", "reason"] /* reason is optional */ - ], - "content": "sensitive content with #hastag\n", - "id": "" + "pubkey": "", + "created_at": 1000000000, + "kind": 1, + "tags": [ + ["t", "hastag"], + ["L", "content-warning"], + ["l", "reason", "content-warning"], + ["L", "social.nos.ontology"], + ["l", "NS-nud", "social.nos.ontology"], + ["content-warning", ""] + ], + "content": "sensitive content with #hastag\n", + "id": "" } ``` diff --git a/39.md b/39.md index c9970fa5..c819e43b 100644 --- a/39.md +++ b/39.md @@ -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): ```json { - "id": , - "pubkey": , - ... - "tags": [ - ["i", "github:semisol", "9721ce4ee4fceb91c9711ca2a6c9a5ab"], - ["i", "twitter:semisol_public", "1619358434134196225"], - ["i", "mastodon:bitcoinhackers.org/@semisol", "109775066355589974"] - ["i", "telegram:1087295469", "nostrdirectory/770"] - ] + "tags": [ + ["i", "github:semisol", "9721ce4ee4fceb91c9711ca2a6c9a5ab"], + ["i", "twitter:semisol_public", "1619358434134196225"], + ["i", "mastodon:bitcoinhackers.org/@semisol", "109775066355589974"] + ["i", "telegram:1087295469", "nostrdirectory/770"] + ], + ... } ``` @@ -31,9 +29,9 @@ An `i` tag will have two parameters, which are defined as the following: 1. `platform:identity`: This is the platform name (for example `github`) and the identity on that platform (for example `semisol`) joined together with `:`. 2. `proof`: String or object that points to the proof of owning this identity. -Clients SHOULD process any `i` tags with more than 2 values for future extensibility. -Identity provider names SHOULD only include `a-z`, `0-9` and the characters `._-/` and MUST NOT include `:`. -Identity names SHOULD be normalized if possible by replacing uppercase letters with lowercase letters, and if there are multiple aliases for an entity the primary one should be used. +Clients SHOULD process any `i` tags with more than 2 values for future extensibility. +Identity provider names SHOULD only include `a-z`, `0-9` and the characters `._-/` and MUST NOT include `:`. +Identity names SHOULD be normalized if possible by replacing uppercase letters with lowercase letters, and if there are multiple aliases for an entity the primary one should be used. ## Claim types @@ -41,14 +39,14 @@ Identity names SHOULD be normalized if possible by replacing uppercase letters w Identity: A GitHub username. -Proof: A GitHub Gist ID. This Gist should be created by `` with a single file that has the text `Verifying that I control the following Nostr public key: `. +Proof: A GitHub Gist ID. This Gist should be created by `` with a single file that has the text `Verifying that I control the following Nostr public key: `. This can be located at `https://gist.github.com//`. ### `twitter` Identity: A Twitter username. -Proof: A Tweet ID. The tweet should be posted by `` and have the text `Verifying my account on nostr My Public Key: ""`. +Proof: A Tweet ID. The tweet should be posted by `` and have the text `Verifying my account on nostr My Public Key: ""`. This can be located at `https://twitter.com//status/`. ### `mastodon` @@ -62,5 +60,5 @@ This can be located at `https:///`. Identity: A Telegram user ID. -Proof: A string in the format `/` which points to a message published in the public channel or group with name `` and message ID ``. This message should be sent by user ID `` and have the text `Verifying that I control the following Nostr public key: ""`. +Proof: A string in the format `/` which points to a message published in the public channel or group with name `` and message ID ``. This message should be sent by user ID `` and have the text `Verifying that I control the following Nostr public key: ""`. This can be located at `https://t.me/`. diff --git a/40.md b/40.md index b8a03365..909747f5 100644 --- a/40.md +++ b/40.md @@ -2,7 +2,7 @@ NIP-40 ====== Expiration Timestamp ------------------------------------ +-------------------- `draft` `optional` @@ -20,14 +20,14 @@ values: ```json { - "pubkey": "", - "created_at": 1000000000, - "kind": 1, - "tags": [ - ["expiration", "1600000000"] - ], - "content": "This message will expire at the specified timestamp and be deleted by relays.\n", - "id": "" + "pubkey": "", + "created_at": 1000000000, + "kind": 1, + "tags": [ + ["expiration", "1600000000"] + ], + "content": "This message will expire at the specified timestamp and be deleted by relays.\n", + "id": "" } ``` @@ -43,9 +43,9 @@ Clients SHOULD ignore events that have expired. Relay Behavior -------------- -Relays MAY NOT delete expired messages immediately on expiration and MAY persist them indefinitely. -Relays SHOULD NOT send expired events to clients, even if they are stored. -Relays SHOULD drop any events that are published to them if they are expired. +Relays MAY NOT delete expired messages immediately on expiration and MAY persist them indefinitely. +Relays SHOULD NOT send expired events to clients, even if they are stored. +Relays SHOULD drop any events that are published to them if they are expired. An expiration timestamp does not affect storage of ephemeral events. Suggested Use Cases diff --git a/42.md b/42.md index 9f0c24dd..e380e89a 100644 --- a/42.md +++ b/42.md @@ -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 to authenticate. When sent by relays, the message is of the following form: -``` +```json ["AUTH", ] ``` And, when sent by clients, of the following form: -``` +```json ["AUTH", ] ``` @@ -41,16 +41,12 @@ Relays MUST exclude `kind: 22242` events from being broadcasted to any client. ```json { - "id": "...", - "pubkey": "...", - "created_at": 1669695536, "kind": 22242, "tags": [ ["relay", "wss://relay.example.com/"], ["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 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?"] ``` or it can return an `OK` message noting the reason an event was not written using the same prefix: -``` +```json ["OK", , false, "restricted: we do not accept events from unauthenticated users, please sign up at https://example.com/"] ``` diff --git a/45.md b/45.md index a3abd19d..998b9529 100644 --- a/45.md +++ b/45.md @@ -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. -``` +```json ["COUNT", , ...] ``` Counts are returned using a `COUNT` response in the form `{"count": }`. 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": , "approximate": }`. -``` +```json ["COUNT", , {"count": }] ``` -Examples: +## Examples: -``` -# Followers count +### Followers count + +```json ["COUNT", , {"kinds": [3], "#p": []}] ["COUNT", , {"count": 238}] +``` -# Count posts and reactions +### Count posts and reactions + +```json ["COUNT", , {"kinds": [1, 7], "authors": []}] ["COUNT", , {"count": 5}] +``` -# Count posts approximately +### Count posts approximately + +``` ["COUNT", , {"kinds": [1]}] ["COUNT", , {"count": 93412452, "approximate": true}] ``` diff --git a/53.md b/53.md index c4789ea1..d3cc0afd 100644 --- a/53.md +++ b/53.md @@ -6,17 +6,17 @@ Live Activities `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. -# 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. For example: -```js +```json { "kind": 30311, "tags": [ @@ -38,7 +38,7 @@ For example: ["relays", "wss://one.com", "wss://two.com", ...] ], "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. -## 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. @@ -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. -# 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. -```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": "", "kind": 1311, "tags": [ ["a", "30311::", "", "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). -# Example +## Example -Live Streaming +### Live Streaming ```json { @@ -107,7 +105,7 @@ Live Streaming } ``` -Live Streaming chat message +### Live Streaming chat message ```json { diff --git a/56.md b/56.md index 0c951b5b..a2861e35 100644 --- a/56.md +++ b/56.md @@ -1,4 +1,3 @@ - NIP-56 ====== diff --git a/72.md b/72.md index 74c7f086..c0fffffc 100644 --- a/72.md +++ b/72.md @@ -14,7 +14,6 @@ The goal of this NIP is to create moderator-approved public communities around a ```json { - ... "created_at": , "kind": 34550, "tags": [ @@ -34,7 +33,8 @@ The goal of this NIP is to create moderator-approved public communities around a ["relay", "", "requests"], ["relay", "", "approvals"], ["relay", ""] - ] + ], + ... } ``` @@ -44,12 +44,12 @@ Any Nostr event can be submitted to a community by anyone for approval. Clients ```json { - ... "kind": 1, "tags": [ ["a", "34550::", ""], ], - "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 { - ... "pubkey": "<32-bytes lowercase hex-encoded public key of the event creator>", "kind": 4550, "tags": [ @@ -70,7 +69,8 @@ The post-approval event MUST include `a` tags of the communities the moderator i ["p", "", ""], ["k", ""] ], - "content": "" + "content": "", + ... } ``` @@ -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. -```js +```json [ "REQ", "_", diff --git a/75.md b/75.md index 3a89f904..f3cf5d06 100644 --- a/75.md +++ b/75.md @@ -1,6 +1,8 @@ -# NIP-75 +NIP-75 +====== -## Zap Goals +Zap Goals +--------- `draft` `optional` @@ -27,7 +29,7 @@ Example event: ["amount", "210000"], ], "content": "Nostrasia travel expenses", - ...other fields + ... ``` The following tags are OPTIONAL. @@ -43,7 +45,8 @@ The following tags are OPTIONAL. ["closed_at", ""], ], "content": "Nostrasia travel expenses", - ...other fields + ... +} ``` 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 { - "kind": 3XXXX, + ... + "kind": 3xxxx, "tags": [ ... ["goal", "", ""], ], - ...other fields + ... +} ``` ## Client behavior diff --git a/84.md b/84.md index 303cd933..d5f54d4c 100644 --- a/84.md +++ b/84.md @@ -27,9 +27,14 @@ useful when highlighting non-nostr content for which the client might be able to last value of the tag. ```json -[ "p", "", "", "author" ], -[ "p", "", "", "author" ], -[ "p", "", "", "editor" ], +{ + "tags": [ + ["p", "", "", "author"], + ["p", "", "", "author"], + ["p", "", "", "editor"] + ], + ... +} ``` ### Context diff --git a/89.md b/89.md index 73cb7bd5..be3d075d 100644 --- a/89.md +++ b/89.md @@ -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. ## Rationale + 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. ### Parties involved + 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) @@ -22,18 +24,18 @@ There are three actors to this workflow: * 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` -# Events +## Events -## Recommendation event +### Recommendation event ```json { - "kind": 31989, - "pubkey": , - "tags": [ - [ "d", ], - [ "a", "31990:app1-pubkey:", "wss://relay1", "ios" ], - [ "a", "31990:app2-pubkey:", "wss://relay2", "web" ] - ] + "kind": 31989, + "pubkey": , + "tags": [ + ["d", ], + ["a", "31990:app1-pubkey:", "wss://relay1", "ios"], + ["a", "31990:app2-pubkey:", "wss://relay2", "web"] + ] } ``` @@ -47,34 +49,32 @@ The third value of the tag SHOULD be the platform where this recommendation migh ## Handler information ```json { - "kind": 31990, - "pubkey": , - "content": "", - "tags": [ - [ "d", ], - [ "k", ], - [ "web", "https://..../a/", "nevent" ], - [ "web", "https://..../p/", "nprofile" ], - [ "web", "https://..../e/" ], - [ "ios", ".../" ] - ] + "kind": 31990, + "pubkey": "", + "content": "", + "tags": [ + ["d", ], + ["k", ], + ["web", "https://..../a/", "nevent"], + ["web", "https://..../p/", "nprofile"], + ["web", "https://..../e/"], + ["ios", ".../"] + ] } ``` * `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`. 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. * 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. 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. -# 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. ```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. 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. -# 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. ```json { - "kind": 31989, - "tags": [ - [ "d", "31337" ], - [ "a", "31990:1743058db7078661b94aaf4286429d97ee5257d14a86d6bfa54cb0482b876fb0:abcd", , "web" ] - ] + "kind": 31989, + "tags": [ + ["d", "31337"], + ["a", "31990:1743058db7078661b94aaf4286429d97ee5257d14a86d6bfa54cb0482b876fb0:abcd", , "web"] + ], + ... } ``` -## User B interacts with a `kind:31337`-handler -User B might see in their timeline an event referring to a `kind:31337` event -(e.g. a `kind:1` tagging a `kind:31337`). +### User B interacts with a `kind:31337`-handler +User B might see in their timeline an event referring to a `kind:31337` event (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 -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`: +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`: -`["REQ", , '[{ "kinds": [31989], "#d": ["31337"], 'authors': [, ] }]']` +```json +["REQ", , '[{ "kinds": [31989], "#d": ["31337"], 'authors': [, ] }]'] +``` 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. -## 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. +### 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 or querying high-quality restricted relays to avoid directing users to malicious handlers. -`["REQ", , '[{ "kinds": [31990], "#k": [], 'authors': [...] }]']` +```json +["REQ", , '[{ "kinds": [31990], "#k": [], 'authors': [...] }]'] +``` diff --git a/90.md b/90.md index c498cddd..6017c98c 100644 --- a/90.md +++ b/90.md @@ -13,11 +13,11 @@ Money in, data out. ## Kinds This NIP reserves the range `5000-7000` for data vending machine use. -| Kind | Description | -| ---- | ----------- | +| Kind | Description | +| ---- | ----------- | | 5000-5999 | Job request kinds | -| 6000-6999 | Job result | -| 7000 | Job feedback | +| 6000-6999 | Job result | +| 7000 | Job feedback | Job results always use a kind number that is `1000` higher than the job request kind. (e.g. request: `kind:5001` gets a result: `kind:6001`). @@ -67,34 +67,34 @@ All tags are optional. * `relays`: List of relays where Service Providers SHOULD publish responses to * `p`: Service Providers the customer is interested in. Other SPs MIGHT still choose to process the job -## Encrypted Params +## Encrypted Params If the user wants to keep the input parameters a secret, they can encrypt the `i` and `param` tags with the service provider's 'p' tag and add it to the content field. Add a tag `encrypted` as tags. Encryption for private tags will use [NIP-04 - Encrypted Direct Message encryption](https://github.com/nostr-protocol/nips/blob/master/04.md), using the user's private and service provider's public key for the shared secret ```json [ - [ "i", "what is the capital of France? ", "text" ], - [ "param", "model", "LLaMA-2" ], - [ "param", "max_tokens", "512" ], - [ "param", "temperature", "0.5" ], - [ "param", "top-k", "50" ], - [ "param", "top-p", "0.7" ], - [ "param", "frequency_penalty", "1" ] - + ["i", "what is the capital of France? ", "text"], + ["param", "model", "LLaMA-2"], + ["param", "max_tokens", "512"], + ["param", "temperature", "0.5"], + ["param", "top-k", "50"], + ["param", "top-p", "0.7"], + ["param", "frequency_penalty", "1"] ] ``` -This param data will be encrypted and added to the `content` field and `p` tag should be present - -``` -"content": "BE2Y4xvS6HIY7TozIgbEl3sAHkdZoXyLRRkZv4fLPh3R7LtviLKAJM5qpkC7D6VtMbgIt4iNcMpLtpo...", - "tags": [ - ["p", "04f74530a6ede6b24731b976b8e78fb449ea61f40ff10e3d869a3030c4edc91f"], - ["encrypted"] - ] - +This param data will be encrypted and added to the `content` field and `p` tag should be present +```json +{ + "content": "BE2Y4xvS6HIY7TozIgbEl3sAHkdZoXyLRRkZv4fLPh3R7LtviLKAJM5qpkC7D6VtMbgIt4iNcMpLtpo...", + "tags": [ + ["p", "04f74530a6ede6b24731b976b8e78fb449ea61f40ff10e3d869a3030c4edc91f"], + ["encrypted"] + ], + ... +} ``` @@ -104,16 +104,17 @@ Service providers publish job results, providing the output of the job result. T ```json { - "pubkey": "", - "content": "", - "kind": 6xxx, - "tags": [ - [ "request", "" ], - [ "e", "", "" ], - [ "i", "" ], - [ "p", "" ], - [ "amount", "requested-payment-amount", "" ] - ] + "pubkey": "", + "content": "", + "kind": 6xxx, + "tags": [ + ["request", ""], + ["e", "", ""], + ["i", ""], + ["p", ""], + ["amount", "requested-payment-amount", ""] + ], + ... } ``` @@ -123,38 +124,40 @@ Service providers publish job results, providing the output of the job result. T ## Encrypted Output -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` + ```json { - "pubkey": "", - "content": "", - "kind": 6xxx, - "tags": [ - [ "request", "" ], - [ "e", "", "" ], - [ "p", "" ], - [ "amount", "requested-payment-amount", "" ], - ["encrypted"] - - ] + "pubkey": "", + "content": "", + "kind": 6xxx, + "tags": [ + ["request", ""], + ["e", "", ""], + ["p", ""], + ["amount", "requested-payment-amount", ""], + ["encrypted"] + ], + ... } ``` - ## Job feedback + Service providers can give feedback about a job back to the customer. ```json { - "kind": 7000, - "content": "", - "tags": [ - [ "status", "", "" ], - [ "amount", "requested-payment-amount", "" ], - [ "e", "", "" ], - [ "p", "" ], - ] + "kind": 7000, + "content": "", + "tags": [ + ["status", "", ""], + ["amount", "requested-payment-amount", ""], + ["e", "", ""], + ["p", ""], + ], + ... } ``` @@ -166,18 +169,19 @@ Service providers can give feedback about a job back to the customer. ### Job feedback status -| status | description | -|--------|-------------| -| `payment-required` | Service Provider requires payment before continuing. | -| `processing` | Service Provider is processing the job. | -| `error` | Service Provider was unable to process the job. | -| `success` | Service Provider successfully processed the job. | -| `partial` | Service Provider partially processed the job. The `.content` might include a sample of the partial results. | +| status | description | +| -------- | ------------- | +| `payment-required` | Service Provider requires payment before continuing. | +| `processing` | Service Provider is processing the job. | +| `error` | Service Provider was unable to process the job. | +| `success` | Service Provider successfully processed the job. | +| `partial` | Service Provider partially processed the job. The `.content` might include a sample of the partial results. | Any job feedback event MIGHT include results in the `.content` field, as described in the [Job Result](#job-result) section. This is useful for service providers to provide a sample of the results that have been processed so far. # Protocol Flow + * 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.). * Upon completion, the service provider publishes the result of the job with a `kind:6000` job-result event. @@ -207,18 +211,19 @@ This gives a higher level of flexibility to service providers (which sophisticat # Appendix 2: Service provider discoverability Service Providers MAY use NIP-89 announcements to advertise their support for job kinds: -```json +```js { - "kind": 31990, - "pubkey": "", - "content": "{ - \"name\": \"Translating DVM\", - \"about\": \"I'm a DVM specialized in translating Bitcoin content.\" - }", - "tags": [ - [ "k", "5005" ], // e.g. translation - [ "t", "bitcoin" ] // e.g. optionally advertises it specializes in bitcoin audio transcription that won't confuse "Drivechains" with "Ridechains" - ] + "kind": 31990, + "pubkey": "", + "content": "{ + \"name\": \"Translating DVM\", + \"about\": \"I'm a DVM specialized in translating Bitcoin content.\" + }", + "tags": [ + ["k", "5005"], // e.g. translation + ["t", "bitcoin"] // e.g. optionally advertises it specializes in bitcoin audio transcription that won't confuse "Drivechains" with "Ridechains" + ], + ... } ``` diff --git a/94.md b/94.md index 0b76c25b..95b6a3bc 100644 --- a/94.md +++ b/94.md @@ -28,9 +28,6 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr ```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": , "kind": 1063, "tags": [ ["url",], @@ -47,8 +44,8 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr ["summary", ], ["alt", ] ], - "content": , - "sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> + "content": "", + ... } ``` diff --git a/98.md b/98.md index e04c7fc1..ca523042 100644 --- a/98.md +++ b/98.md @@ -2,7 +2,7 @@ NIP-98 ====== HTTP Auth -------------------------- +--------- `draft` `optional` @@ -24,22 +24,16 @@ The following tags MUST be included. Example event: ```json { - "id": "fe964e758903360f28d8424d092da8494ed207cba823110be3a57dfe4b578734", - "pubkey": "63fe6318dc58583cfe16810f86dd09e18bfd76aabc24a0081ce2856f330504ed", - "content": "", - "kind": 27235, - "created_at": 1682327852, - "tags": [ - [ - "u", - "https://api.snort.social/api/v1/n5sp/list" - ], - [ - "method", - "GET" - ] - ], - "sig": "5ed9d8ec958bc854f997bdc24ac337d005af372324747efe4a00e24f4c30437ff4dd8308684bed467d9d6be3e5a517bb43b1732cc7d33949a3aaf86705c22184" + "id": "fe964e758903360f28d8424d092da8494ed207cba823110be3a57dfe4b578734", + "pubkey": "63fe6318dc58583cfe16810f86dd09e18bfd76aabc24a0081ce2856f330504ed", + "content": "", + "kind": 27235, + "created_at": 1682327852, + "tags": [ + ["u", "https://api.snort.social/api/v1/n5sp/list"], + ["method", "GET"] + ], + "sig": "5ed9d8ec958bc854f997bdc24ac337d005af372324747efe4a00e24f4c30437ff4dd8308684bed467d9d6be3e5a517bb43b1732cc7d33949a3aaf86705c22184" } ``` diff --git a/99.md b/99.md index 9e8f1dad..e65920c6 100644 --- a/99.md +++ b/99.md @@ -1,6 +1,8 @@ -# NIP-99 +NIP-99 +====== -## Classified Listings +Classified Listings +------------------- `draft` `optional`