Merge branch 'master' into nip88

This commit is contained in:
Pablo Fernandez 2023-11-23 17:52:48 +02:00 committed by GitHub
commit 60256a6267
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 856 additions and 703 deletions

4
01.md
View File

@ -4,7 +4,7 @@ NIP-01
Basic protocol flow description Basic protocol flow description
------------------------------- -------------------------------
`draft` `mandatory` `author:fiatjaf` `author:distbit` `author:scsibug` `author:kukks` `author:jb55` `author:semisol` `author:cameri` `author:Giszmo` `draft` `mandatory`
This NIP defines the basic protocol that should be implemented by everybody. New NIPs may add new optional (or mandatory) fields and messages and features to the structures and flows described here. This NIP defines the basic protocol that should be implemented by everybody. New NIPs may add new optional (or mandatory) fields and messages and features to the structures and flows described here.
@ -150,7 +150,7 @@ Relays can send 4 types of messages, which must also be JSON arrays, according t
This NIP defines no rules for how `NOTICE` messages should be sent or treated. This NIP defines no rules for how `NOTICE` messages should be sent or treated.
- `EVENT` messages MUST be sent only with a subscription ID related to a subscription previously initiated by the client (using the `REQ` message above). - `EVENT` messages MUST be sent only with a subscription ID related to a subscription previously initiated by the client (using the `REQ` message above).
- `OK` messages MUST be sent in response to `EVENT` messages received from clients, they must have the 3rd parameter set to `true` when an event has been accepted by the relay, `false` otherwise. The 4th parameter MAY be empty when the 3rd is `true`, otherwise it MUST be a string containing a machine-readable single-word prefix followed by a `:` and then a human-readable message. The standardized machine-readable prefixes are: `duplicate`, `pow`, `blocked`, `rate-limited`, `invalid`, and `error` for when none of that fits. Some examples: - `OK` messages MUST be sent in response to `EVENT` messages received from clients, they must have the 3rd parameter set to `true` when an event has been accepted by the relay, `false` otherwise. The 4th parameter MUST always be present, but MAY be an empty string when the 3rd is `true`, otherwise it MUST be a string formed by a machine-readable single-word prefix followed by a `:` and then a human-readable message. The standardized machine-readable prefixes are: `duplicate`, `pow`, `blocked`, `rate-limited`, `invalid`, and `error` for when none of that fits. Some examples:
* `["OK", "b1a649ebe8...", true, ""]` * `["OK", "b1a649ebe8...", true, ""]`
* `["OK", "b1a649ebe8...", true, "pow: difficulty 25>=24"]` * `["OK", "b1a649ebe8...", true, "pow: difficulty 25>=24"]`

2
02.md
View File

@ -4,7 +4,7 @@ NIP-02
Contact List and Petnames Contact List and Petnames
------------------------- -------------------------
`final` `optional` `author:fiatjaf` `author:arcbtc` `final` `optional`
A special event with kind `3`, meaning "contact list" is defined as having a list of `p` tags, one for each of the followed/known profiles one is following. A special event with kind `3`, meaning "contact list" is defined as having a list of `p` tags, one for each of the followed/known profiles one is following.

4
03.md
View File

@ -4,7 +4,7 @@ NIP-03
OpenTimestamps Attestations for Events OpenTimestamps Attestations for Events
-------------------------------------- --------------------------------------
`draft` `optional` `author:fiatjaf` `author:constant` `draft` `optional`
This NIP defines an event with `kind:1040` that can contain an [OpenTimestamps](https://opentimestamps.org/) proof for any other event: This NIP defines an event with `kind:1040` that can contain an [OpenTimestamps](https://opentimestamps.org/) proof for any other event:
@ -20,7 +20,7 @@ This NIP defines an event with `kind:1040` that can contain an [OpenTimestamps](
``` ```
- The OpenTimestamps proof MUST prove the referenced `e` event id as its digest. - The OpenTimestamps proof MUST prove the referenced `e` event id as its digest.
- The `content` MUST be the full content of an `.ots` file containing at least one Bitcoin attestation. This file SHOULD contain a **single** Bitcoin attestation and no reference to "pending" attestations since they are useless in this context. - The `content` MUST be the full content of an `.ots` file containing at least one Bitcoin attestation. This file SHOULD contain a **single** Bitcoin attestation (as not more than one valid attestation is necessary and less bytes is better than more) and no reference to "pending" attestations since they are useless in this context.
### Example OpenTimestamps proof verification flow ### Example OpenTimestamps proof verification flow

2
04.md
View File

@ -4,7 +4,7 @@ NIP-04
Encrypted Direct Message Encrypted Direct Message
------------------------ ------------------------
`final` `optional` `author:arcbtc` `final` `optional`
A special event with kind `4`, meaning "encrypted direct message". It is supposed to have the following attributes: A special event with kind `4`, meaning "encrypted direct message". It is supposed to have the following attributes:

2
05.md
View File

@ -4,7 +4,7 @@ NIP-05
Mapping Nostr keys to DNS-based internet identifiers Mapping Nostr keys to DNS-based internet identifiers
---------------------------------------------------- ----------------------------------------------------
`final` `optional` `author:fiatjaf` `author:mikedilger` `final` `optional`
On events of kind `0` (`metadata`) one can specify the key `"nip05"` with an [internet identifier](https://datatracker.ietf.org/doc/html/rfc5322#section-3.4.1) (an email-like address) as the value. Although there is a link to a very liberal "internet identifier" specification above, NIP-05 assumes the `<local-part>` part will be restricted to the characters `a-z0-9-_.`, case-insensitive. On events of kind `0` (`metadata`) one can specify the key `"nip05"` with an [internet identifier](https://datatracker.ietf.org/doc/html/rfc5322#section-3.4.1) (an email-like address) as the value. Although there is a link to a very liberal "internet identifier" specification above, NIP-05 assumes the `<local-part>` part will be restricted to the characters `a-z0-9-_.`, case-insensitive.

2
06.md
View File

@ -4,7 +4,7 @@ NIP-06
Basic key derivation from mnemonic seed phrase Basic key derivation from mnemonic seed phrase
---------------------------------------------- ----------------------------------------------
`draft` `optional` `author:fiatjaf` `draft` `optional`
[BIP39](https://bips.xyz/39) is used to generate mnemonic seed words and derive a binary seed from them. [BIP39](https://bips.xyz/39) is used to generate mnemonic seed words and derive a binary seed from them.

2
07.md
View File

@ -4,7 +4,7 @@ NIP-07
`window.nostr` capability for web browsers `window.nostr` capability for web browsers
------------------------------------------ ------------------------------------------
`draft` `optional` `author:fiatjaf` `draft` `optional`
The `window.nostr` object may be made available by web browsers or extensions and websites or web-apps may make use of it after checking its availability. The `window.nostr` object may be made available by web browsers or extensions and websites or web-apps may make use of it after checking its availability.

2
08.md
View File

@ -6,7 +6,7 @@ NIP-08
Handling Mentions Handling Mentions
----------------- -----------------
`final` `unrecommended` `optional` `author:fiatjaf` `author:scsibug` `final` `unrecommended` `optional`
This document standardizes the treatment given by clients of inline mentions of other events and pubkeys inside the content of `text_note`s. This document standardizes the treatment given by clients of inline mentions of other events and pubkeys inside the content of `text_note`s.

2
09.md
View File

@ -4,7 +4,7 @@ NIP-09
Event Deletion Event Deletion
-------------- --------------
`draft` `optional` `author:scsibug` `draft` `optional`
A special event with kind `5`, meaning "deletion" is defined as having a list of one or more `e` tags, each referencing an event the author is requesting to be deleted. A special event with kind `5`, meaning "deletion" is defined as having a list of one or more `e` tags, each referencing an event the author is requesting to be deleted.

2
10.md
View File

@ -5,7 +5,7 @@ NIP-10
On "e" and "p" tags in Text Events (kind 1). On "e" and "p" tags in Text Events (kind 1).
-------------------------------------------- --------------------------------------------
`draft` `optional` `author:unclebobmartin` `draft` `optional`
## Abstract ## Abstract
This NIP describes how to use "e" and "p" tags in text events, especially those that are replies to other text events. It helps clients thread the replies into a tree rooted at the original event. This NIP describes how to use "e" and "p" tags in text events, especially those that are replies to other text events. It helps clients thread the replies into a tree rooted at the original event.

119
11.md
View File

@ -4,7 +4,7 @@ NIP-11
Relay Information Document Relay Information Document
--------------------------- ---------------------------
`draft` `optional` `author:scsibug` `author:doc-hex` `author:cameri` `draft` `optional`
Relays may provide server metadata to clients to inform them of capabilities, administrative contacts, and various server attributes. This is made available as a JSON document over HTTP, on the same URI as the relay's websocket. Relays may provide server metadata to clients to inform them of capabilities, administrative contacts, and various server attributes. This is made available as a JSON document over HTTP, on the same URI as the relay's websocket.
@ -25,42 +25,42 @@ When a relay receives an HTTP(s) request with an `Accept` header of `application
Any field may be omitted, and clients MUST ignore any additional fields they do not understand. Relays MUST accept CORS requests by sending `Access-Control-Allow-Origin`, `Access-Control-Allow-Headers`, and `Access-Control-Allow-Methods` headers. Any field may be omitted, and clients MUST ignore any additional fields they do not understand. Relays MUST accept CORS requests by sending `Access-Control-Allow-Origin`, `Access-Control-Allow-Headers`, and `Access-Control-Allow-Methods` headers.
Field Descriptions Field Descriptions
----------------- ------------------
### Name ### ### Name
A relay may select a `name` for use in client software. This is a string, and SHOULD be less than 30 characters to avoid client truncation. A relay may select a `name` for use in client software. This is a string, and SHOULD be less than 30 characters to avoid client truncation.
### Description ### ### Description
Detailed plain-text information about the relay may be contained in the `description` string. It is recommended that this contain no markup, formatting or line breaks for word wrapping, and simply use double newline characters to separate paragraphs. There are no limitations on length. Detailed plain-text information about the relay may be contained in the `description` string. It is recommended that this contain no markup, formatting or line breaks for word wrapping, and simply use double newline characters to separate paragraphs. There are no limitations on length.
### Pubkey ### ### Pubkey
An administrative contact may be listed with a `pubkey`, in the same format as Nostr events (32-byte hex for a `secp256k1` public key). If a contact is listed, this provides clients with a recommended address to send encrypted direct messages (See `NIP-04`) to a system administrator. Expected uses of this address are to report abuse or illegal content, file bug reports, or request other technical assistance. An administrative contact may be listed with a `pubkey`, in the same format as Nostr events (32-byte hex for a `secp256k1` public key). If a contact is listed, this provides clients with a recommended address to send encrypted direct messages (See `NIP-04`) to a system administrator. Expected uses of this address are to report abuse or illegal content, file bug reports, or request other technical assistance.
Relay operators have no obligation to respond to direct messages. Relay operators have no obligation to respond to direct messages.
### Contact ### ### Contact
An alternative contact may be listed under the `contact` field as well, with the same purpose as `pubkey`. Use of a Nostr public key and direct message SHOULD be preferred over this. Contents of this field SHOULD be a URI, using schemes such as `mailto` or `https` to provide users with a means of contact. An alternative contact may be listed under the `contact` field as well, with the same purpose as `pubkey`. Use of a Nostr public key and direct message SHOULD be preferred over this. Contents of this field SHOULD be a URI, using schemes such as `mailto` or `https` to provide users with a means of contact.
### Supported NIPs ### ### Supported NIPs
As the Nostr protocol evolves, some functionality may only be available by relays that implement a specific `NIP`. This field is an array of the integer identifiers of `NIP`s that are implemented in the relay. Examples would include `1`, for `"NIP-01"` and `9`, for `"NIP-09"`. Client-side `NIPs` SHOULD NOT be advertised, and can be ignored by clients. As the Nostr protocol evolves, some functionality may only be available by relays that implement a specific `NIP`. This field is an array of the integer identifiers of `NIP`s that are implemented in the relay. Examples would include `1`, for `"NIP-01"` and `9`, for `"NIP-09"`. Client-side `NIPs` SHOULD NOT be advertised, and can be ignored by clients.
### Software ### ### Software
The relay server implementation MAY be provided in the `software` attribute. If present, this MUST be a URL to the project's homepage. The relay server implementation MAY be provided in the `software` attribute. If present, this MUST be a URL to the project's homepage.
### Version ### ### Version
The relay MAY choose to publish its software version as a string attribute. The string format is defined by the relay implementation. It is recommended this be a version number or commit identifier. The relay MAY choose to publish its software version as a string attribute. The string format is defined by the relay implementation. It is recommended this be a version number or commit identifier.
Extra Fields Extra Fields
----------------- ------------
### Server Limitations ### ### Server Limitations
These are limitations imposed by the relay on clients. Your client These are limitations imposed by the relay on clients. Your client
should expect that requests which exceed these *practical* limitations should expect that requests which exceed these *practical* limitations
@ -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,
@ -80,9 +79,10 @@ are rejected or fail immediately.
"min_pow_difficulty": 30, "min_pow_difficulty": 30,
"auth_required": true, "auth_required": true,
"payment_required": true, "payment_required": true,
"restricted_writes": true,
"created_at_lower_limit": 31536000, "created_at_lower_limit": 31536000,
"created_at_upper_limit":3, "created_at_upper_limit": 3
} },
... ...
} }
``` ```
@ -125,11 +125,17 @@ Even if set to False, authentication may be required for specific actions.
- `payment_required`: this relay requires payment before a new connection may perform any action. - `payment_required`: this relay requires payment before a new connection may perform any action.
- `restricted_writes`: this relay requires some kind of condition to be fulfilled in order to
accept events (not necessarily, but including `payment_required` and `min_pow_difficulty`).
This should only be set to `true` when users are expected to know the relay policy before trying
to write to it -- like belonging to a special pubkey-based whitelist or writing only events of
a specific niche kind or content. Normal anti-spam heuristics, for example, do not qualify.
- `created_at_lower_limit`: 'created_at' lower limit as defined in [NIP-22](22.md) - `created_at_lower_limit`: 'created_at' lower limit as defined in [NIP-22](22.md)
- `created_at_upper_limit`: 'created_at' upper limit as defined in [NIP-22](22.md) - `created_at_upper_limit`: 'created_at' upper limit as defined in [NIP-22](22.md)
### Event Retention ### ### Event Retention
There may be a cost associated with storing data forever, so relays There may be a cost associated with storing data forever, so relays
may wish to state retention times. The values stated here are defaults may wish to state retention times. The values stated here are defaults
@ -142,14 +148,12 @@ all, and preferably an error will be provided when those are received.
```json ```json
{ {
...
"retention": [ "retention": [
{"kinds": [0, 1, [5, 7], [40, 49]], "time": 3600}, {"kinds": [0, 1, [5, 7], [40, 49]], "time": 3600},
{"kinds": [[40000, 49999]], "time": 100}, {"kinds": [[40000, 49999]], "time": 100},
{"kinds": [[30000, 39999]], "count": 1000}, {"kinds": [[30000, 39999]], "count": 1000},
{"time": 3600, "count": 10000} {"time": 3600, "count": 10000}
] ]
...
} }
``` ```
@ -165,8 +169,7 @@ support their protocol quickly via a single HTTP fetch.
There is no need to specify retention times for _ephemeral events_ since they are not retained. There is no need to specify retention times for _ephemeral events_ since they are not retained.
### Content Limitations
### Content Limitations ###
Some relays may be governed by the arbitrary laws of a nation state. This Some relays may be governed by the arbitrary laws of a nation state. This
may limit what content can be stored in cleartext on those relays. All may limit what content can be stored in cleartext on those relays. All
@ -185,7 +188,6 @@ flexibility is up to the client software.
```json ```json
{ {
...
"relay_countries": [ "CA", "US" ], "relay_countries": [ "CA", "US" ],
... ...
} }
@ -199,7 +201,7 @@ country of the legal entities who own the relay, so it's very
likely a number of countries are involved. likely a number of countries are involved.
### Community Preferences ### ### Community Preferences
For public text notes at least, a relay may try to foster a For public text notes at least, a relay may try to foster a
local community. This would encourage users to follow the global local community. This would encourage users to follow the global
@ -208,7 +210,6 @@ To support this goal, relays MAY specify some of the following values.
```json ```json
{ {
...
"language_tags": ["en", "en-419"], "language_tags": ["en", "en-419"],
"tags": ["sfw-only", "bitcoin-only", "anime"], "tags": ["sfw-only", "bitcoin-only", "anime"],
"posting_policy": "https://example.com/posting-policy.html", "posting_policy": "https://example.com/posting-policy.html",
@ -239,13 +240,12 @@ detail and legal terms. Use the `tags` field to signify limitations
on content, or topics to be discussed, which could be machine on content, or topics to be discussed, which could be machine
processed by appropriate client software. processed by appropriate client software.
### Pay-To-Relay ### ### Pay-to-Relay
Relays that require payments may want to expose their fee schedules. 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" }],
@ -256,42 +256,59 @@ Relays that require payments may want to expose their fee schedules.
} }
``` ```
### Icon ### ### Icon
A URL pointing to an image to be used as an icon for the relay. Recommended to be squared in shape. A URL pointing to an image to be used as an icon for the relay. Recommended to be squared in shape.
```json ```json
{ {
...
"icon": "https://nostr.build/i/53866b44135a27d624e99c6165cabd76ac8f72797209700acb189fce75021f47.jpg", "icon": "https://nostr.build/i/53866b44135a27d624e99c6165cabd76ac8f72797209700acb189fce75021f47.jpg",
... ...
} }
``` ```
### Examples ### ### Examples
As of 2 May 2023 the following `curl` command provided these results.
>curl -H "Accept: application/nostr+json" https://eden.nostr.land As of 2 May 2023 the following command provided these results:
{"name":"eden.nostr.land", ```
"description":"Eden Nostr Land - Toronto 1-01", ~> curl -H "Accept: application/nostr+json" https://eden.nostr.land | jq
"pubkey":"00000000827ffaa94bfea288c3dfce4422c794fbb96625b6b31e9049f729d700",
"contact":"me@ricardocabral.io", {
"supported_nips":[1,2,4,9,11,12,15,16,20,22,26,28,33,40], "description": "nostr.land family of relays (us-or-01)",
"supported_nip_extensions":["11a"], "name": "nostr.land",
"software":"git+https://github.com/Cameri/nostream.git", "pubkey": "52b4a076bcbbbdc3a1aefa3735816cf74993b1b8db202b01c883c58be7fad8bd",
"version":"1.22.6", "software": "custom",
"limitation":{"max_message_length":1048576, "supported_nips": [
"max_subscriptions":10, 1,
"max_filters":2500, 2,
"max_limit":5000, 4,
"max_subid_length":256, 9,
"max_event_tags":2500, 11,
"max_content_length":65536, 12,
"min_pow_difficulty":0, 16,
"auth_required":false, 20,
"payment_required":true}, 22,
"payments_url":"https://eden.nostr.land/invoices", 28,
"fees":{"admission":[{"amount":5000000,"unit":"msats"}], 33,
"publication":[]}}, 40
"icon": "https://nostr.build/i/53866b44135a27d624e99c6165cabd76ac8f72797209700acb189fce75021f47.jpg" ],
"version": "1.0.1",
"limitation": {
"payment_required": true,
"max_message_length": 65535,
"max_event_tags": 2000,
"max_subscriptions": 20,
"auth_required": false
},
"payments_url": "https://eden.nostr.land",
"fees": {
"subscription": [
{
"amount": 2500000,
"unit": "msats",
"period": 2592000
}
]
},
}

2
12.md
View File

@ -4,6 +4,6 @@ NIP-12
Generic Tag Queries Generic Tag Queries
------------------- -------------------
`final` `mandatory` `author:scsibug` `author:fiatjaf` `final` `mandatory`
Moved to [NIP-01](01.md). Moved to [NIP-01](01.md).

8
13.md
View File

@ -4,7 +4,7 @@ NIP-13
Proof of Work Proof of Work
------------- -------------
`draft` `optional` `author:jb55` `author:cameri` `draft` `optional`
This NIP defines a way to generate and interpret Proof of Work for nostr notes. Proof of Work (PoW) is a way to add a proof of computational work to a note. This is a bearer proof that all relays and clients can universally validate with a small amount of code. This proof can be used as a means of spam deterrence. This NIP defines a way to generate and interpret Proof of Work for nostr notes. Proof of Work (PoW) is a way to add a proof of computational work to a note. This is a bearer proof that all relays and clients can universally validate with a small amount of code. This proof can be used as a means of spam deterrence.
@ -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"

6
14.md
View File

@ -4,12 +4,14 @@ NIP-14
Subject tag in Text events Subject tag in Text events
-------------------------- --------------------------
`draft` `optional` `author:unclebobmartin` `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) (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.

123
15.md
View File

@ -1,14 +1,14 @@
NIP-15 NIP-15
====== ======
Nostr Marketplace (for resilient marketplaces) Nostr Marketplace
----------------------------------- -----------------
`draft` `optional` `author:fiatjaf` `author:benarc` `author:motorina0` `author:talvasconcelos` `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
@ -43,19 +43,20 @@ A merchant can publish these events:
### 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
16.md
View File

@ -4,6 +4,6 @@ NIP-16
Event Treatment Event Treatment
--------------- ---------------
`final` `mandatory` `author:Semisol` `final` `mandatory`
Moved to [NIP-01](01.md). Moved to [NIP-01](01.md).

2
18.md
View File

@ -4,7 +4,7 @@ NIP-18
Reposts Reposts
------- -------
`draft` `optional` `author:jb55` `author:fiatjaf` `author:arthurfranca` `draft` `optional`
A repost is a `kind 6` event that is used to signal to followers A repost is a `kind 6` event that is used to signal to followers
that a `kind 1` text note is worth reading. that a `kind 1` text note is worth reading.

2
19.md
View File

@ -4,7 +4,7 @@ NIP-19
bech32-encoded entities bech32-encoded entities
----------------------- -----------------------
`draft` `optional` `author:jb55` `author:fiatjaf` `author:Semisol` `draft` `optional`
This NIP standardizes bech32-formatted strings that can be used to display keys, ids and other information in clients. These formats are not meant to be used anywhere in the core protocol, they are only meant for displaying to users, copy-pasting, sharing, rendering QR codes and inputting data. This NIP standardizes bech32-formatted strings that can be used to display keys, ids and other information in clients. These formats are not meant to be used anywhere in the core protocol, they are only meant for displaying to users, copy-pasting, sharing, rendering QR codes and inputting data.

2
20.md
View File

@ -4,6 +4,6 @@ NIP-20
Command Results Command Results
--------------- ---------------
`final` `mandatory` `author:jb55` `final` `mandatory`
Moved to [NIP-01](01.md). Moved to [NIP-01](01.md).

2
21.md
View File

@ -4,7 +4,7 @@ NIP-21
`nostr:` URI scheme `nostr:` URI scheme
------------------- -------------------
`draft` `optional` `author:fiatjaf` `draft` `optional`
This NIP standardizes the usage of a common URI scheme for maximum interoperability and openness in the network. This NIP standardizes the usage of a common URI scheme for maximum interoperability and openness in the network.

2
22.md
View File

@ -4,7 +4,7 @@ NIP-22
Event `created_at` Limits Event `created_at` Limits
------------------------- -------------------------
`draft` `optional` `author:jeffthibault` `author:Giszmo` `draft` `optional`
Relays may define both upper and lower limits within which they will consider an event's `created_at` to be acceptable. Both the upper and lower limits MUST be unix timestamps in seconds as defined in [NIP-01](01.md). Relays may define both upper and lower limits within which they will consider an event's `created_at` to be acceptable. Both the upper and lower limits MUST be unix timestamps in seconds as defined in [NIP-01](01.md).

2
23.md
View File

@ -4,7 +4,7 @@ NIP-23
Long-form Content Long-form Content
----------------- -----------------
`draft` `optional` `author:fiatjaf` `draft` `optional`
This NIP defines `kind:30023` (a _parameterized replaceable event_) for long-form text content, generally referred to as "articles" or "blog posts". `kind:30024` has the same structure as `kind:30023` and is used to save long form drafts. This NIP defines `kind:30023` (a _parameterized replaceable event_) for long-form text content, generally referred to as "articles" or "blog posts". `kind:30024` has the same structure as `kind:30023` and is used to save long form drafts.

4
24.md
View File

@ -4,7 +4,7 @@ NIP-24
Extra metadata fields and tags Extra metadata fields and tags
------------------------------ ------------------------------
`draft` `optional` `author:fiatjaf` `draft` `optional`
This NIP defines extra optional fields added to events. This NIP defines extra optional fields added to events.
@ -13,7 +13,7 @@ kind 0
These are extra fields not specified in NIP-01 that may be present in the stringified JSON of metadata events: These are extra fields not specified in NIP-01 that may be present in the stringified JSON of metadata events:
- `display_name`: a bigger name with richer characters than `name`. Implementations should fallback to `name` when this is not available. - `display_name`: an alternative, bigger name with richer characters than `name`. `name` should always be set regardless of the presence of `display_name` in the metadata.
- `website`: a web URL related in any way to the event author. - `website`: a web URL related in any way to the event author.
- `banner`: an URL to a wide (~1024x768) picture to be optionally displayed in the background of a profile screen. - `banner`: an URL to a wide (~1024x768) picture to be optionally displayed in the background of a profile screen.

2
25.md
View File

@ -5,7 +5,7 @@ NIP-25
Reactions Reactions
--------- ---------
`draft` `optional` `author:jb55` `draft` `optional`
A reaction is a `kind 7` event that is used to react to other events. A reaction is a `kind 7` event that is used to react to other events.

2
26.md
View File

@ -4,7 +4,7 @@ NIP-26
Delegated Event Signing Delegated Event Signing
----- -----
`draft` `optional` `author:markharding` `author:minds` `draft` `optional`
This NIP defines how events can be delegated so that they can be signed by other keypairs. This NIP defines how events can be delegated so that they can be signed by other keypairs.

2
27.md
View File

@ -4,7 +4,7 @@ NIP-27
Text Note References Text Note References
-------------------- --------------------
`draft` `optional` `author:arthurfranca` `author:hodlbod` `author:fiatjaf` `draft` `optional`
This document standardizes the treatment given by clients of inline references of other events and profiles inside the `.content` of any event that has readable text in its `.content` (such as kinds 1 and 30023). This document standardizes the treatment given by clients of inline references of other events and profiles inside the `.content` of any event that has readable text in its `.content` (such as kinds 1 and 30023).

2
28.md
View File

@ -5,7 +5,7 @@ NIP-28
Public Chat Public Chat
----------- -----------
`draft` `optional` `author:ChristopherDavid` `author:fiatjaf` `author:jb55` `author:Cameri` `draft` `optional`
This NIP defines new event kinds for public chat channels, channel messages, and basic client-side moderation. This NIP defines new event kinds for public chat channels, channel messages, and basic client-side moderation.

2
30.md
View File

@ -4,7 +4,7 @@ NIP-30
Custom Emoji Custom Emoji
------------ ------------
`draft` `optional` `author:alexgleason` `draft` `optional`
Custom emoji may be added to **kind 0** and **kind 1** events by including one or more `"emoji"` tags, in the form: Custom emoji may be added to **kind 0** and **kind 1** events by including one or more `"emoji"` tags, in the form:

2
31.md
View File

@ -4,7 +4,7 @@ NIP-31
Dealing with unknown event kinds Dealing with unknown event kinds
-------------------------------- --------------------------------
`draft` `optional` `author:pablof7z` `author:fiatjaf` `draft` `optional`
When creating a new custom event kind that is part of a custom protocol and isn't meant to be read as text (like `kind:1`), clients should use an `alt` tag to write a short human-readable plaintext summary of what that event is about. When creating a new custom event kind that is part of a custom protocol and isn't meant to be read as text (like `kind:1`), clients should use an `alt` tag to write a short human-readable plaintext summary of what that event is about.

119
32.md
View File

@ -4,9 +4,32 @@ NIP-32
Labeling Labeling
--------- ---------
`draft` `optional` `author:staab` `author:gruruya` `author:s3x-jay` `draft` `optional`
A label is a `kind 1985` event that is used to label other entities. This supports a number of use cases, from distributed moderation and content recommendations to reviews and ratings. A label is a `kind 1985` event that is used to label other entities. This supports a number of use cases,
including distributed moderation, collection management, license assignment, and content classification.
This NIP introduces two new tags:
- `L` denotes a label namespace
- `l` denotes a label
Label Namespace Tag
----
An `L` tag can be any string, but publishers SHOULD ensure they are unambiguous by using a well-defined namespace
(such as an ISO standard) or reverse domain name notation.
`L` tags are REQUIRED in order to support searching by namespace rather than by a specific tag. The special `ugc`
("user generated content") namespace MAY be used when the label content is provided by an end user.
`L` tags starting with `#` indicate that the label target should be associated with the label's value.
This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, etc.
Label Tag
----
An `l` tag's value can be any string. `l` tags MUST include a `mark` matching an `L` tag value in the same event.
Label Target Label Target
---- ----
@ -16,47 +39,18 @@ labeled: `e`, `p`, `a`, `r`, or `t` tags. This allows for labeling of events, pe
or topics respectively. As with NIP-01, a relay hint SHOULD be included when using `e` and or topics respectively. As with NIP-01, a relay hint SHOULD be included when using `e` and
`p` tags. `p` tags.
Label Tag
----
This NIP introduces a new tag `l` which denotes a label, and a new `L` tag which denotes a label namespace.
A label MUST include a mark matching an `L` tag. `L` tags refer to a tag type within nostr, or a nomenclature
external to nostr defined either formally or by convention. Any string can be a namespace, but publishers SHOULD
ensure they are unambiguous by using a well-defined namespace (such as an ISO standard) or reverse domain name notation.
Namespaces starting with `#` indicate that the label target should be associated with the label's value.
This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, etc.
Some examples:
- `["l", "footstr", "#t"]` - the publisher thinks the given entity should have the `footstr` topic applied.
- `["l", "<pubkey>", "#p"]` - the publisher thinks the given entity is related to `<pubkey>`
- `["l", "IT-MI", "ISO-3166-2"]` - Milano, Italy using ISO 3166-2.
- `["l", "VI-hum", "com.example.ontology"]` - Violence toward a human being as defined by ontology.example.com.
`L` tags containing the label namespaces MUST be included in order to support searching by
namespace rather than by a specific tag. The special `ugc` ("user generated content") namespace
MAY be used when the label content is provided by an end user.
`l` and `L` tags MAY be added to other event kinds to support self-reporting. For events
with a kind other than 1985, labels refer to the event itself.
Label Annotations
-----
A label tag MAY include a 4th positional element detailing extra metadata about the label in question. This string
should be a json-encoded object. Any key MAY be used, but the following are recommended:
- `quality` may have a value of 0 to 1. This allows for an absolute, granular scale that can be represented in any way (5 stars, color scale, etc).
- `confidence` may have a value of 0 to 1. This indicates the certainty which the author has about their rating.
- `context` may be an array of urls (including NIP-21 urls) indicating other context that should be considered when interpreting labels.
Content Content
------- -------
Labels should be short, meaningful strings. Longer discussions, such as for a review, or an Labels should be short, meaningful strings. Longer discussions, such as for a review, or an
explanation of why something was labeled the way it was, should go in the event's `content` field. explanation of why something was labeled the way it was, should go in the event's `content` field.
Self-Reporting
-------
`l` and `L` tags MAY be added to other event kinds to support self-reporting. For events
with a kind other than 1985, labels refer to the event itself.
Example events Example events
-------------- --------------
@ -71,36 +65,64 @@ A suggestion that multiple pubkeys be associated with the `permies` topic.
["p", <pubkey1>, <relay_url>], ["p", <pubkey1>, <relay_url>],
["p", <pubkey2>, <relay_url>] ["p", <pubkey2>, <relay_url>]
], ],
"content": "",
... ...
} }
``` ```
A review of a relay. A report flagging violence toward a human being as defined by ontology.example.com.
```json ```json
{ {
"kind": 1985, "kind": 1985,
"tags": [ "tags": [
["L", "com.example.ontology"], ["L", "com.example.ontology"],
["l", "relay/review", "com.example.ontology", "{\"quality\": 0.1}"], ["l", "VI-hum", "com.example.ontology"],
["r", <relay_url>] ["p", <pubkey1>, <relay_url>],
["p", <pubkey2>, <relay_url>]
], ],
"content": "This relay is full of mean people.",
... ...
} }
``` ```
Publishers can self-label by adding `l` tags to their own non-1985 events. A moderation suggestion for a chat event.
```json
{
"kind": 1985,
"tags": [
["L", "nip28.moderation"],
["l", "approve", "nip28.moderation"],
["e", <kind40_event_id>, <relay_url>]
],
...
}
```
Assignment of a license to an event.
```json
{
"kind": 1985,
"tags": [
["L", "license"],
["l", "MIT", "license"],
["e", <event_id>, <relay_url>]
],
...
}
```
Publishers can self-label by adding `l` tags to their own non-1985 events. In this case, the kind 1 event's author
is labeling their note as being related to Milan, Italy using ISO 3166-2.
```json ```json
{ {
"kind": 1, "kind": 1,
"tags": [ "tags": [
["L", "com.example.ontology"], ["L", "ISO-3166-2"],
["l", "IL-frd", "com.example.ontology"] ["l", "IT-MI", "ISO-3166-2"]
], ],
"content": "Send me 100 sats and I'll send you 200 back", "content": "It's beautiful here in Milan!",
... ...
} }
``` ```
@ -124,3 +146,8 @@ Vocabularies MAY choose to fully qualify all labels within a namespace (for exam
formal vocabularies that should not be confused with another namespace when querying formal vocabularies that should not be confused with another namespace when querying
without an `L` tag. For these vocabularies, all labels SHOULD include the namespace without an `L` tag. For these vocabularies, all labels SHOULD include the namespace
(rather than mixing qualified and unqualified labels). (rather than mixing qualified and unqualified labels).
A good heuristic for whether a use case fits this NIP is whether labels would ever be unique.
For example, many events might be labeled with a particular place, topic, or pubkey, but labels
with specific values like "John Doe" or "3.18743" are not labels, they are values, and should
be handled in some other way.

2
33.md
View File

@ -4,6 +4,6 @@ NIP-33
Parameterized Replaceable Events Parameterized Replaceable Events
-------------------------------- --------------------------------
`final` `mandatory` `author:Semisol` `author:Kukks` `author:Cameri` `author:Giszmo` `final` `mandatory`
Moved to [NIP-01](01.md). Moved to [NIP-01](01.md).

4
36.md
View File

@ -4,7 +4,7 @@ NIP-36
Sensitive Content / Content Warning Sensitive Content / Content Warning
----------------------------------- -----------------------------------
`draft` `optional` `author:fernandolguevara` `draft` `optional`
The `content-warning` tag enables users to specify if the event's content needs to be approved by readers to be shown. The `content-warning` tag enables users to specify if the event's content needs to be approved by readers to be shown.
Clients can hide the content until the user acts on it. Clients can hide the content until the user acts on it.
@ -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>"

2
38.md
View File

@ -5,7 +5,7 @@ NIP-38
User Statuses User Statuses
-------------- --------------
`draft` `optional` `author:jb55` `draft` `optional`
## Abstract ## Abstract

8
39.md
View File

@ -4,7 +4,7 @@ NIP-39
External Identities in Profiles External Identities in Profiles
------------------------------- -------------------------------
`draft` `optional` `author:pseudozach` `author:Semisol` `draft` `optional`
## Abstract ## Abstract
@ -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"]
] ],
...
} }
``` ```

4
40.md
View File

@ -2,9 +2,9 @@ NIP-40
====== ======
Expiration Timestamp Expiration Timestamp
----------------------------------- --------------------
`draft` `optional` `author:0xtlt` `draft` `optional`
The `expiration` tag enables users to specify a unix timestamp at which the message SHOULD be considered expired (by relays and clients) and SHOULD be deleted by relays. The `expiration` tag enables users to specify a unix timestamp at which the message SHOULD be considered expired (by relays and clients) and SHOULD be deleted by relays.

16
42.md
View File

@ -4,7 +4,7 @@ NIP-42
Authentication of clients to relays Authentication of clients to relays
----------------------------------- -----------------------------------
`draft` `optional` `author:Semisol` `author:fiatjaf` `draft` `optional`
This NIP defines a way for clients to authenticate to relays by signing an ephemeral event. This NIP defines a way for clients to authenticate to relays by signing an ephemeral event.
@ -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/"]
``` ```

23
45.md
View File

@ -4,7 +4,7 @@ NIP-45
Event Counts Event Counts
-------------- --------------
`draft` `optional` `author:staab` `draft` `optional`
Relays may support the verb `COUNT`, which provides a mechanism for obtaining event counts. Relays may support the verb `COUNT`, which provides a mechanism for obtaining event counts.
@ -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}]
``` ```

2
46.md
View File

@ -4,7 +4,7 @@ NIP-46
Nostr Connect Nostr Connect
------------------------ ------------------------
`draft` `optional` `author:tiero` `author:giowe` `author:vforvalerio87` `draft` `optional`
## Rationale ## Rationale

2
47.md
View File

@ -4,7 +4,7 @@ NIP-47
Nostr Wallet Connect Nostr Wallet Connect
-------------------- --------------------
`draft` `optional` `author:kiwiidb` `author:bumi` `author:semisol` `author:vitorpamplona` `draft` `optional`
## Rationale ## Rationale

2
48.md
View File

@ -4,7 +4,7 @@ NIP-48
Proxy Tags Proxy Tags
---------- ----------
`draft` `optional` `author:alexgleason` `draft` `optional`
Nostr events bridged from other protocols such as ActivityPub can link back to the source object by including a `"proxy"` tag, in the form: Nostr events bridged from other protocols such as ActivityPub can link back to the source object by including a `"proxy"` tag, in the form:

2
50.md
View File

@ -4,7 +4,7 @@ NIP-50
Search Capability Search Capability
----------------- -----------------
`draft` `optional` `author:brugeman` `author:mikedilger` `author:fiatjaf` `draft` `optional`
## Abstract ## Abstract

194
51.md
View File

@ -4,145 +4,109 @@ NIP-51
Lists Lists
----- -----
`draft` `optional` `author:fiatjaf` `author:arcbtc` `author:monlovesmango` `author:eskema` `author:gzuuus` `draft` `optional`
A "list" event is defined as having a list of public and/or private tags. Public tags will be listed in the event `tags`. Private tags will be encrypted in the event `content`. Encryption for private tags will use [NIP-04 - Encrypted Direct Message](04.md) encryption, using the list author's private and public key for the shared secret. A distinct event kind should be used for each list type created. This NIP defines lists of things that users can create. Lists can contain references to anything, and these references can be **public** or **private**.
If a list should only be defined once per user (like the "mute" list) the list is declared as a _replaceable event_. These lists may be referred to as "replaceable lists". Otherwise, the list is a _parameterized replaceable event_ and the list name will be used as the `d` tag. These lists may be referred to as "parameterized replaceable lists". Public items in a list are specified in the event `tags` array, while private items are specified in a JSON array that mimics the structure of the event `tags` array, but stringified and encrypted using the same scheme from [NIP-04](04.md) (the shared key is computed using the author's public and private key) and stored in the `.content`.
## Replaceable List Event Example ## Types of lists
Lets say a user wants to create a 'Mute' list and has keys: ## Standard lists
```
priv: fb505c65d4df950f5d28c9e4d285ee12ffaf315deef1fc24e3c7cd1e7e35f2b1
pub: b1a5c93edcc8d586566fde53a20bdb50049a97b15483cb763854e57016e0fa3d
```
The user wants to publicly include these users:
```json Standard lists use non-parameterized replaceable events, meaning users may only have a single list of each kind. They have special meaning and clients may rely on them to augment a user's profile or browsing experience.
["p", "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"],
["p", "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"]
```
and privately include these users (below is the JSON that would be encrypted and placed in the event content):
```json For example, _mute lists_ can contain the public keys of spammers and bad actors users don't want to see in their feeds or receive annoying notifications from.
[
["p", "9ec7a778167afb1d30c4833de9322da0c08ba71a69e1911d5578d3144bb56437"],
["p", "8c0da4862130283ff9e67d889df264177a508974e2feb96de139804ea66d6168"]
]
```
Then the user would create a 'Mute' list event like below: | name | kind | description | expected tag items |
| --- | --- | --- | --- |
| Mute list | 10000 | things the user doesn't want to see in their feeds | `"p"` (pubkeys), `"t"` (hashtags), `"word"` (lowercase string), `"e"` (threads) |
| Pinned notes | 10001 | events the user intends to showcase in their profile page | `"e"` (kind:1 notes) |
| Bookmarks | 10003 | uncategorized, "global" list of things a user wants to save | `"e"` (kind:1 notes), `"a"` (kind:30023 articles), `"t"` (hashtags), `"r" (URLs)` |
| Communities | 10004 | [NIP-72](72.md) communities the user belongs to | `"a"` (kind:34550 community definitions) |
| Public chats | 10005 | [NIP-28](28.md) chat channels the user is in | `"e"` (kind:40 channel definitions) |
| Blocked relays | 10006 | relays clients should never connect to | `"relay"` (relay URLs) |
| Search relays | 10007 | relays clients should use when performing search queries | `"relay"` (relay URLs) |
| Interests | 10015 | topics a user may be interested in and pointers | `"t"` (hashtags) and `"a" (kind:30015 interest set)` |
| Emojis | 10030 | user preferred emojis and pointers to emoji sets | `"emoji"` (see [NIP-30](30.md)) and `"a"` (kind:30030 emoji set) |
## Sets
Sets are lists with well-defined meaning that can enhance the functionality and the UI of clients that rely on them. Unlike standard lists, users are expected to have more than one set of each kind, therefore each of them must be assigned a different `"d"` identifier.
For example, _relay sets_ can be displayed in a dropdown UI to give users the option to switch to which relays they will publish an event or from which relays they will read the replies to an event; _curation sets_ can be used by apps to showcase curations made by others tagged to different topics.
Aside from their main identifier, the `"d"` tag, sets can optionally have a `"title"`, an `"image"` and a `"description"` tags that can be used to enhance their UI.
| name | kind | description | expected tag items |
| --- | --- | --- | --- |
| Follow sets | 30000 | categorized groups of users a client may choose to check out in different circumstances | `"p"` (pubkeys) |
| Relay sets | 30002 | user-defined relay groups the user can easily pick and choose from during various operations | `"relay"` (relay URLs) |
| Bookmark sets | 30003 | user-defined bookmarks categories , for when bookmarks must be in labeled separate groups | `"e"` (kind:1 notes), `"a"` (kind:30023 articles), `"t"` (hashtags), `"r" (URLs)` |
| Curation sets | 30004 | groups of articles picked by users as interesting and/or belonging to the same category | `"a"` (kind:30023 articles), `"e"` (kind:1 notes) |
| Interest sets | 30015 | interest topics represented by a bunch of "hashtags" | `"t"` (hashtags) |
| Emoji sets | 30030 | categorized emoji groups | `"emoji"` (see [NIP-30](30.md)) |
## Deprecated standard lists
Some clients have used these lists in the past, but they should work on transitioning to the [standard formats](#standard-lists) above.
| kind | "d" tag | use instead |
| --- | --- | --- |
| 30000 | `"mute"` | kind 10000 _mute list_ |
| 30001 | `"pin"` | kind 10001 _pin list_ |
| 30001 | `"bookmark"` | kind 10003 _bookmarks list_ |
| 30001 | `"communities"` | kind 10004 _communities list_ |
## Examples
### A _mute list_ with some public items and some encrypted items
```json ```json
{ {
"id": "a92a316b75e44cfdc19986c634049158d4206fcc0b7b9c7ccbcdabe28beebcd0",
"pubkey": "854043ae8f1f97430ca8c1f1a090bdde6488bd5115c7a45307a2a212750ae4cb",
"created_at": 1699597889,
"kind": 10000, "kind": 10000,
"tags": [ "tags": [
["p", "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"], ["p", "07caba282f76441955b695551c3c5c742e5b9202a3784780f8086fdcdc1da3a9"],
["p", "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"], ["p", "a55c15f5e41d5aebd236eca5e0142789c5385703f1a7485aa4b38d94fd18dcc4"]
], ],
"content": "VezuSvWak++ASjFMRqBPWS3mK5pZ0vRLL325iuIL4S+r8n9z+DuMau5vMElz1tGC/UqCDmbzE2kwplafaFo/FnIZMdEj4pdxgptyBV1ifZpH3TEF6OMjEtqbYRRqnxgIXsuOSXaerWgpi0pm+raHQPseoELQI/SZ1cvtFqEUCXdXpa5AYaSd+quEuthAEw7V1jP+5TDRCEC8jiLosBVhCtaPpLcrm8HydMYJ2XB6Ixs=?iv=/rtV49RFm0XyFEwG62Eo9A==", "content": "TJob1dQrf2ndsmdbeGU+05HT5GMnBSx3fx8QdDY/g3NvCa7klfzgaQCmRZuo1d3WQjHDOjzSY1+MgTK5WjewFFumCcOZniWtOMSga9tJk1ky00tLoUUzyLnb1v9x95h/iT/KpkICJyAwUZ+LoJBUzLrK52wNTMt8M5jSLvCkRx8C0BmEwA/00pjOp4eRndy19H4WUUehhjfV2/VV/k4hMAjJ7Bb5Hp9xdmzmCLX9+64+MyeIQQjQAHPj8dkSsRahP7KS3MgMpjaF8nL48Bg5suZMxJayXGVp3BLtgRZx5z5nOk9xyrYk+71e2tnP9IDvSMkiSe76BcMct+m7kGVrRcavDI4n62goNNh25IpghT+a1OjjkpXt9me5wmaL7fxffV1pchdm+A7KJKIUU3kLC7QbUifF22EucRA9xiEyxETusNludBXN24O3llTbOy4vYFsq35BeZl4v1Cse7n2htZicVkItMz3wjzj1q1I1VqbnorNXFgllkRZn4/YXfTG/RMnoK/bDogRapOV+XToZ+IvsN0BqwKSUDx+ydKpci6htDRF2WDRkU+VQMqwM0CoLzy2H6A2cqyMMMD9SLRRzBg==?iv=S3rFeFr1gsYqmQA7bNnNTQ==",
...other fields "sig": "1173822c53261f8cffe7efbf43ba4a97a9198b3e402c2a1df130f42a8985a2d0d3430f4de350db184141e45ca844ab4e5364ea80f11d720e36357e1853dba6ca"
} }
``` ```
### A _curation set_ of articles and notes about yaks
## Parameterized Replaceable List Event Example
Lets say a user wants to create a 'Categorized People' list of `nostr` people and has keys:
``` ```
priv: fb505c65d4df950f5d28c9e4d285ee12ffaf315deef1fc24e3c7cd1e7e35f2b1
pub: b1a5c93edcc8d586566fde53a20bdb50049a97b15483cb763854e57016e0fa3d
```
The user wants to publicly include these users:
```json
["p", "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"],
["p", "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"]
```
and privately include these users (below is the JSON that would be encrypted and placed in the event content):
```json
[
["p", "9ec7a778167afb1d30c4833de9322da0c08ba71a69e1911d5578d3144bb56437"],
["p", "8c0da4862130283ff9e67d889df264177a508974e2feb96de139804ea66d6168"]
]
```
Then the user would create a 'Categorized People' list event like below:
```json
{ {
"kind": 30000, "id": "567b41fc9060c758c4216fe5f8d3df7c57daad7ae757fa4606f0c39d4dd220ef",
"pubkey": "d6dc95542e18b8b7aec2f14610f55c335abebec76f3db9e58c254661d0593a0c",
"created_at": 1695327657,
"kind": 30004,
"tags": [ "tags": [
["d", "nostr"], ["d", "jvdy9i4"],
["p", "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"], ["name", "Yaks"],
["p", "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"], ["picture", "https://cdn.britannica.com/40/188540-050-9AC748DE/Yak-Himalayas-Nepal.jpg"],
["about", "The domestic yak, also known as the Tartary ox, grunting ox, or hairy cattle, is a species of long-haired domesticated cattle found throughout the Himalayan region of the Indian subcontinent, the Tibetan Plateau, Gilgit-Baltistan, Tajikistan and as far north as Mongolia and Siberia."],
["a", "30023:26dc95542e18b8b7aec2f14610f55c335abebec76f3db9e58c254661d0593a0c:95ODQzw3ajNoZ8SyMDOzQ"],
["a", "30023:54af95542e18b8b7aec2f14610f55c335abebec76f3db9e58c254661d0593a0c:1-MYP8dAhramH9J5gJWKx"],
["a", "30023:f8fe95542e18b8b7aec2f14610f55c335abebec76f3db9e58c254661d0593a0c:D2Tbd38bGrFvU0bIbvSMt"],
["e", "d78ba0d5dce22bfff9db0a9e996c9ef27e2c91051de0c4e1da340e0326b4941e"]
], ],
"content": "VezuSvWak++ASjFMRqBPWS3mK5pZ0vRLL325iuIL4S+r8n9z+DuMau5vMElz1tGC/UqCDmbzE2kwplafaFo/FnIZMdEj4pdxgptyBV1ifZpH3TEF6OMjEtqbYRRqnxgIXsuOSXaerWgpi0pm+raHQPseoELQI/SZ1cvtFqEUCXdXpa5AYaSd+quEuthAEw7V1jP+5TDRCEC8jiLosBVhCtaPpLcrm8HydMYJ2XB6Ixs=?iv=/rtV49RFm0XyFEwG62Eo9A==", "content": "",
...other fields "sig": "a9a4e2192eede77e6c9d24ddfab95ba3ff7c03fbd07ad011fff245abea431fb4d3787c2d04aad001cb039cb8de91d83ce30e9a94f82ac3c5a2372aa1294a96bd"
} }
``` ```
Lets say a user wants to create a 'Categorized Bookmarks' list of `bookmarks` and has keys: ## Encryption process pseudocode
```
priv: fb505c65d4df950f5d28c9e4d285ee12ffaf315deef1fc24e3c7cd1e7e35f2b1
pub: b1a5c93edcc8d586566fde53a20bdb50049a97b15483cb763854e57016e0fa3d
```
The user wants to publicly include these bookmarks:
```json ```scala
["e", "5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36", "wss://nostr.example.com"], val private_items = [
["a", "30023:f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca:abcd", "wss://nostr.example.com"], ["p", "07caba282f76441955b695551c3c5c742e5b9202a3784780f8086fdcdc1da3a9"],
["r", "https://github.com/nostr-protocol/nostr", "Nostr repository"], ["a", "a55c15f5e41d5aebd236eca5e0142789c5385703f1a7485aa4b38d94fd18dcc4"],
```
and privately include these bookmarks (below is the JSON that would be encrypted and placed in the event content):
```json
[
["r", "https://my-private.bookmark", "My private bookmark"],
["a", "30001:f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca:abcd", "wss://nostr.example.com"],
] ]
val base64blob = nip04.encrypt(json.encode_to_string(private_items))
event.content = base64blob
``` ```
Then the user would create a 'Categorized Bookmarks' list event like below:
```json
{
"kind": 30001,
"tags": [
["d", "bookmarks"],
["e", "5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36", "wss://nostr.example.com"],
["a", "30023:f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca:abcd", "wss://nostr.example.com"],
["r", "https://github.com/nostr-protocol/nostr", "Nostr repository"],
],
"content": "y3AyaLJfnmYr9x9Od9o4aYrmL9+Ynmsim5y2ONrU0urOTq+V81CyAthQ2mUOWE9xwGgrizhY7ILdQwWhy6FK0sA33GHtC0egUJw1zIdknPe7BZjznD570yk/8RXYgGyDKdexME+RMYykrnYFxq1+y/h00kmJg4u+Gpn+ZjmVhNYxl9b+TiBOAXG9UxnK/H0AmUqDpcldn6+j1/AiStwYZhD1UZ3jzDIk2qcCDy7MlGnYhSP+kNmG+2b0T/D1L0Z7?iv=PGJJfPE84gacAh7T0e6duQ==",
...other fields
}
```
## List Event Kinds
| kind | list type |
| ------ | ----------------------- |
| 10000 | Mute |
| 10001 | Pin |
| 30000 | Categorized People |
| 30001 | Categorized Bookmarks |
### Mute List
An event with kind `10000` is defined as a replaceable list event for listing content a user wants to mute. Any standardized tag can be included in a Mute List.
### Pin List
An event with kind `10001` is defined as a replaceable list event for listing content a user wants to pin. Any standardized tag can be included in a Pin List.
### Categorized People List
An event with kind `30000` is defined as a parameterized replaceable list event for categorizing people. The 'd' parameter for this event holds the category name of the list. The tags included in these lists MUST follow the format of kind 3 events as defined in [NIP-02 - Contact List and Petnames](02.md).
### Categorized Bookmarks List
An event of kind `30001` is defined as a parameterized replaceable list event for categorizing bookmarks. The 'd' parameter for this event holds the category name of the list. The bookmark lists may contain metadata tags such as 'title', 'image', 'summary' as defined in [NIP-23 - Long-form Content](23.md). Any standardized tag can be included in a Categorized Bookmark List.

2
52.md
View File

@ -4,7 +4,7 @@ NIP-52
Calendar Events Calendar Events
--------------- ---------------
`draft` `optional` `author:tyiu` `draft` `optional`
This specification defines calendar events representing an occurrence at a specific moment or between moments. These calendar events are _parameterized replaceable_ and deletable per [NIP-09](09.md). This specification defines calendar events representing an occurrence at a specific moment or between moments. These calendar events are _parameterized replaceable_ and deletable per [NIP-09](09.md).

32
53.md
View File

@ -4,19 +4,19 @@ NIP-53
Live Activities Live Activities
--------------- ---------------
`draft` `optional` `author:vitorpamplona` `author:v0l` `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
{ {

3
56.md
View File

@ -1,11 +1,10 @@
NIP-56 NIP-56
====== ======
Reporting Reporting
--------- ---------
`draft` `optional` `author:jb55` `draft` `optional`
A report is a `kind 1984` note that is used to report other notes for spam, A report is a `kind 1984` note that is used to report other notes for spam,
illegal and explicit content. illegal and explicit content.

2
57.md
View File

@ -4,7 +4,7 @@ NIP-57
Lightning Zaps Lightning Zaps
-------------- --------------
`draft` `optional` `author:jb55` `author:kieran` `draft` `optional`
This NIP defines two new event types for recording lightning payments between users. `9734` is a `zap request`, representing a payer's request to a recipient's lightning wallet for an invoice. `9735` is a `zap receipt`, representing the confirmation by the recipient's lightning wallet that the invoice issued in response to a `zap request` has been paid. This NIP defines two new event types for recording lightning payments between users. `9734` is a `zap request`, representing a payer's request to a recipient's lightning wallet for an invoice. `9735` is a `zap receipt`, representing the confirmation by the recipient's lightning wallet that the invoice issued in response to a `zap request` has been paid.

2
58.md
View File

@ -4,7 +4,7 @@ NIP-58
Badges Badges
------ ------
`draft` `optional` `author:cameri` `draft` `optional`
Three special events are used to define, award and display badges in Three special events are used to define, award and display badges in
user profiles: user profiles:

17
65.md
View File

@ -4,11 +4,11 @@ NIP-65
Relay List Metadata Relay List Metadata
------------------- -------------------
`draft` `optional` `author:mikedilger` `author:vitorpamplona` `draft` `optional`
Defines a replaceable event using `kind:10002` to advertise preferred relays for discovering a user's content and receiving fresh content from others. Defines a replaceable event using `kind:10002` to advertise preferred relays for discovering a user's content and receiving fresh content from others.
The event MUST include a list of `r` tags with relay URIs and a `read` or `write` marker. If the marker is omitted, the relay is used for both purposes. The event MUST include a list of `r` tags with relay URIs and a `read` or `write` marker. Relays marked as `read` / `write` are called READ / WRITE relays, respectively. If the marker is omitted, the relay is used for both purposes.
The `.content` is not used. The `.content` is not used.
@ -23,26 +23,27 @@ The `.content` is not used.
], ],
"content": "", "content": "",
...other fields ...other fields
}
``` ```
This NIP doesn't fully replace relay lists that are designed to configure a client's usage of relays (such as `kind:3` style relay lists). Clients MAY use other relay lists in situations where a `kind:10002` relay list cannot be found. This NIP doesn't fully replace relay lists that are designed to configure a client's usage of relays (such as `kind:3` style relay lists). Clients MAY use other relay lists in situations where a `kind:10002` relay list cannot be found.
## When to Use Read and Write ## When to Use Read and Write Relays
When seeking events **from** a user, Clients SHOULD use the WRITE relays of the user's `kind:10002` When seeking events **from** a user, Clients SHOULD use the WRITE relays of the user's `kind:10002`.
When seeking events **about** a user, where the user was tagged, Clients SHOULD use the READ relays of the user's `kind:10002` When seeking events **about** a user, where the user was tagged, Clients SHOULD use the READ relays of the user's `kind:10002`.
When broadcasting an event, Clients SHOULD: When broadcasting an event, Clients SHOULD:
- Broadcast the event to the WRITE relays of the author - Broadcast the event to the WRITE relays of the author
- Broadcast the event all READ relays of each tagged user. - Broadcast the event all READ relays of each tagged user
## Motivation ## Motivation
The old model of using a fixed relay list per user centralizes in large relay operators: The old model of using a fixed relay list per user centralizes in large relay operators:
- Most users submit their posts to the same highly popular relays, aiming to achieve greater visibility among a broader audience. - Most users submit their posts to the same highly popular relays, aiming to achieve greater visibility among a broader audience
- Many users are pulling events from a large number of relays in order to get more data at the expense of duplication - Many users are pulling events from a large number of relays in order to get more data at the expense of duplication
- Events are being copied between relays, oftentimes to many different relays - Events are being copied between relays, oftentimes to many different relays
@ -52,7 +53,7 @@ This NIP allows Clients to connect directly with the most up-to-date relay set f
1. Clients SHOULD guide users to keep `kind:10002` lists small (2-4 relays). 1. Clients SHOULD guide users to keep `kind:10002` lists small (2-4 relays).
2. Clients SHOULD spread an author's `kind:10002` events to as many relays as viable. 2. Clients SHOULD spread an author's `kind:10002` event to as many relays as viable.
3. `kind:10002` events should primarily be used to advertise the user's preferred relays to others. A user's own client may use other heuristics for selecting relays for fetching data. 3. `kind:10002` events should primarily be used to advertise the user's preferred relays to others. A user's own client may use other heuristics for selecting relays for fetching data.

42
72.md
View File

@ -4,22 +4,20 @@ NIP-72
Moderated Communities (Reddit Style) Moderated Communities (Reddit Style)
------------------------------------ ------------------------------------
`draft` `optional` `author:vitorpamplona` `author:arthurfranca` `draft` `optional`
The goal of this NIP is to create moderator-approved public communities around a topic. It defines the replaceable event `kind:34550` to define the community and the current list of moderators/administrators. Users that want to post into the community, simply tag any Nostr event with the community's `a` tag. Moderators issue an approval event `kind:4550` that links the community with the new post. The goal of this NIP is to create moderator-approved public communities around a topic. It defines the replaceable event `kind:34550` to define the community and the current list of moderators/administrators. Users that want to post into the community, simply tag any Nostr event with the community's `a` tag. Moderators issue an approval event `kind:4550` that links the community with the new post.
# Community Definition # Community Definition
`Kind:34550` SHOULD include any field that helps define the community and the set of moderators. `relay` tags MAY be used to describe the preferred relay to download requests and approvals. `kind:34550` SHOULD include any field that helps define the community and the set of moderators. `relay` tags MAY be used to describe the preferred relay to download requests and approvals.
```json ```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>, "created_at": <Unix timestamp in seconds>,
"kind": 34550, "kind": 34550,
"tags": [ "tags": [
["d", "<Community name>"], ["d", "<community-d-identifier>"],
["description", "<Community description>"], ["description", "<Community description>"],
["image", "<Community image url>", "<Width>x<Height>"], ["image", "<Community image url>", "<Width>x<Height>"],
@ -35,24 +33,23 @@ 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>"]
] ],
...
} }
``` ```
# New Post Request # New Post Request
Any Nostr event can be a post request. Clients MUST add the community's `a` tag to the new post event in order to be presented for the moderator's approval. Any Nostr event can be submitted to a community by anyone for approval. Clients MUST add the community's `a` tag to the new post event in order to be presented for the moderator's approval.
```json ```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": 1, "kind": 1,
"tags": [ "tags": [
["a", "34550:<Community event author pubkey>:<d-identifier of the community>", "<Optional relay url>"], ["a", "34550:<community event author pubkey>:<community-d-identifier>", "<optional-relay-url>"],
], ],
"content": "<My content>" "content": "hello world",
...
} }
``` ```
@ -64,17 +61,16 @@ The post-approval event MUST include `a` tags of the communities the moderator i
```json ```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>", "pubkey": "<32-bytes lowercase hex-encoded public key of the event creator>",
"created_at": <Unix timestamp in seconds>,
"kind": 4550, "kind": 4550,
"tags": [ "tags": [
["a", "34550:<Community event author pubkey>:<d-identifier of the community>", "<Optional relay url>"], ["a", "34550:<event-author-pubkey>:<community-d-identifier>", "<optional-relay-url>"],
["e", "<Post Request ID>", "<Optional relay url>"], ["e", "<post-id>", "<optional-relay-url>"],
["p", "<Post Request Author ID>", "<Optional relay url>"], ["p", "<port-author-pubkey>", "<optional-relay-url>"],
["k", "<New Post Request kind>"], ["k", "<post-request-kind>"]
], ],
"content": "<New Post Request JSON>" "content": "<the full approved event, JSON-encoded>",
...
} }
``` ```
@ -90,12 +86,16 @@ 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",
"_",
{ {
"authors": ["<Author pubkey>", "<Moderator1 pubkey>", "<Moderator2 pubkey>", "<Moderator3 pubkey>", ...], "authors": ["<owner-pubkey>", "<moderator1-pubkey>", "<moderator2-pubkey>", "<moderator3-pubkey>", ...],
"kinds": [4550], "kinds": [4550],
"#a": ["34550:<Community event author pubkey>:<d-identifier of the community>"], "#a": ["34550:<Community event author pubkey>:<d-identifier of the community>"],
} }
]
``` ```
Clients MAY hide approvals by blocked moderators at the user's request. Clients MAY hide approvals by blocked moderators at the user's request.

19
75.md
View File

@ -1,8 +1,10 @@
# NIP-75 NIP-75
======
## Zap Goals Zap Goals
---------
`draft` `optional` `author:verbiricha` `draft` `optional`
This NIP defines an event for creating fundraising goals. Users can contribute funds towards the goal by zapping the goal event. This NIP defines an event for creating fundraising goals. Users can contribute funds towards the goal by zapping the goal event.
@ -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

2
78.md
View File

@ -4,7 +4,7 @@ NIP-78
Arbitrary custom app data Arbitrary custom app data
------------------------- -------------------------
`draft` `optional` `author:sandwich` `author:fiatjaf` `draft` `optional`
The goal of this NIP is to enable [remoteStorage](https://remotestorage.io/)-like capabilities for custom applications that do not care about interoperability. The goal of this NIP is to enable [remoteStorage](https://remotestorage.io/)-like capabilities for custom applications that do not care about interoperability.

42
84.md Normal file
View File

@ -0,0 +1,42 @@
NIP-84
======
Highlights
----------
`draft` `optional`
This NIP defines `kind:9802`, a "highlight" event, to signal content a user finds valuable.
## Format
The `.content` of these events is the highlighted portion of the text.
`.content` might be empty for highlights of non-text based media (e.g. NIP-94 audio/video).
### References
Events SHOULD tag the source of the highlight, whether nostr-native or not.
`a` or `e` tags should be used for nostr events and `r` tags for URLs.
When tagging a URL, clients generating these events SHOULD do a best effort of cleaning the URL from trackers
or obvious non-useful information from the query string.
### Attribution
Clients MAY include one or more `p` tags, tagging the original authors of the material being highlighted; this is particularly
useful when highlighting non-nostr content for which the client might be able to get a nostr pubkey somehow
(e.g. prompting the user or reading a `<meta name="nostr:nprofile1..." />` tag on the document). A role MAY be included as the
last value of the tag.
```json
{
"tags": [
["p", "<pubkey-hex>", "<relay-url>", "author"],
["p", "<pubkey-hex>", "<relay-url>", "author"],
["p", "<pubkey-hex>", "<relay-url>", "editor"]
],
...
}
```
### Context
Clients MAY include a `context` tag, useful when the highlight is a subset of a paragraph and displaying the
surrounding content might be beneficial to give context to the highlight.

55
89.md
View File

@ -4,15 +4,17 @@ NIP-89
Recommended Application Handlers Recommended Application Handlers
-------------------------------- --------------------------------
`draft` `optional` `author:pablof7z` `draft` `optional`
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,9 +24,9 @@ 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,
@ -48,7 +50,7 @@ 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>],
@ -62,28 +64,39 @@ The third value of the tag SHOULD be the platform where this recommendation migh
``` ```
* `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.
# User flow ## 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
{
"kind": 1,
"tags": [
["client", "31990:app1-pubkey:<d-identifier>", "wss://relay1", "ios"]
]
...
}
```
## 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
@ -92,25 +105,27 @@ User A might be a user of Zapstr, a `kind:31337`-centric client (tracks). Using
"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': [...] }]']
```

69
90.md
View File

@ -4,7 +4,7 @@ NIP-90
Data Vending Machine Data Vending Machine
-------------------- --------------------
`draft` `optional` `author:pablof7z` `author:dontbelievethehype` `draft` `optional`
This NIP defines the interaction between customers and Service Providers for performing on-demand computation. This NIP defines the interaction between customers and Service Providers for performing on-demand computation.
@ -67,6 +67,37 @@ All tags are optional.
* `relays`: List of relays where Service Providers SHOULD publish responses to * `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 * `p`: Service Providers the customer is interested in. Other SPs MIGHT still choose to process the job
## 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"]
]
```
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"]
],
...
}
```
## Job result (`kind:6000-6999`) ## Job result (`kind:6000-6999`)
Service providers publish job results, providing the output of the job result. They should tag the original job request event id as well as the customer's pubkey. Service providers publish job results, providing the output of the job result. They should tag the original job request event id as well as the customer's pubkey.
@ -82,7 +113,8 @@ Service providers publish job results, providing the output of the job result. T
["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>"]
] ],
...
} }
``` ```
@ -90,7 +122,29 @@ Service providers publish job results, providing the output of the job result. T
* `amount`: millisats that the Service Provider is requesting to be paid. An optional third value can be a bolt11 invoice. * `amount`: millisats that the Service Provider is requesting to be paid. An optional third value can be a bolt11 invoice.
* `i`: The original input(s) specified in the request. * `i`: The original input(s) specified in the request.
## 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.
Add a tag encrypted to mark the output content as `encrypted`
```json
{
"pubkey": "<service-provider pubkey>",
"content": "<encrypted payload>",
"kind": 6xxx,
"tags": [
["request", "<job-request>"],
["e", "<job-request-id>", "<relay-hint>"],
["p", "<customer's-pubkey>"],
["amount", "requested-payment-amount", "<optional-bolt11>"],
["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
@ -102,7 +156,8 @@ Service providers can give feedback about a job back to the customer.
["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>"],
] ],
...
} }
``` ```
@ -110,6 +165,8 @@ Service providers can give feedback about a job back to the customer.
* `amount` tag: as defined in the [Job Result](#job-result) section. * `amount` tag: as defined in the [Job Result](#job-result) section.
* `status` tag: Service Providers SHOULD indicate what this feedback status refers to. [Appendix 1](#appendix-1-job-feedback-status) defines status. Extra human-readable information can be added as an extra argument. * `status` tag: Service Providers SHOULD indicate what this feedback status refers to. [Appendix 1](#appendix-1-job-feedback-status) defines status. Extra human-readable information can be added as an extra argument.
* NOTE: If the input params requires input to be encrypted, then `content` field will have encrypted payload with `p` tag as key.
### Job feedback status ### Job feedback status
| status | description | | status | description |
@ -124,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.
@ -153,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>",
@ -164,7 +222,8 @@ Service Providers MAY use NIP-89 announcements to advertise their support for jo
"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"
] ],
...
} }
``` ```

9
94.md
View File

@ -4,7 +4,7 @@ NIP-94
File Metadata File Metadata
------------- -------------
`draft` `optional` `author:frbitten` `author:kieran` `author:lovvtide` `author:fiatjaf` `author:staab` `draft` `optional`
The purpose of this NIP is to allow an organization and classification of shared files. So that relays can filter and organize in any way that is of interest. With that, multiple types of filesharing clients can be created. NIP-94 support is not expected to be implemented by "social" clients that deal with kind:1 notes or by longform clients that deal with kind:30023 articles. The purpose of this NIP is to allow an organization and classification of shared files. So that relays can filter and organize in any way that is of interest. With that, multiple types of filesharing clients can be created. NIP-94 support is not expected to be implemented by "social" clients that deal with kind:1 notes or by longform clients that deal with kind:30023 articles.
@ -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> ...
} }
``` ```

14
98.md
View File

@ -2,9 +2,9 @@ NIP-98
====== ======
HTTP Auth HTTP Auth
------------------------- ---------
`draft` `optional` `author:kieran` `author:melvincarvalho` `draft` `optional`
This NIP defines an ephemeral event used to authorize requests to HTTP servers using nostr events. This NIP defines an ephemeral event used to authorize requests to HTTP servers using nostr events.
@ -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"
} }

8
99.md
View File

@ -1,8 +1,10 @@
# NIP-99 NIP-99
======
## Classified Listings Classified Listings
-------------------
`draft` `optional` `author:erskingardner` `draft` `optional`
This NIP defines `kind:30402`: a parameterized replaceable event to describe classified listings that list any arbitrary product, service, or other thing for sale or offer and includes enough structured metadata to make them useful. This NIP defines `kind:30402`: a parameterized replaceable event to describe classified listings that list any arbitrary product, service, or other thing for sale or offer and includes enough structured metadata to make them useful.

View File

@ -1,18 +1,20 @@
# NIPs # NIPs
NIPs stand for **Nostr Implementation Possibilities**. NIPs stand for **Nostr Implementation Possibilities**.
They exist to document what may be implemented by [Nostr](https://github.com/nostr-protocol/nostr)-compatible _relay_ and _client_ software. They exist to document what may be implemented by [Nostr](https://github.com/nostr-protocol/nostr)-compatible _relay_ and _client_ software.
--- ---
- [List](#list) - [List](#list)
- [Event Kinds](#event-kinds) - [Event Kinds](#event-kinds)
- [Event Kind Ranges](#event-kind-ranges)
- [Message Types](#message-types) - [Message Types](#message-types)
- [Client to Relay](#client-to-relay) - [Client to Relay](#client-to-relay)
- [Relay to Client](#relay-to-client) - [Relay to Client](#relay-to-client)
- [Standardized Tags](#standardized-tags) - [Standardized Tags](#standardized-tags)
- [Criteria for acceptance of NIPs](#criteria-for-acceptance-of-nips) - [Criteria for acceptance of NIPs](#criteria-for-acceptance-of-nips)
- [Is this repository a centralizing factor?](#is-this-repository-a-centralizing-factor)
- [How this repository works](#how-this-repository-works)
- [License](#license) - [License](#license)
--- ---
@ -66,6 +68,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
- [NIP-72: Moderated Communities](72.md) - [NIP-72: Moderated Communities](72.md)
- [NIP-75: Zap Goals](75.md) - [NIP-75: Zap Goals](75.md)
- [NIP-78: Application-specific data](78.md) - [NIP-78: Application-specific data](78.md)
- [NIP-84: Highlights](84.md)
- [NIP-89: Recommended Application Handlers](89.md) - [NIP-89: Recommended Application Handlers](89.md)
- [NIP-90: Data Vending Machines](90.md) - [NIP-90: Data Vending Machines](90.md)
- [NIP-94: File Metadata](94.md) - [NIP-94: File Metadata](94.md)
@ -73,9 +76,8 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
- [NIP-99: Classified Listings](99.md) - [NIP-99: Classified Listings](99.md)
## Event Kinds ## Event Kinds
| kind | description | NIP | | kind | description | NIP |
| ------- | -------------------------- | ----------- | | ------------- | -------------------------- | ----------- |
| `0` | Metadata | [1](01.md) | | `0` | Metadata | [1](01.md) |
| `1` | Short Text Note | [1](01.md) | | `1` | Short Text Note | [1](01.md) |
| `2` | Recommend Relay | | | `2` | Recommend Relay | |
@ -94,28 +96,44 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
| `1063` | File Metadata | [94](94.md) | | `1063` | File Metadata | [94](94.md) |
| `1311` | Live Chat Message | [53](53.md) | | `1311` | Live Chat Message | [53](53.md) |
| `1040` | OpenTimestamps | [03](03.md) | | `1040` | OpenTimestamps | [03](03.md) |
| `1971` | Problem Tracker | [nostrocket-1971][nostrocket-1971] |
| `1984` | Reporting | [56](56.md) | | `1984` | Reporting | [56](56.md) |
| `1985` | Label | [32](32.md) | | `1985` | Label | [32](32.md) |
| `4550` | Community Post Approval | [72](72.md) | | `4550` | Community Post Approval | [72](72.md) |
| `5000`-`5999` | Job Request | [90](90.md) |
| `6000`-`6999` | Job Result | [90](90.md) |
| `7000` | Job Feedback | [90](90.md) | | `7000` | Job Feedback | [90](90.md) |
| `7001` | Subscription Start | [88](88.md) | | `7001` | Subscription Start | [88](88.md) |
| `7002` | Subscription Stop | [88](88.md) | | `7002` | Subscription Stop | [88](88.md) |
| `9041` | Zap Goal | [75](75.md) | | `9041` | Zap Goal | [75](75.md) |
| `9734` | Zap Request | [57](57.md) | | `9734` | Zap Request | [57](57.md) |
| `9735` | Zap | [57](57.md) | | `9735` | Zap | [57](57.md) |
| `10000` | Mute List | [51](51.md) | | `9802` | Highlights | [84](84.md) |
| `10001` | Pin List | [51](51.md) | | `10000` | Mute list | [51](51.md) |
| `10001` | Pin list | [51](51.md) |
| `10002` | Relay List Metadata | [65](65.md) | | `10002` | Relay List Metadata | [65](65.md) |
| `10003` | Bookmark list | [51](51.md) |
| `10004` | Communities list | [51](51.md) |
| `10005` | Public chats list | [51](51.md) |
| `10006` | Blocked relays list | [51](51.md) |
| `10007` | Search relays list | [51](51.md) |
| `10015` | Interests list | [51](51.md) |
| `10030` | User emoji list | [51](51.md) |
| `13194` | Wallet Info | [47](47.md) | | `13194` | Wallet Info | [47](47.md) |
| `22242` | Client Authentication | [42](42.md) | | `22242` | Client Authentication | [42](42.md) |
| `23194` | Wallet Request | [47](47.md) | | `23194` | Wallet Request | [47](47.md) |
| `23195` | Wallet Response | [47](47.md) | | `23195` | Wallet Response | [47](47.md) |
| `24133` | Nostr Connect | [46](46.md) | | `24133` | Nostr Connect | [46](46.md) |
| `27235` | HTTP Auth | [98](98.md) | | `27235` | HTTP Auth | [98](98.md) |
| `30000` | Categorized People List | [51](51.md) | | `30000` | Follow sets | [51](51.md) |
| `30001` | Categorized Bookmark List | [51](51.md) | | `30001` | Generic lists | [51](51.md) |
| `30002` | Relay sets | [51](51.md) |
| `30003` | Bookmark sets | [51](51.md) |
| `30004` | Curation sets | [51](51.md) |
| `30008` | Profile Badges | [58](58.md) | | `30008` | Profile Badges | [58](58.md) |
| `30009` | Badge Definition | [58](58.md) | | `30009` | Badge Definition | [58](58.md) |
| `30015` | Interest sets | [51](51.md) |
| `30030` | Emoji sets | [51](51.md) |
| `30017` | Create or update a stall | [15](15.md) | | `30017` | Create or update a stall | [15](15.md) |
| `30018` | Create or update a product | [15](15.md) | | `30018` | Create or update a product | [15](15.md) |
| `30023` | Long-form Content | [23](23.md) | | `30023` | Long-form Content | [23](23.md) |
@ -134,6 +152,8 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
| `34550` | Community Definition | [72](72.md) | | `34550` | Community Definition | [72](72.md) |
| `37001` | Subscription Tier | [88](88.md) | | `37001` | Subscription Tier | [88](88.md) |
[nostrocket-1971]: https://github.com/nostrocket/NIPS/blob/main/Problems.md
## Message types ## Message types
### Client to Relay ### Client to Relay
@ -211,21 +231,26 @@ Please update these lists when proposing NIPs introducing new event kinds.
4. There should be no more than one way of doing the same thing. 4. There should be no more than one way of doing the same thing.
5. Other rules will be made up when necessary. 5. Other rules will be made up when necessary.
## Mailing Lists ## Is this repository a centralizing factor?
The nostr ecosystem is getting large with many different organizations, relays To promote interoperability, we standards that everybody can follow, and we need them to define a **single way of doing each thing** without ever hurting **backwards-compatibility**, and for that purpose there is no way around getting everybody to agree on the same thing and keep a centralized index of these standards. However the fact that such index exists doesn't hurt the decentralization of Nostr. _At any point the central index can be challenged if it is failing to fulfill the needs of the protocol_ and it can migrate to other places and be maintained by other people.
and clients. Following the nips repo on github is becoming more difficult and
noisy. To coordinate on protocol development outside of github, there are
mailing lists where you can work on NIPs before submitting them here:
* [w3c nostr community group][w3-nostr] - [public-nostr@w3.org][mailto-w3] - requires signup It can even fork into multiple and then some clients would go one way, others would go another way, and some clients would adhere to both competing standards. This would hurt the simplicity, openness and interoperability of Nostr a little, but everything would still work in the short term.
* [nostr-protocol google group][nostr-google-group] - [nostr-protocol@googlegroups.com][mailto-google] - no signup required
[w3-nostr]: https://www.w3.org/community/nostr/ There is a list of notable Nostr software developers who have commit access to this repository, but that exists mostly for practical reasons, as by the nature of the thing we're dealing with the repository owner can revoke membership and rewrite history as they want -- and if these actions are unjustified or perceived as bad or evil the community must react.
[mailto-w3]: mailto:public-nostr@w3.org
[nostr-google-group]: https://groups.google.com/g/nostr-protocol ## How this repository works
[mailto-google]: mailto:nostr-protocol@googlegroups.com
Standards may emerge in two ways: the first way is that someone starts doing something, then others copy it; the second way is that someone has an idea of a new standard that could benefit multiple clients and the protocol in general without breaking **backwards-compatibility** and the principle of having **a single way of doing things**, then they write that idea and submit it to this repository, other interested parties read it and give their feedback, then once most people reasonably agree we codify that in a NIP which client and relay developers that are interested in the feature can proceed to implement.
These two ways of standardizing things are supported by this repository. Although the second is preferred, an effort will be made to codify standards emerged outside this repository into NIPs that can be later referenced and easily understood and implemented by others -- but obviously as in any human system discretion may be applied when standards are considered harmful.
## License ## License
All NIPs are public domain. All NIPs are public domain.
## Contributors
<a align="center" href="https://github.com/nostr-protocol/nips/graphs/contributors">
<img src="https://contrib.rocks/image?repo=nostr-protocol/nips" />
</a>