From 3cec80d99ebbee6b72aae31f1856181d04971244 Mon Sep 17 00:00:00 2001 From: vivganes Date: Fri, 7 Apr 2023 17:38:03 +0530 Subject: [PATCH 01/54] fix grammar and typos --- 04.md | 2 +- 05.md | 2 +- 11.md | 8 ++++---- 13.md | 2 +- 22.md | 2 +- 25.md | 2 +- 40.md | 2 +- 45.md | 2 +- 51.md | 2 +- 78.md | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/04.md b/04.md index 60ec5e04..6e45b74b 100644 --- a/04.md +++ b/04.md @@ -50,4 +50,4 @@ This standard does not go anywhere near what is considered the state-of-the-art ## Client Implementation Warning -Client's *should not* search and replace public key or note references from the `.content`. If processed like a regular text note (where `@npub...` is replaced with `#[0]` with a `["p", "..."]` tag) the tags are leaked and the mentioned user will receive the message in their inbox. +Clients *should not* search and replace public key or note references from the `.content`. If processed like a regular text note (where `@npub...` is replaced with `#[0]` with a `["p", "..."]` tag) the tags are leaked and the mentioned user will receive the message in their inbox. diff --git a/05.md b/05.md index 992983f7..a7b42b06 100644 --- a/05.md +++ b/05.md @@ -64,7 +64,7 @@ For example, if after finding that `bob@bob.com` has the public key `abc...def`, ### Public keys must be in hex format -Keys must be returned in hex format. Keys in NIP-19 `npub` format are are only meant to be used for display in client UIs, not in this NIP. +Keys must be returned in hex format. Keys in NIP-19 `npub` format are only meant to be used for display in client UIs, not in this NIP. ### User Discovery implementation suggestion diff --git a/11.md b/11.md index f97193c2..17663204 100644 --- a/11.md +++ b/11.md @@ -154,7 +154,7 @@ all, and preferably an error will be provided when those are received. `retention` is a list of specifications: each will apply to either all kinds, or a subset of kinds. Ranges may be specified for the kind field as a tuple of inclusive start and end values. Events of indicated kind (or all) are then limited to a `count` -and or time period. +and/or time period. It is possible to effectively blacklist Nostr-based protocols that rely on a specific `kind` number, by giving a retention time of zero for those `kind` values. @@ -175,8 +175,8 @@ It is not possible to describe the limitations of each country's laws and policies which themselves are typically vague and constantly shifting. Therefore, this field allows the relay operator to indicate which -country's' laws might end up being enforced on them, and then -indirectly on their users's content. +countries' laws might end up being enforced on them, and then +indirectly on their users' content. Users should be able to avoid relays in countries they don't like, and/or select relays in more favourable zones. Exposing this @@ -220,7 +220,7 @@ To support this goal, relays MAY specify some of the following values. the major languages spoken on the relay. - `tags` is a list of limitations on the topics to be discussed. - For example `sfw-only` indicates hat only "Safe For Work" content + For example `sfw-only` indicates that only "Safe For Work" content is encouraged on this relay. This relies on assumptions of what the "work" "community" feels "safe" talking about. In time, a common set of tags may emerge that allow users to find relays that suit diff --git a/13.md b/13.md index cf28d867..e3662a57 100644 --- a/13.md +++ b/13.md @@ -90,4 +90,4 @@ $ echo '["REQ", "subid", {"ids": ["000000000"]}]' | websocat wss://some-relay.c Delegated Proof of Work ----------------------- -Since the `NIP-01` note id does not commit to any signature, PoW can be outsourced to PoW providers, perhaps for a fee. This provides a way for clients to get their messages out to PoW-restricted relays without having to do any work themselves, which is useful for energy constrained devices like on mobile +Since the `NIP-01` note id does not commit to any signature, PoW can be outsourced to PoW providers, perhaps for a fee. This provides a way for clients to get their messages out to PoW-restricted relays without having to do any work themselves, which is useful for energy-constrained devices like mobile phones. diff --git a/22.md b/22.md index fb29e6ac..2172519e 100644 --- a/22.md +++ b/22.md @@ -22,7 +22,7 @@ This NIP formalizes restrictions on event timestamps as accepted by a relay and The event `created_at` field is just a unix timestamp and can be set to a time in the past or future. Relays accept and share events dated to 20 years ago or 50,000 years in the future. This NIP aims to define a way for relays that do not want to store events with *any* timestamp to set their own restrictions. -[Replaceable events](16.md#replaceable-events) can behave rather unexpected if the user wrote them - or tried to write them - with a wrong system clock. Persisting an update with a backdated system now would result in the update not getting persisted without a notification and if they did the last update with a forward dated system, they will again fail to do another update with the now correct time. +[Replaceable events](16.md#replaceable-events) can behave rather unexpectedly if the user wrote them - or tried to write them - with a wrong system clock. Persisting an update with a backdated system now would result in the update not getting persisted without a notification and if they did the last update with a forward dated system, they will again fail to do another update with the now correct time. A wide adoption of this NIP could create a better user experience as it would decrease the amount of events that appear wildly out of order or even from impossible dates in the distant past or future. diff --git a/25.md b/25.md index 5ab1553c..f74bcc08 100644 --- a/25.md +++ b/25.md @@ -16,7 +16,7 @@ A reaction with `content` set to `-` SHOULD be interpreted as a "dislike" or "downvote". It SHOULD NOT be counted as a "like", and MAY be displayed as a downvote or dislike on a post. A client MAY also choose to tally likes against dislikes in a reddit-like system of upvotes and downvotes, or display them as -separate tallys. +separate tallies. The `content` MAY be an emoji, in this case it MAY be interpreted as a "like" or "dislike", or the client MAY display this emoji reaction on the post. diff --git a/40.md b/40.md index 274ee801..32680db8 100644 --- a/40.md +++ b/40.md @@ -43,7 +43,7 @@ Clients SHOULD ignore events that have expired. Relay Behavior -------------- -Relays MAY NOT delete an expired message immediately on expiration and MAY persist them indefinitely. +Relays MAY NOT delete expired messages immediately on expiration and MAY persist them indefinitely. Relays SHOULD NOT send expired events to clients, even if they are stored. Relays SHOULD drop any events that are published to them if they are expired. An expiration timestamp does not affect storage of ephemeral events. diff --git a/45.md b/45.md index cd81c116..28e5e969 100644 --- a/45.md +++ b/45.md @@ -6,7 +6,7 @@ Event Counts `draft` `optional` `author:staab` -Relays may support the `COUNT` verb, which provide a mechanism for obtaining event counts. +Relays may support the `COUNT` verb, which provides a mechanism for obtaining event counts. ## Motivation diff --git a/51.md b/51.md index b4143ada..34a5def8 100644 --- a/51.md +++ b/51.md @@ -10,7 +10,7 @@ A "list" event is defined as having a list of public and/or private tags. Public If a list type should only be defined once per user (like the 'Mute' list), the list type's events should follow the specification for [NIP-16 - Replaceable Events](16.md). These lists may be referred to as 'replaceable lists'. -Otherwise the list type's events should follow the specification for [NIP-33 - Parameterized Replaceable Events](33.md), where the list name will be used as the 'd' parameter. These lists may be referred to as 'parameterized replaceable lists'. +Otherwise, the list type's events should follow the specification for [NIP-33 - Parameterized Replaceable Events](33.md), where the list name will be used as the 'd' parameter. These lists may be referred to as 'parameterized replaceable lists'. ## Replaceable List Event Example diff --git a/78.md b/78.md index 175f66b1..10ff5358 100644 --- a/78.md +++ b/78.md @@ -8,7 +8,7 @@ Arbitrary custom app data The goal of this NIP is to enable [remoteStorage](https://remotestorage.io/)-like capabilities for custom applications that do not care about interoperability. -Even though interoperability is great, some apps do not want or do not need interoperability, and it that wouldn't make sense for them. Yet Nostr can still serve as a generalized data storage for these apps in a "bring your own database" way, for example: a user would open an app and somehow input their preferred relay for storage, which would then enable these apps to store application-specific data there. +Even though interoperability is great, some apps do not want or do not need interoperability, and it wouldn't make sense for them. Yet Nostr can still serve as a generalized data storage for these apps in a "bring your own database" way, for example: a user would open an app and somehow input their preferred relay for storage, which would then enable these apps to store application-specific data there. ## Nostr event From c7711aa8027b064b14236343dc9f287a5ecd3b2f Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Sat, 8 Apr 2023 14:13:18 +1200 Subject: [PATCH 02/54] JSON quoting (and other fixes) --- 11.md | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/11.md b/11.md index 17663204..a3773642 100644 --- a/11.md +++ b/11.md @@ -69,18 +69,18 @@ are rejected or fail immediately. ```json { ... - limitation: { - max_message_length: 16384, - max_subscriptions: 20, - max_filters: 100, - max_limit: 5000, - max_subid_length: 100, - min_prefix: 4, - max_event_tags: 100, - max_content_length: 8196, - min_pow_difficulty: 30, - auth_required: true, - payment_required: true, + "limitation": { + "max_message_length": 16384, + "max_subscriptions": 20, + "max_filters": 100, + "max_limit": 5000, + "max_subid_length": 100, + "min_prefix": 4, + "max_event_tags": 100, + "max_content_length": 8196, + "min_pow_difficulty": 30, + "auth_required": true, + "payment_required": true, } ... } @@ -141,11 +141,11 @@ all, and preferably an error will be provided when those are received. ```json { ... - retention: [ - { kinds: [0, 1, [5, 7], [40, 49]], time: 3600 }, - { kinds: [[40000, 49999], time: 100 }, - { kinds: [[30000, 39999], count: 1000 }, - { time: 3600, count: 10000 } + "retention": [ + { "kinds": [0, 1, [5, 7], [40, 49]], "time": 3600 }, + { "kinds": [[40000, 49999]], "time": 100 }, + { "kinds": [[30000, 39999]], "count": 1000 }, + { "time": 3600, "count": 10000 } ] ... } @@ -185,7 +185,7 @@ flexibility is up to the client software. ```json { ... - relay_countries: [ 'CA', 'US' ], + "relay_countries": [ "CA", "US" ], ... } ``` @@ -208,9 +208,9 @@ To support this goal, relays MAY specify some of the following values. ```json { ... - language_tags: [ 'en', 'en-419' ], - tags: [ 'sfw-only', 'bitcoin-only', 'anime' ], - posting_policy: 'https://example.com/posting-policy.html', + "language_tags": [ "en", "en-419" ], + "tags": [ "sfw-only", "bitcoin-only", "anime" ], + "posting_policy": "https://example.com/posting-policy.html", ... } ``` @@ -245,11 +245,12 @@ Relays that require payments may want to expose their fee schedules. ```json { ... - payments_url: "https://my-relay/payments", - fees: { - "admission": [{ amount: 1000000, unit: 'msats' }], - "subscription": [{ amount: 5000000, unit: 'msats', period: 2592000 }], - "publication": [{ kinds: [4], amount: 100, unit: 'msats' }], + "payments_url": "https://my-relay/payments", + "fees": { + "admission": [{ "amount": 1000000, "unit": "msats" }], + "subscription": [{ "amount": 5000000, "unit": "msats", "period": 2592000 }], + "publication": [{ "kinds": [4], "amount": 100, "unit": "msats" }], }, ... } +``` From dee546ed9ead06135522307c7effafb8e7095afd Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Sun, 9 Apr 2023 10:24:50 +1200 Subject: [PATCH 03/54] Indicate that TLVs that are not recognized or supported should be ignored --- 19.md | 1 + 1 file changed, 1 insertion(+) diff --git a/19.md b/19.md index 9d73458d..91afaf75 100644 --- a/19.md +++ b/19.md @@ -66,3 +66,4 @@ These possible standardized `TLV` types are indicated here: ## Notes - `npub` keys MUST NOT be used in NIP-01 events or in NIP-05 JSON responses, only the hex format is supported there. +- When decoding a bech32-formatted string, TLVs that are not recognized or supported should be ignored, rather than causing an error. From fb5b7c739ff92cec4962990aa99c54fac9f5de81 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sun, 9 Apr 2023 08:50:24 -0300 Subject: [PATCH 04/54] merge NIP-15 into NIP-01. --- 01.md | 5 +++-- 15.md | 21 --------------------- README.md | 3 +-- 3 files changed, 4 insertions(+), 25 deletions(-) delete mode 100644 15.md diff --git a/01.md b/01.md index 4cfdd359..8efb8ecf 100644 --- a/01.md +++ b/01.md @@ -4,7 +4,7 @@ NIP-01 Basic protocol flow description ------------------------------- -`draft` `mandatory` `author:fiatjaf` `author:distbit` `author:scsibug` `author:kukks` `author:jb55` +`draft` `mandatory` `author:fiatjaf` `author:distbit` `author:scsibug` `author:kukks` `author:jb55` `author:semisol` 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. @@ -89,7 +89,8 @@ The `limit` property of a filter is only valid for the initial query and can be Relays can send 2 types of messages, which must also be JSON arrays, according to the following patterns: * `["EVENT", , ]`, used to send events requested by clients. - * `["NOTICE", ]`, used to send human-readable error messages or other things to clients. + * `["EOSE", ]`, used to indicate the _end of stored events_ and the beginning of events newly received in real-time. + * `["NOTICE", ]`, used to send human-readable error messages or other things to clients. This NIP defines no rules for how `NOTICE` messages should be sent or treated. diff --git a/15.md b/15.md deleted file mode 100644 index 081a97d9..00000000 --- a/15.md +++ /dev/null @@ -1,21 +0,0 @@ -NIP-15 -====== - -End of Stored Events Notice ---------------------------- - -`final` `optional` `author:Semisol` - -Relays may support notifying clients when all stored events have been sent. - -If a relay supports this NIP, the relay SHOULD send the client a `EOSE` message in the format `["EOSE", ]` after it has sent all the events it has persisted and it indicates all the events that come after this message are newly published. - -Client Behavior ---------------- - -Clients SHOULD use the `supported_nips` field to learn if a relay supports end of stored events notices. - -Motivation ----------- - -The motivation for this proposal is to reduce uncertainty when all events have been sent by a relay to make client code possibly less complex. diff --git a/README.md b/README.md index 215e5cd4..ec55ab7e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh - [NIP-12: Generic Tag Queries](12.md) - [NIP-13: Proof of Work](13.md) - [NIP-14: Subject tag in text events.](14.md) -- [NIP-15: End of Stored Events Notice](15.md) - [NIP-16: Event Treatment](16.md) - [NIP-18: Reposts](18.md) - [NIP-19: bech32-encoded entities](19.md) @@ -96,7 +95,7 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh |--------|---------------------------------------------------------|-------------| | EVENT | used to send events requested to clients | [1](01.md) | | NOTICE | used to send human-readable messages to clients | [1](01.md) | -| EOSE | used to notify clients all stored events have been sent | [15](15.md) | +| EOSE | used to notify clients all stored events have been sent | [1](01.md) | | OK | used to notify clients if an EVENT was successful | [20](20.md) | | AUTH | used to send authentication challenges | [42](42.md) | | COUNT | used to send requested event counts to clients | [45](45.md) | From 01f90d105d995df7308ef6bea46cc93cdef16ec3 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sun, 9 Apr 2023 21:21:59 -0300 Subject: [PATCH 05/54] indicate optional kind TLV on nevent (@v0l). --- 19.md | 1 + 1 file changed, 1 insertion(+) diff --git a/19.md b/19.md index 91afaf75..6fc4523e 100644 --- a/19.md +++ b/19.md @@ -53,6 +53,7 @@ These possible standardized `TLV` types are indicated here: - for `nevent`, _optionally_, the 32 bytes of the pubkey of the event - `3`: `kind` - for `naddr`, the 32-bit unsigned integer of the kind, big-endian + - for `nevent`, _optionally_, the 32-bit unsigned integer of the kind, big-endian ## Examples From 9d1d701285b7f6051160e8cd6890f8fe5239be70 Mon Sep 17 00:00:00 2001 From: Martin Dutra Date: Mon, 10 Apr 2023 23:40:06 -0300 Subject: [PATCH 06/54] Add links to NIP-21 --- 27.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/27.md b/27.md index 028ee5ea..6d761206 100644 --- a/27.md +++ b/27.md @@ -8,11 +8,11 @@ Text Note References 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). -When creating an event, clients should include mentions to other profiles and to other events in the middle of the `.content` using NIP-21 codes, such as `nostr:nprofile1qqsw3dy8cpu...6x2argwghx6egsqstvg`. +When creating an event, clients should include mentions to other profiles and to other events in the middle of the `.content` using [NIP-21](21.md) codes, such as `nostr:nprofile1qqsw3dy8cpu...6x2argwghx6egsqstvg`. Including [NIP-10](10.md)-style tags (`["e", , , ]`) for each reference is optional, clients should do it whenever they want the profile being mentioned to be notified of the mention, or when they want the referenced event to recognize their mention as a reply. -A reader client that receives an event with such `nostr:...` mentions in its `.content` can do any desired context augmentation (for example, linking to the profile or showing a preview of the mentioned event contents) it wants in the process. If turning such mentions into links, they could become internal links, NIP-21 links or direct links to web clients that will handle these references. +A reader client that receives an event with such `nostr:...` mentions in its `.content` can do any desired context augmentation (for example, linking to the profile or showing a preview of the mentioned event contents) it wants in the process. If turning such mentions into links, they could become internal links, [NIP-21](21.md) links or direct links to web clients that will handle these references. --- From 4b44453626dccd928952392fa8c6e7807b39a8ba Mon Sep 17 00:00:00 2001 From: Yoji Shidara Date: Tue, 11 Apr 2023 13:48:58 +0900 Subject: [PATCH 07/54] Fix a typo; now types are EVENT, EOSE and NOTICE --- 01.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01.md b/01.md index 8efb8ecf..ae138246 100644 --- a/01.md +++ b/01.md @@ -86,7 +86,7 @@ The `limit` property of a filter is only valid for the initial query and can be ### From relay to client: sending events and notices -Relays can send 2 types of messages, which must also be JSON arrays, according to the following patterns: +Relays can send 3 types of messages, which must also be JSON arrays, according to the following patterns: * `["EVENT", , ]`, used to send events requested by clients. * `["EOSE", ]`, used to indicate the _end of stored events_ and the beginning of events newly received in real-time. From 9ef39553e464d1ecd656f57b615ce1aa72c39176 Mon Sep 17 00:00:00 2001 From: codytseng Date: Wed, 12 Apr 2023 23:18:22 +0800 Subject: [PATCH 08/54] feat: support counting by filters --- 45.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/45.md b/45.md index 28e5e969..87e80002 100644 --- a/45.md +++ b/45.md @@ -14,18 +14,26 @@ Some queries a client may want to execute against connected relays are prohibiti ## Filters and return values -This NIP defines a verb called `COUNT`, which accepts a subscription id and a filter as specified in [NIP 01](01.md). +This NIP defines a verb called `COUNT`, which accepts a subscription id and filters as specified in [NIP 01](01.md). + +``` +["COUNT", , ...] +``` Counts are returned using a `COUNT` response in the form `{count: }`. Relays may use probabilistic counts to reduce compute requirements. +``` +["COUNT", , {"count": }] +``` + Examples: ``` # Followers count -["COUNT", "", {kinds: [3], '#p': []}] -["COUNT", "", {count: 238}] +["COUNT", , {"kinds": [3], "#p": []}] +["COUNT", , {"count": 238}] # Count posts and reactions -["COUNT", "", {kinds: [1, 7], authors: []}] -["COUNT", "", {count: 5}] +["COUNT", , {"kinds": [1, 7], "authors": []}] +["COUNT", , {"count": 5}] ``` From bf0a0da6a48b96467172414d8e41dc72b0ca379c Mon Sep 17 00:00:00 2001 From: Arc <33088785+arcbtc@users.noreply.github.com> Date: Thu, 13 Apr 2023 11:13:04 +0100 Subject: [PATCH 09/54] NIP-15 Nostr marketplace (#330) Co-authored-by: Andrew Camilleri Co-authored-by: Vlad Stan --- 15.md | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 15.md diff --git a/15.md b/15.md new file mode 100644 index 00000000..a3d105da --- /dev/null +++ b/15.md @@ -0,0 +1,214 @@ +NIP-15 +====== + +Nostr Marketplace (for resilient marketplaces) +----------------------------------- + +`draft` `optional` `author:fiatjaf` `author:benarc` `author:motorina0` `author:talvasconcelos` + +> Based on https://github.com/lnbits/Diagon-Alley + +> Implemented here https://github.com/lnbits/nostrmarket + +## Terms + +- `merchant` - seller of products with NOSTR key-pair +- `customer` - buyer of products with NOSTR key-pair +- `product` - item for sale by the `merchant` +- `stall` - list of products controlled by `merchant` (a `merchant` can have multiple stalls) +- `marketplace` - clientside software for searching `stalls` and purchasing `products` + +## Nostr Marketplace Clients + +### Merchant admin + +Where the `merchant` creates, updates and deletes `stalls` and `products`, as well as where they manage sales, payments and communication with `customers`. + +The `merchant` admin software can be purely clientside, but for `convenience` and uptime, implementations will likely have a server client listening for NOSTR events. + +### Marketplace + +`Marketplace` software should be entirely clientside, either as a stand-alone app, or as a purely frontend webpage. A `customer` subscribes to different merchant NOSTR public keys, and those `merchants` `stalls` and `products` become listed and searchable. The marketplace client is like any other ecommerce site, with basket and checkout. `Marketplaces` may also wish to include a `customer` support area for direct message communication with `merchants`. + +## `Merchant` publishing/updating products (event) + +A merchant can publish these events: +| Kind | | Description | NIP | +|---------|------------------|---------------------------------------------------------------------------------------------------------------|-----------------------------------------| +| `0 ` | `set_meta` | The merchant description (similar with any `nostr` public key). | [NIP01 ](https://github.com/nostr-protocol/nips/blob/master/01.md) | +| `30017` | `set_stall` | Create or update a stall. | [NIP33](https://github.com/nostr-protocol/nips/blob/master/33.md) (Parameterized Replaceable Event) | +| `30018` | `set_product` | Create or update a product. | [NIP33](https://github.com/nostr-protocol/nips/blob/master/33.md) (Parameterized Replaceable Event) | +| `4 ` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. | [NIP09](https://github.com/nostr-protocol/nips/blob/master/09.md) | +| `5 ` | `delete` | Delete a product or a stall. | [NIP05](https://github.com/nostr-protocol/nips/blob/master/05.md) | + +### Event `30017`: Create or update a stall. + +**Event Content**: +```json +{ + "id": , + "name": , + "description": , + "currency": , + "shipping": [ + { + "id": , + "name": , + "cost": , + "countries": [], + } + ] +} +``` + +Fields that are not self-explanatory: + - `shipping`: + - an array with possible shipping zones for this stall. The customer MUST choose exactly one shipping zone. + - shipping to different zones can have different costs. For some goods (digital for examle) the cost can be zero. + - the `id` is an internal value used by the merchant. This value must be sent back as the customer selection. + +**Event Tags**: +```json + "tags": [["d", , + "stall_id": , + "name": , + "description": , + "images": <[String], array of image URLs, optional>, + "currency": , + "price": , + "quantity": , + "specs": [ + [ , ] + ] +} +``` + +Fields that are not self-explanatory: + - `specs`: + - an array of key pair values. It allows for the Customer UI to present present product specifications in a structure mode. It also allows comparison between products + - eg: `[["operating_system", "Android 12.0"], ["screen_size", "6.4 inches"], ["connector_type", "USB Type C"]]` + +_Open_: better to move `spec` in the `tags` section of the event? + +**Event Tags**: +```json + "tags": [ + ["d", , + "type": 0, + "name": , + "address": + "message": ", + "contact": { + "nostr": <32-bytes hex of a pubkey>, + "phone": , + "email": , + }, + "items": [ + { + "product_id": , + "quantity": + } + ], + "shipping_id": +} + +``` + +_Open_: is `contact.nostr` required? + + +### Step 2: `merchant` request payment (event) + +Sent back from the merchant for payment. Any payment option is valid that the merchant can check. + +The below json goes in `content` of [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md). + +`payment_options`/`type` include: + +- `url` URL to a payment page, stripe, paypal, btcpayserver, etc +- `btc` onchain bitcoin address +- `ln` bitcoin lightning invoice +- `lnurl` bitcoin lnurl-pay + +```json +{ + "id": , + "type": 1, + "message": , + "payment_options": [ + { + "type": , + "link": + }, + { + "type": , + "link": + }, + { + "type": , + "link": + } + ] +} +``` + +### Step 3: `merchant` verify payment/shipped (event) + +Once payment has been received and processed. + +The below json goes in `content` of [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md). + +```json +{ + "id": , + "type": 2, + "message": , + "paid": , + "shipped": , +} +``` + +## Customer support events + +Customer support is handled over whatever communication method was specified. If communicating via nostr, NIP-04 is used https://github.com/nostr-protocol/nips/blob/master/04.md. + +## Additional + +Standard data models can be found here here From ab93992948d1f3b8c05ef268ddc85d9f667424fa Mon Sep 17 00:00:00 2001 From: codytseng Date: Thu, 13 Apr 2023 20:31:35 +0800 Subject: [PATCH 10/54] NIP-26 allow the delegator to delete the events published by the delegatee --- 26.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/26.md b/26.md index 11468c07..b8fa9028 100644 --- a/26.md +++ b/26.md @@ -101,6 +101,8 @@ The event should be considered a valid delegation if the conditions are satisfie Clients should display the delegated note as if it was published directly by the delegator (8e0d3d3e). -#### Relay & Client Querying Support +#### Relay & Client Support -Relays should answer requests such as `["REQ", "", {"authors": ["A"]}]` by querying both the `pubkey` and delegation tags `[1]` value. \ No newline at end of file +Relays should answer requests such as `["REQ", "", {"authors": ["A"]}]` by querying both the `pubkey` and delegation tags `[1]` value. + +Relays SHOULD allow the delegator (8e0d3d3e) to delete the events published by the delegatee (477318cf). \ No newline at end of file From ebf94668dbafe7fd2f52a77aabbd1f35bdf86bb6 Mon Sep 17 00:00:00 2001 From: Luis Miguel Date: Fri, 14 Apr 2023 10:47:36 +0200 Subject: [PATCH 11/54] nip-15 typo + micro-fix Fix for one typo and micro-improvement for a property description --- 15.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/15.md b/15.md index a3d105da..e8fe4af3 100644 --- a/15.md +++ b/15.md @@ -137,13 +137,13 @@ The below json goes in content of [NIP04](https://github.com/nostr-protocol/nips "message": ", "contact": { "nostr": <32-bytes hex of a pubkey>, - "phone": , - "email": , + "phone": , + "email": , }, "items": [ { "product_id": , - "quantity": + "quantity": } ], "shipping_id": From acaefe20fa4c9efde541ac352d9c44fe6c2fe790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariano=20P=C3=A9rez=20Rodr=C3=ADguez?= Date: Thu, 13 Apr 2023 19:28:03 -0300 Subject: [PATCH 12/54] Add missing tag descriptions --- README.md | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ec55ab7e..9f31a36f 100644 --- a/README.md +++ b/README.md @@ -106,18 +106,36 @@ When experimenting with kinds, keep in mind the classification introduced by [NI ## Standardized Tags -| name | value | other parameters | NIP | -| ---------- | ----------------------- | ----------------- | ------------------------ | -| e | event id (hex) | relay URL, marker | [1](01.md), [10](10.md) | -| p | pubkey (hex) | relay URL | [1](01.md) | -| a | coordinates to an event | relay URL | [33](33.md), [23](23.md) | -| r | a reference (URL, etc) | | [12](12.md) | -| t | hashtag | | [12](12.md) | -| g | geohash | | [12](12.md) | -| nonce | random | | [13](13.md) | -| subject | subject | | [14](14.md) | -| d | identifier | | [33](33.md) | -| expiration | unix timestamp (string) | | [40](40.md) | +| name | value | other parameters | NIP | +| -------------- | ------------------------------------ | -------------------- | ------------------------ | +| `a` | coordinates to an event | relay URL | [33](33.md), [23](23.md) | +| `d` | identifier | -- | [33](33.md) | +| `e` | event id (hex) | relay URL, marker | [1](01.md), [10](10.md) | +| `g` | geohash | -- | [12](12.md) | +| `i` | identity | proof | [39](39.md) | +| `p` | pubkey (hex) | relay URL | [1](01.md) | +| `r` | a reference (URL, etc) | -- | [12](12.md) | +| `t` | hashtag | -- | [12](12.md) | +| `amount` | millisats | -- | [57](57.md) | +| `bolt11` | `bolt11` invoice | -- | [57](57.md) | +| `challenge` | challenge string | -- | [42](42.md) | +| `delegation` | pubkey, conditions, delegation token | -- | [26](26.md) | +| `description` | badge description | -- | [58](58.md) | +| `description` | invoice description | -- | [57](57.md) | +| `expiration` | unix timestamp (string) | -- | [40](40.md) | +| `image` | image URL | dimensions in pixels | [23](23.md), [58](58.md) | +| `lnurl` | `bech32` encoded `lnurl` | -- | [57](57.md) | +| `name` | badge name | -- | [58](58.md) | +| `nonce` | random | -- | [13](13.md) | +| `preimage` | hash of `bolt11` invoice | -- | [57](57.md) | +| `published_at` | unix timestamp (string) | -- | [23](23.md) | +| `relay` | relay url | -- | [42](42.md) | +| `relays` | relay list | -- | [57](57.md) | +| `subject` | subject | -- | [14](14.md) | +| `summary` | article summary | -- | [23](23.md) | +| `thumb` | badge thumbnail | dimensions in pixels | [58](58.md) | +| `title` | article title | -- | [23](23.md) | +| `zap` | profile name | type of value | [57](57.md) | ## Criteria for acceptance of NIPs From 6025b6fca0bb7cf7bb334365e92d7ae19f9e1d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariano=20P=C3=A9rez=20Rodr=C3=ADguez?= Date: Thu, 13 Apr 2023 19:28:38 -0300 Subject: [PATCH 13/54] Add reference to NIP-33 in note about kinds --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f31a36f..406ad2fa 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh Please update these lists when proposing NIPs introducing new event kinds. -When experimenting with kinds, keep in mind the classification introduced by [NIP-16](16.md). +When experimenting with kinds, keep in mind the classification introduced by [NIP-16](16.md) and [NIP-33](33.md). ## Standardized Tags From c29812001ae3b14aba1e3a913ce09e7c2fd8736f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariano=20P=C3=A9rez=20Rodr=C3=ADguez?= Date: Thu, 13 Apr 2023 19:28:57 -0300 Subject: [PATCH 14/54] Tidy message lists --- README.md | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 406ad2fa..669ae3ec 100644 --- a/README.md +++ b/README.md @@ -82,23 +82,25 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh ## Message types ### Client to Relay -| type | description | NIP | -|-------|-----------------------------------------------------|-------------| -| EVENT | used to publish events | [1](01.md) | -| REQ | used to request events and subscribe to new updates | [1](01.md) | -| CLOSE | used to stop previous subscriptions | [1](01.md) | -| AUTH | used to send authentication events | [42](42.md) | -| COUNT | used to request event counts | [45](45.md) | + +| type | description | NIP | +| ------- | --------------------------------------------------- | ----------- | +| `AUTH` | used to send authentication events | [42](42.md) | +| `CLOSE` | used to stop previous subscriptions | [1](01.md) | +| `COUNT` | used to request event counts | [45](45.md) | +| `EVENT` | used to publish events | [1](01.md) | +| `REQ` | used to request events and subscribe to new updates | [1](01.md) | ### Relay to Client -| type | description | NIP | -|--------|---------------------------------------------------------|-------------| -| EVENT | used to send events requested to clients | [1](01.md) | -| NOTICE | used to send human-readable messages to clients | [1](01.md) | -| EOSE | used to notify clients all stored events have been sent | [1](01.md) | -| OK | used to notify clients if an EVENT was successful | [20](20.md) | -| AUTH | used to send authentication challenges | [42](42.md) | -| COUNT | used to send requested event counts to clients | [45](45.md) | + +| type | description | NIP | +| -------- | ------------------------------------------------------- | ----------- | +| `AUTH` | used to send authentication challenges | [42](42.md) | +| `COUNT` | used to send requested event counts to clients | [45](45.md) | +| `EOSE` | used to notify clients all stored events have been sent | [1](01.md) | +| `EVENT` | used to send events requested to clients | [1](01.md) | +| `NOTICE` | used to send human-readable messages to clients | [1](01.md) | +| `OK` | used to notify clients if an EVENT was successful | [20](20.md) | Please update these lists when proposing NIPs introducing new event kinds. From 3eb2d6e816cac7ff4a623133b1fef3c1872a2510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariano=20P=C3=A9rez=20Rodr=C3=ADguez?= Date: Thu, 13 Apr 2023 19:29:39 -0300 Subject: [PATCH 15/54] Extract kind ranges to their own table --- README.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 669ae3ec..b78f9dc9 100644 --- a/README.md +++ b/README.md @@ -74,10 +74,15 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh | 30009 | Badge Definition | [58](58.md) | | 30023 | Long-form Content | [23](23.md) | | 30078 | Application-specific Data | [78](78.md) | -| 1000-9999 | Regular Events | [16](16.md) | -| 10000-19999 | Replaceable Events | [16](16.md) | -| 20000-29999 | Ephemeral Events | [16](16.md) | -| 30000-39999 | Parameterized Replaceable Events | [33](33.md) | + +### Event Kind Ranges + +| range | description | NIP | +| ---------------- | -------------------------------- | ----------- | +| `1000`--`9999` | Regular Events | [16](16.md) | +| `10000`--`19999` | Replaceable Events | [16](16.md) | +| `20000`--`29999` | Ephemeral Events | [16](16.md) | +| `30000`--`39999` | Parameterized Replaceable Events | [33](33.md) | ## Message types From 754bd26b188e1f7b871fcf3789db31ef14a6e826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariano=20P=C3=A9rez=20Rodr=C3=ADguez?= Date: Thu, 13 Apr 2023 19:29:58 -0300 Subject: [PATCH 16/54] Add missing kinds to list --- README.md | 62 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index b78f9dc9..24ae2c9b 100644 --- a/README.md +++ b/README.md @@ -44,36 +44,38 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh ## Event Kinds -| kind | description | NIP | -| ------------- | -------------------------------- | ----------- | -| 0 | Metadata | [1](01.md) | -| 1 | Short Text Note | [1](01.md) | -| 2 | Recommend Relay | [1](01.md) | -| 3 | Contacts | [2](02.md) | -| 4 | Encrypted Direct Messages | [4](04.md) | -| 5 | Event Deletion | [9](09.md) | -| 6 | Reposts | [18](18.md) | -| 7 | Reaction | [25](25.md) | -| 8 | Badge Award | [58](58.md) | -| 40 | Channel Creation | [28](28.md) | -| 41 | Channel Metadata | [28](28.md) | -| 42 | Channel Message | [28](28.md) | -| 43 | Channel Hide Message | [28](28.md) | -| 44 | Channel Mute User | [28](28.md) | -| 1984 | Reporting | [56](56.md) | -| 9734 | Zap Request | [57](57.md) | -| 9735 | Zap | [57](57.md) | -| 10000 | Mute List | [51](51.md) | -| 10001 | Pin List | [51](51.md) | -| 10002 | Relay List Metadata | [65](65.md) | -| 22242 | Client Authentication | [42](42.md) | -| 24133 | Nostr Connect | [46](46.md) | -| 30000 | Categorized People List | [51](51.md) | -| 30001 | Categorized Bookmark List | [51](51.md) | -| 30008 | Profile Badges | [58](58.md) | -| 30009 | Badge Definition | [58](58.md) | -| 30023 | Long-form Content | [23](23.md) | -| 30078 | Application-specific Data | [78](78.md) | +| kind | description | NIP | +| -------- | -------------------------- | ----------- | +| `0` | Metadata | [1](01.md) | +| `1` | Short Text Note | [1](01.md) | +| `2` | Recommend Relay | [1](01.md) | +| `3` | Contacts | [2](02.md) | +| `4` | Encrypted Direct Messages | [4](04.md) | +| `5` | Event Deletion | [9](09.md) | +| `6` | Reposts | [18](18.md) | +| `7` | Reaction | [25](25.md) | +| `8` | Badge Award | [58](58.md) | +| `40` | Channel Creation | [28](28.md) | +| `41` | Channel Metadata | [28](28.md) | +| `42` | Channel Message | [28](28.md) | +| `43` | Channel Hide Message | [28](28.md) | +| `44` | Channel Mute User | [28](28.md) | +| `1984` | Reporting | [56](56.md) | +| `9734` | Zap Request | [57](57.md) | +| `9735` | Zap | [57](57.md) | +| `10000` | Mute List | [51](51.md) | +| `10001` | Pin List | [51](51.md) | +| `10002` | Relay List Metadata | [65](65.md) | +| `22242` | Client Authentication | [42](42.md) | +| `24133` | Nostr Connect | [46](46.md) | +| `30000` | Categorized People List | [51](51.md) | +| `30001` | Categorized Bookmark List | [51](51.md) | +| `30008` | Profile Badges | [58](58.md) | +| `30009` | Badge Definition | [58](58.md) | +| `30017` | Create or update a stall | [15](15.md) | +| `30018` | Create or update a product | [15](15.md) | +| `30023` | Long-form Content | [23](23.md) | +| `30078` | Application-specific Data | [78](78.md) | ### Event Kind Ranges From 074b139a26e92262a5779be85f932e4c94412b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariano=20P=C3=A9rez=20Rodr=C3=ADguez?= Date: Thu, 13 Apr 2023 19:30:23 -0300 Subject: [PATCH 17/54] Add table of contents (and NIP list header) --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 24ae2c9b..7c002b30 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,22 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document what may be implemented by [Nostr](https://github.com/fiatjaf/nostr)-compatible _relay_ and _client_ software. +--- + +- [List](#list) +- [Event Kinds](#event-kinds) + - [Event Kind Ranges](#event-kind-ranges) +- [Message Types](#message-types) + - [Client to Relay](#client-to-relay) + - [Relay to Client](#relay-to-client) +- [Standardized Tags](#standardized-tags) +- [Criteria for acceptance of NIPs](#criteria-for-acceptance-of-nips) +- [License](#license) + +--- + +## List + - [NIP-01: Basic protocol flow description](01.md) - [NIP-02: Contact List and Petnames](02.md) - [NIP-03: OpenTimestamps Attestations for Events](03.md) From ec884151b7ca85e3d348fa57a2188ca4e685bd44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariano=20P=C3=A9rez=20Rodr=C3=ADguez?= Date: Thu, 13 Apr 2023 19:30:44 -0300 Subject: [PATCH 18/54] Ensure single sentence per line --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c002b30..a89f3402 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # NIPs -NIPs stand for **Nostr Implementation Possibilities**. They exist to document what may be implemented by [Nostr](https://github.com/fiatjaf/nostr)-compatible _relay_ and _client_ software. +NIPs stand for **Nostr Implementation Possibilities**. +They exist to document what may be implemented by [Nostr](https://github.com/fiatjaf/nostr)-compatible _relay_ and _client_ software. --- From a07ac8c67116ced93e22d4a274156cacb4d5e019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariano=20P=C3=A9rez=20Rodr=C3=ADguez?= Date: Thu, 13 Apr 2023 19:31:09 -0300 Subject: [PATCH 19/54] Unrecommended notice style change --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a89f3402..a3f5fc0a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/fia - [NIP-05: Mapping Nostr keys to DNS-based internet identifiers](05.md) - [NIP-06: Basic key derivation from mnemonic seed phrase](06.md) - [NIP-07: `window.nostr` capability for web browsers](07.md) -- [NIP-08: Handling Mentions](08.md) – `unrecommended`: deprecated in favor of [NIP-27](27.md) +- [NIP-08: Handling Mentions](08.md) --- **unrecommended**: deprecated in favor of [NIP-27](27.md) - [NIP-09: Event Deletion](09.md) - [NIP-10: Conventions for clients' use of `e` and `p` tags in text events](10.md) - [NIP-11: Relay Information Document](11.md) From 76d46b4859845a5a307f98ec32eab5d8c61abba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariano=20P=C3=A9rez=20Rodr=C3=ADguez?= Date: Thu, 13 Apr 2023 19:33:02 -0300 Subject: [PATCH 20/54] Remove extra space --- README.md | 64 +++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index a3f5fc0a..417a3c3e 100644 --- a/README.md +++ b/README.md @@ -61,38 +61,38 @@ They exist to document what may be implemented by [Nostr](https://github.com/fia ## Event Kinds -| kind | description | NIP | -| -------- | -------------------------- | ----------- | -| `0` | Metadata | [1](01.md) | -| `1` | Short Text Note | [1](01.md) | -| `2` | Recommend Relay | [1](01.md) | -| `3` | Contacts | [2](02.md) | -| `4` | Encrypted Direct Messages | [4](04.md) | -| `5` | Event Deletion | [9](09.md) | -| `6` | Reposts | [18](18.md) | -| `7` | Reaction | [25](25.md) | -| `8` | Badge Award | [58](58.md) | -| `40` | Channel Creation | [28](28.md) | -| `41` | Channel Metadata | [28](28.md) | -| `42` | Channel Message | [28](28.md) | -| `43` | Channel Hide Message | [28](28.md) | -| `44` | Channel Mute User | [28](28.md) | -| `1984` | Reporting | [56](56.md) | -| `9734` | Zap Request | [57](57.md) | -| `9735` | Zap | [57](57.md) | -| `10000` | Mute List | [51](51.md) | -| `10001` | Pin List | [51](51.md) | -| `10002` | Relay List Metadata | [65](65.md) | -| `22242` | Client Authentication | [42](42.md) | -| `24133` | Nostr Connect | [46](46.md) | -| `30000` | Categorized People List | [51](51.md) | -| `30001` | Categorized Bookmark List | [51](51.md) | -| `30008` | Profile Badges | [58](58.md) | -| `30009` | Badge Definition | [58](58.md) | -| `30017` | Create or update a stall | [15](15.md) | -| `30018` | Create or update a product | [15](15.md) | -| `30023` | Long-form Content | [23](23.md) | -| `30078` | Application-specific Data | [78](78.md) | +| kind | description | NIP | +| ------- | -------------------------- | ----------- | +| `0` | Metadata | [1](01.md) | +| `1` | Short Text Note | [1](01.md) | +| `2` | Recommend Relay | [1](01.md) | +| `3` | Contacts | [2](02.md) | +| `4` | Encrypted Direct Messages | [4](04.md) | +| `5` | Event Deletion | [9](09.md) | +| `6` | Reposts | [18](18.md) | +| `7` | Reaction | [25](25.md) | +| `8` | Badge Award | [58](58.md) | +| `40` | Channel Creation | [28](28.md) | +| `41` | Channel Metadata | [28](28.md) | +| `42` | Channel Message | [28](28.md) | +| `43` | Channel Hide Message | [28](28.md) | +| `44` | Channel Mute User | [28](28.md) | +| `1984` | Reporting | [56](56.md) | +| `9734` | Zap Request | [57](57.md) | +| `9735` | Zap | [57](57.md) | +| `10000` | Mute List | [51](51.md) | +| `10001` | Pin List | [51](51.md) | +| `10002` | Relay List Metadata | [65](65.md) | +| `22242` | Client Authentication | [42](42.md) | +| `24133` | Nostr Connect | [46](46.md) | +| `30000` | Categorized People List | [51](51.md) | +| `30001` | Categorized Bookmark List | [51](51.md) | +| `30008` | Profile Badges | [58](58.md) | +| `30009` | Badge Definition | [58](58.md) | +| `30017` | Create or update a stall | [15](15.md) | +| `30018` | Create or update a product | [15](15.md) | +| `30023` | Long-form Content | [23](23.md) | +| `30078` | Application-specific Data | [78](78.md) | ### Event Kind Ranges From 97b58ccc36a8360a099e4f905fc9bc616bc03f31 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Fri, 14 Apr 2023 21:24:25 +0900 Subject: [PATCH 21/54] fix typos --- 15.md | 2 +- 51.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/15.md b/15.md index e8fe4af3..617c0115 100644 --- a/15.md +++ b/15.md @@ -64,7 +64,7 @@ A merchant can publish these events: Fields that are not self-explanatory: - `shipping`: - an array with possible shipping zones for this stall. The customer MUST choose exactly one shipping zone. - - shipping to different zones can have different costs. For some goods (digital for examle) the cost can be zero. + - shipping to different zones can have different costs. For some goods (digital for example) the cost can be zero. - the `id` is an internal value used by the merchant. This value must be sent back as the customer selection. **Event Tags**: diff --git a/51.md b/51.md index 34a5def8..80cc09ef 100644 --- a/51.md +++ b/51.md @@ -97,11 +97,11 @@ Then the user would create a 'Categorized People' list event like below: ### Mute List -An event with kind `10000` is defined as a replaceable list event for listing content a user wants to mute. Any standarized tag can be included in a 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 standarized tag can be included in a 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 @@ -109,4 +109,4 @@ An event with kind `30000` is defined as a parameterized replaceable list event ### Categorized Bookmarks List -An event with 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. Any standarized tag can be included in a Categorized Bookmarks List. +An event with 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. Any standardized tag can be included in a Categorized Bookmarks List. From 45b539d5d502fd0b42c51b209464495d8c45cc95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariano=20P=C3=A9rez=20Rodr=C3=ADguez?= Date: Fri, 14 Apr 2023 19:57:52 -0300 Subject: [PATCH 22/54] Apply changes alluded to in https://github.com/nostr-protocol/nips/pull/443 --- README.md | 61 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 417a3c3e..836a5930 100644 --- a/README.md +++ b/README.md @@ -132,36 +132,37 @@ When experimenting with kinds, keep in mind the classification introduced by [NI ## Standardized Tags -| name | value | other parameters | NIP | -| -------------- | ------------------------------------ | -------------------- | ------------------------ | -| `a` | coordinates to an event | relay URL | [33](33.md), [23](23.md) | -| `d` | identifier | -- | [33](33.md) | -| `e` | event id (hex) | relay URL, marker | [1](01.md), [10](10.md) | -| `g` | geohash | -- | [12](12.md) | -| `i` | identity | proof | [39](39.md) | -| `p` | pubkey (hex) | relay URL | [1](01.md) | -| `r` | a reference (URL, etc) | -- | [12](12.md) | -| `t` | hashtag | -- | [12](12.md) | -| `amount` | millisats | -- | [57](57.md) | -| `bolt11` | `bolt11` invoice | -- | [57](57.md) | -| `challenge` | challenge string | -- | [42](42.md) | -| `delegation` | pubkey, conditions, delegation token | -- | [26](26.md) | -| `description` | badge description | -- | [58](58.md) | -| `description` | invoice description | -- | [57](57.md) | -| `expiration` | unix timestamp (string) | -- | [40](40.md) | -| `image` | image URL | dimensions in pixels | [23](23.md), [58](58.md) | -| `lnurl` | `bech32` encoded `lnurl` | -- | [57](57.md) | -| `name` | badge name | -- | [58](58.md) | -| `nonce` | random | -- | [13](13.md) | -| `preimage` | hash of `bolt11` invoice | -- | [57](57.md) | -| `published_at` | unix timestamp (string) | -- | [23](23.md) | -| `relay` | relay url | -- | [42](42.md) | -| `relays` | relay list | -- | [57](57.md) | -| `subject` | subject | -- | [14](14.md) | -| `summary` | article summary | -- | [23](23.md) | -| `thumb` | badge thumbnail | dimensions in pixels | [58](58.md) | -| `title` | article title | -- | [23](23.md) | -| `zap` | profile name | type of value | [57](57.md) | +| name | value | other parameters | NIP | +| ----------------- | ------------------------------------ | -------------------- | ------------------------ | +| `a` | coordinates to an event | relay URL | [33](33.md), [23](23.md) | +| `d` | identifier | -- | [33](33.md) | +| `e` | event id (hex) | relay URL, marker | [1](01.md), [10](10.md) | +| `g` | geohash | -- | [12](12.md) | +| `i` | identity | proof | [39](39.md) | +| `p` | pubkey (hex) | relay URL | [1](01.md) | +| `r` | a reference (URL, etc) | -- | [12](12.md) | +| `t` | hashtag | -- | [12](12.md) | +| `amount` | millisats | -- | [57](57.md) | +| `bolt11` | `bolt11` invoice | -- | [57](57.md) | +| `challenge` | challenge string | -- | [42](42.md) | +| `content-warning` | reason | -- | [36](36.md) | +| `delegation` | pubkey, conditions, delegation token | -- | [26](26.md) | +| `description` | badge description | -- | [58](58.md) | +| `description` | invoice description | -- | [57](57.md) | +| `expiration` | unix timestamp (string) | -- | [40](40.md) | +| `image` | image URL | dimensions in pixels | [23](23.md), [58](58.md) | +| `lnurl` | `bech32` encoded `lnurl` | -- | [57](57.md) | +| `name` | badge name | -- | [58](58.md) | +| `nonce` | random | -- | [13](13.md) | +| `preimage` | hash of `bolt11` invoice | -- | [57](57.md) | +| `published_at` | unix timestamp (string) | -- | [23](23.md) | +| `relay` | relay url | -- | [42](42.md) | +| `relays` | relay list | -- | [57](57.md) | +| `subject` | subject | -- | [14](14.md) | +| `summary` | article summary | -- | [23](23.md) | +| `thumb` | badge thumbnail | dimensions in pixels | [58](58.md) | +| `title` | article title | -- | [23](23.md) | +| `zap` | profile name | type of value | [57](57.md) | ## Criteria for acceptance of NIPs From a8e083d6d8e1fa0176bc5cfe96427ac37e4d6046 Mon Sep 17 00:00:00 2001 From: Semisol <45574030+Semisol@users.noreply.github.com> Date: Sun, 16 Apr 2023 00:25:53 +0300 Subject: [PATCH 23/54] NIP-09: Fix some things --- 09.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/09.md b/09.md index b0febc74..89781fbf 100644 --- a/09.md +++ b/09.md @@ -27,13 +27,13 @@ For example: } ``` -Relays SHOULD delete or stop publishing any referenced events that have an identical `id` as the deletion request. Clients SHOULD hide or otherwise indicate a deletion status for referenced events. +Relays SHOULD delete or stop publishing any referenced events that have an identical `pubkey` as the deletion request. Clients SHOULD hide or otherwise indicate a deletion status for referenced events. Relays SHOULD continue to publish/share the deletion events indefinitely, as clients may already have the event that's intended to be deleted. Additionally, clients SHOULD broadcast deletion events to other relays which don't have it. ## Client Usage -Clients MAY choose to fully hide any events that are referenced by valid deletion events. This includes text notes, direct messages, or other yet-to-be defined event kinds. Alternatively, they MAY show the event along with an icon or other indication that the author has "disowned" the event. The `content` field MAY also be used to replace the deleted event's own content, although a user interface should clearly indicate that this is a deletion reason, not the original content. +Clients MAY choose to fully hide any events that are referenced by valid deletion events. This includes text notes, direct messages, or other yet-to-be defined event kinds. Alternatively, they MAY show the event along with an icon or other indication that the author has "disowned" the event. The `content` field MAY also be used to replace the deleted events' own content, although a user interface should clearly indicate that this is a deletion reason, not the original content. A client MUST validate that each event `pubkey` referenced in the `e` tag of the deletion request is identical to the deletion request `pubkey`, before hiding or deleting any event. Relays can not, in general, perform this validation and should not be treated as authoritative. From e1cda356a0d441875b9eafbc1e8769bb40648da1 Mon Sep 17 00:00:00 2001 From: Martin Dutra Date: Mon, 17 Apr 2023 15:20:25 -0300 Subject: [PATCH 24/54] Update 21.md Add link to NIP-19 --- 21.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/21.md b/21.md index 2525bf10..bfbb3ae5 100644 --- a/21.md +++ b/21.md @@ -10,7 +10,7 @@ This NIP standardizes the usage of a common URL scheme for maximum interoperabil The scheme is `nostr:`. -The identifiers that come after are expected to be the same as those defined in NIP-19 (except `nsec`). +The identifiers that come after are expected to be the same as those defined in [NIP-19](https://github.com/nostr-protocol/nips/blob/master/19.md) (except `nsec`). ## Examples From b315d1adb7acb0a7465c5a5d9fefc8c2db45dfa6 Mon Sep 17 00:00:00 2001 From: Asai Toshiya Date: Wed, 19 Apr 2023 22:32:08 +0900 Subject: [PATCH 25/54] Update 08.md Add link to NIP-27. --- 08.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/08.md b/08.md index fb87b536..6793e0bb 100644 --- a/08.md +++ b/08.md @@ -1,4 +1,4 @@ -> __Warning__ `unrecommended`: deprecated in favor of NIP-27 +> __Warning__ `unrecommended`: deprecated in favor of [NIP-27](27.md) NIP-08 ====== From a090de2b90f9fd83e49fa39ff4c7ef52750e904b Mon Sep 17 00:00:00 2001 From: frbittencourt Date: Thu, 9 Mar 2023 14:01:19 +0000 Subject: [PATCH 26/54] create draft NIP 94 and 95 --- 94.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 95.md | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 94.md create mode 100644 95.md diff --git a/94.md b/94.md new file mode 100644 index 00000000..06b03c8c --- /dev/null +++ b/94.md @@ -0,0 +1,43 @@ +NIP-94 - File Header +====== +`draft` `optional` `author:frbitten` + +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. +Also the goal is to create a base on the protocol for this bountsr "Filesharing App" (https://bountsr.org/p2p-filesharing/) to be implemented. + +Nostr event +------------------ +This NIP specifies the use of the `30063` event type (parameterized replaceable event), having in `content` a description of the file content, and a list of tags described below: +* `d` containing the name of the shared file to allow it to be overwritten in the future. +* `url` the url to download the file +* `type` a string indicating the data type of the file. The MIME types format must be used (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) +* `decrypt` (optional) If the file is encrypted, you must indicate in the first value the algorithm used to encrypt the file and in the second value the information (the key) that allow the decryption of the file + +```json +{ + "id": <32-bytes lowercase hex-encoded sha256 of the the serialized event data>, + "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>, + "created_at": , + "kind": 30063, + "tags": [ + ["d", ], + ["url",], + ["decrypt",,], + ["p", <32-bytes hex of a pubkey>, ], + ], + "content": "A beautiful picture of a wild toucan", + "sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> +} + +Client Behavior +--------------- +The client can use this event as they see fit. Either showing events in the same feed as kind 1 events or creating a specific feed for file listings +It allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, telegram, etc. Exemple: +To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image + +Suggested Use Cases +------------------- +* A relay for indexing shared files. For example to promote torrents +* A Pinterest-like relay and app where people can share their portfolio and inspire others. +* A simple way to distribute configurations and software updates. +* Specialized relays can provide collections of emojis, memes and animated gifs to be used in notes. diff --git a/95.md b/95.md new file mode 100644 index 00000000..680496c9 --- /dev/null +++ b/95.md @@ -0,0 +1,35 @@ +NIP-95 Base64 File +====== +`draft` `optional` `author:frbitten` + +This NIP allows users to send binary data to be stored in the relay. This data can be small pieces of information or even large files. + +Nostr event +------------------ +This NIP specifies the use of the `30064` event type (parameterized replaceable event), having in `content` the binary data that you want to be stored in Base64 format. +* `d` containing the name of the shared file to allow it to be overwritten in the future. +* `type` a string indicating the data type of the file. The MIME types format must be used (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) +* `decrypt` (optional) If the file is encrypted, you must indicate in the first value the algorithm used to encrypt the file and in the second value the information (the key) that allow the decryption of the file + +This event must not be returned in generic searches. It should only be returned if specifically requested by your ID. This avoids bandwidth consumption and unnecessary overload on the relay and client. + +The `NIP-94` can be used to broadcast the ID of that event, with the ` and ` tag referencing the event id, without having to send the full event which can be a lot of data. + +Relay Behavior +--------------- +Relays that use a relational database may have more difficulty implementing this NIP, but a possible solution is for this NIP not to be recorded in the database, but on disk, the file name being the event id. So it can be easily found and searched. And because it is not in the database, it does not interfere with the indexing of common events. + +Another solution is for Relays that want to implement this functionality and use a No-SQL database with mongodb that already supports large documents without harming performance. + +The relay can allow access to this data via URL, having its own URL pattern for these cases. And if you receive a `NIP-94` referring to a `NIP-95` you can include the URL in the proper `NIP-94` tag + +Client Behavior +--------------- +The client can use this event for any type of storage it wants. The functionality of uploading an image directly through the client's interface and including it in the note that is being created is a very useful facility for the end user. In this case, 3 events would be created. Kind 30064 with the file converted to base64, Kind 30063 which is the header of this file for dissemination and Kind 1 with the post and the image. + +Also, when used in conjunction with `NIP-94`, it allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, tegegran, etc.Exemple: . To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image + +Suggested Use Cases +------------------- +* Provide file storage service that is quickly integrable with nostr clients. +* Create an application similar to pinterest without the need for other protocols. From 342722963b5d6716410166c8e02d7d0b7cabb0f3 Mon Sep 17 00:00:00 2001 From: frbittencourt Date: Thu, 9 Mar 2023 14:04:57 +0000 Subject: [PATCH 27/54] fixed json schema --- 94.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/94.md b/94.md index 06b03c8c..0798d743 100644 --- a/94.md +++ b/94.md @@ -25,7 +25,7 @@ This NIP specifies the use of the `30063` event type (parameterized replaceable ["decrypt",,], ["p", <32-bytes hex of a pubkey>, ], ], - "content": "A beautiful picture of a wild toucan", + "content": , "sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> } From 0ef5486e569f3e9888cab1030edea96785c360e1 Mon Sep 17 00:00:00 2001 From: frbittencourt Date: Thu, 9 Mar 2023 14:05:07 +0000 Subject: [PATCH 28/54] add json schema --- 95.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/95.md b/95.md index 680496c9..ffb3906a 100644 --- a/95.md +++ b/95.md @@ -15,6 +15,21 @@ This event must not be returned in generic searches. It should only be returned The `NIP-94` can be used to broadcast the ID of that event, with the ` and ` tag referencing the event id, without having to send the full event which can be a lot of data. +```json +{ + "id": <32-bytes lowercase hex-encoded sha256 of the the serialized event data>, + "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>, + "created_at": , + "kind": 30064, + "tags": [ + ["d", ], + ["decrypt",,], + ["p", <32-bytes hex of a pubkey>, ], + ], + "content": , + "sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> +} + Relay Behavior --------------- Relays that use a relational database may have more difficulty implementing this NIP, but a possible solution is for this NIP not to be recorded in the database, but on disk, the file name being the event id. So it can be easily found and searched. And because it is not in the database, it does not interfere with the indexing of common events. From 8ea7c51f9b4fd81e4f5e390881bff43243455d16 Mon Sep 17 00:00:00 2001 From: frbittencourt Date: Thu, 9 Mar 2023 14:08:52 +0000 Subject: [PATCH 29/54] add hash tag --- 94.md | 1 + 95.md | 1 + 2 files changed, 2 insertions(+) diff --git a/94.md b/94.md index 0798d743..7712171e 100644 --- a/94.md +++ b/94.md @@ -24,6 +24,7 @@ This NIP specifies the use of the `30063` event type (parameterized replaceable ["url",], ["decrypt",,], ["p", <32-bytes hex of a pubkey>, ], + ["hash",< SHA256 hexencoded string of the file> ], "content": , "sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> diff --git a/95.md b/95.md index ffb3906a..4c2dde8c 100644 --- a/95.md +++ b/95.md @@ -25,6 +25,7 @@ The `NIP-94` can be used to broadcast the ID of that event, with the ` and ` tag ["d", ], ["decrypt",,], ["p", <32-bytes hex of a pubkey>, ], + ["hash",< SHA256 hexencoded string of the raw data>] ], "content": , "sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> From d212622ed113b9c19bab160c484c3c25fba6131f Mon Sep 17 00:00:00 2001 From: frbittencourt Date: Fri, 10 Mar 2023 10:04:00 +0000 Subject: [PATCH 30/54] fix format text in md --- 94.md | 3 ++- 95.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/94.md b/94.md index 7712171e..feead69e 100644 --- a/94.md +++ b/94.md @@ -29,11 +29,12 @@ This NIP specifies the use of the `30063` event type (parameterized replaceable "content": , "sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> } +``` Client Behavior --------------- The client can use this event as they see fit. Either showing events in the same feed as kind 1 events or creating a specific feed for file listings -It allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, telegram, etc. Exemple: +It allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, telegram, etc. Exemple: ![example](https://ibb.co/Fnj5TMg) To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image Suggested Use Cases diff --git a/95.md b/95.md index 4c2dde8c..755471f2 100644 --- a/95.md +++ b/95.md @@ -30,6 +30,7 @@ The `NIP-94` can be used to broadcast the ID of that event, with the ` and ` tag "content": , "sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> } +``` Relay Behavior --------------- @@ -43,7 +44,7 @@ Client Behavior --------------- The client can use this event for any type of storage it wants. The functionality of uploading an image directly through the client's interface and including it in the note that is being created is a very useful facility for the end user. In this case, 3 events would be created. Kind 30064 with the file converted to base64, Kind 30063 which is the header of this file for dissemination and Kind 1 with the post and the image. -Also, when used in conjunction with `NIP-94`, it allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, tegegran, etc.Exemple: . To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image +Also, when used in conjunction with `NIP-94`, it allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, tegegran, etc.Exemple: ![example](https://ibb.co/Fnj5TMg). To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image Suggested Use Cases ------------------- From 64797e7910a7dd143c22c28d29e7d6108db806b3 Mon Sep 17 00:00:00 2001 From: frbittencourt Date: Fri, 10 Mar 2023 10:07:49 +0000 Subject: [PATCH 31/54] fix example image --- 94.md | 2 +- 95.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/94.md b/94.md index feead69e..5f5a14ae 100644 --- a/94.md +++ b/94.md @@ -34,7 +34,7 @@ This NIP specifies the use of the `30063` event type (parameterized replaceable Client Behavior --------------- The client can use this event as they see fit. Either showing events in the same feed as kind 1 events or creating a specific feed for file listings -It allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, telegram, etc. Exemple: ![example](https://ibb.co/Fnj5TMg) +It allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, telegram, etc. Exemple: To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image Suggested Use Cases diff --git a/95.md b/95.md index 755471f2..3653f2ba 100644 --- a/95.md +++ b/95.md @@ -44,7 +44,7 @@ Client Behavior --------------- The client can use this event for any type of storage it wants. The functionality of uploading an image directly through the client's interface and including it in the note that is being created is a very useful facility for the end user. In this case, 3 events would be created. Kind 30064 with the file converted to base64, Kind 30063 which is the header of this file for dissemination and Kind 1 with the post and the image. -Also, when used in conjunction with `NIP-94`, it allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, tegegran, etc.Exemple: ![example](https://ibb.co/Fnj5TMg). To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image +Also, when used in conjunction with `NIP-94`, it allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, tegegran, etc.Exemple: . To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image Suggested Use Cases ------------------- From 475bcb6314beafb29e480f70a114947e7c301776 Mon Sep 17 00:00:00 2001 From: frbittencourt Date: Fri, 10 Mar 2023 10:09:38 +0000 Subject: [PATCH 32/54] minor fix --- 94.md | 3 ++- 95.md | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/94.md b/94.md index 5f5a14ae..4963f857 100644 --- a/94.md +++ b/94.md @@ -34,7 +34,8 @@ This NIP specifies the use of the `30063` event type (parameterized replaceable Client Behavior --------------- The client can use this event as they see fit. Either showing events in the same feed as kind 1 events or creating a specific feed for file listings -It allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, telegram, etc. Exemple: +It allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, telegram, etc. +Example: To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image Suggested Use Cases diff --git a/95.md b/95.md index 3653f2ba..16536abe 100644 --- a/95.md +++ b/95.md @@ -44,7 +44,9 @@ Client Behavior --------------- The client can use this event for any type of storage it wants. The functionality of uploading an image directly through the client's interface and including it in the note that is being created is a very useful facility for the end user. In this case, 3 events would be created. Kind 30064 with the file converted to base64, Kind 30063 which is the header of this file for dissemination and Kind 1 with the post and the image. -Also, when used in conjunction with `NIP-94`, it allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, tegegran, etc.Exemple: . To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image +Also, when used in conjunction with `NIP-94`, it allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, tegegran, etc. +Example: . +To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image Suggested Use Cases ------------------- From ac515573a0cf039174e850dd60ed79a60487cc2e Mon Sep 17 00:00:00 2001 From: frbittencourt Date: Fri, 10 Mar 2023 10:11:55 +0000 Subject: [PATCH 33/54] ajusts formt text --- 94.md | 6 +++++- 95.md | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/94.md b/94.md index 4963f857..1b5d8db1 100644 --- a/94.md +++ b/94.md @@ -33,11 +33,15 @@ This NIP specifies the use of the `30063` event type (parameterized replaceable Client Behavior --------------- -The client can use this event as they see fit. Either showing events in the same feed as kind 1 events or creating a specific feed for file listings +The client can use this event as they see fit. Either showing events in the same feed as kind 1 events or creating a specific feed for file listings. + It allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, telegram, etc. + Example: + To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image + Suggested Use Cases ------------------- * A relay for indexing shared files. For example to promote torrents diff --git a/95.md b/95.md index 16536abe..6f7612fb 100644 --- a/95.md +++ b/95.md @@ -45,7 +45,9 @@ Client Behavior The client can use this event for any type of storage it wants. The functionality of uploading an image directly through the client's interface and including it in the note that is being created is a very useful facility for the end user. In this case, 3 events would be created. Kind 30064 with the file converted to base64, Kind 30063 which is the header of this file for dissemination and Kind 1 with the post and the image. Also, when used in conjunction with `NIP-94`, it allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, tegegran, etc. + Example: . + To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image Suggested Use Cases From 9d69bd05dcdaa1ee19078937a6150e2720bf9ba5 Mon Sep 17 00:00:00 2001 From: frbittencourt Date: Fri, 10 Mar 2023 10:15:01 +0000 Subject: [PATCH 34/54] ajusts decrypt tag --- 94.md | 2 +- 95.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/94.md b/94.md index 1b5d8db1..51ec1e25 100644 --- a/94.md +++ b/94.md @@ -22,7 +22,7 @@ This NIP specifies the use of the `30063` event type (parameterized replaceable "tags": [ ["d", ], ["url",], - ["decrypt",,], + ["decrypt",,], ["p", <32-bytes hex of a pubkey>, ], ["hash",< SHA256 hexencoded string of the file> ], diff --git a/95.md b/95.md index 6f7612fb..292d04c8 100644 --- a/95.md +++ b/95.md @@ -23,7 +23,7 @@ The `NIP-94` can be used to broadcast the ID of that event, with the ` and ` tag "kind": 30064, "tags": [ ["d", ], - ["decrypt",,], + ["decrypt",,], ["p", <32-bytes hex of a pubkey>, ], ["hash",< SHA256 hexencoded string of the raw data>] ], From 747517f2c462ad603ee5b0b75c20693ef3913363 Mon Sep 17 00:00:00 2001 From: frbittencourt Date: Fri, 10 Mar 2023 10:18:53 +0000 Subject: [PATCH 35/54] ajusts description of decrypt tag --- 94.md | 2 +- 95.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/94.md b/94.md index 51ec1e25..7051ee6c 100644 --- a/94.md +++ b/94.md @@ -11,7 +11,7 @@ This NIP specifies the use of the `30063` event type (parameterized replaceable * `d` containing the name of the shared file to allow it to be overwritten in the future. * `url` the url to download the file * `type` a string indicating the data type of the file. The MIME types format must be used (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) -* `decrypt` (optional) If the file is encrypted, you must indicate in the first value the algorithm used to encrypt the file and in the second value the information (the key) that allow the decryption of the file +* `decrypt` (optional) If the file is encrypted, you must indicate in the first value the algorithm used to encrypt the file and in the second value the parameters that allow the decryption of the file ```json { diff --git a/95.md b/95.md index 292d04c8..00132df1 100644 --- a/95.md +++ b/95.md @@ -9,7 +9,7 @@ Nostr event This NIP specifies the use of the `30064` event type (parameterized replaceable event), having in `content` the binary data that you want to be stored in Base64 format. * `d` containing the name of the shared file to allow it to be overwritten in the future. * `type` a string indicating the data type of the file. The MIME types format must be used (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) -* `decrypt` (optional) If the file is encrypted, you must indicate in the first value the algorithm used to encrypt the file and in the second value the information (the key) that allow the decryption of the file +* `decrypt` (optional) If the file is encrypted, you must indicate in the first value the algorithm used to encrypt the file and in the second value the parameters that allow the decryption of the file This event must not be returned in generic searches. It should only be returned if specifically requested by your ID. This avoids bandwidth consumption and unnecessary overload on the relay and client. From 564d06b8a213073e59195f56141b1e8f01903639 Mon Sep 17 00:00:00 2001 From: frbittencourt Date: Fri, 10 Mar 2023 11:06:15 +0000 Subject: [PATCH 36/54] move nip-95 to other branch --- 95.md | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 95.md diff --git a/95.md b/95.md deleted file mode 100644 index 00132df1..00000000 --- a/95.md +++ /dev/null @@ -1,56 +0,0 @@ -NIP-95 Base64 File -====== -`draft` `optional` `author:frbitten` - -This NIP allows users to send binary data to be stored in the relay. This data can be small pieces of information or even large files. - -Nostr event ------------------- -This NIP specifies the use of the `30064` event type (parameterized replaceable event), having in `content` the binary data that you want to be stored in Base64 format. -* `d` containing the name of the shared file to allow it to be overwritten in the future. -* `type` a string indicating the data type of the file. The MIME types format must be used (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) -* `decrypt` (optional) If the file is encrypted, you must indicate in the first value the algorithm used to encrypt the file and in the second value the parameters that allow the decryption of the file - -This event must not be returned in generic searches. It should only be returned if specifically requested by your ID. This avoids bandwidth consumption and unnecessary overload on the relay and client. - -The `NIP-94` can be used to broadcast the ID of that event, with the ` and ` tag referencing the event id, without having to send the full event which can be a lot of data. - -```json -{ - "id": <32-bytes lowercase hex-encoded sha256 of the the serialized event data>, - "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>, - "created_at": , - "kind": 30064, - "tags": [ - ["d", ], - ["decrypt",,], - ["p", <32-bytes hex of a pubkey>, ], - ["hash",< SHA256 hexencoded string of the raw data>] - ], - "content": , - "sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> -} -``` - -Relay Behavior ---------------- -Relays that use a relational database may have more difficulty implementing this NIP, but a possible solution is for this NIP not to be recorded in the database, but on disk, the file name being the event id. So it can be easily found and searched. And because it is not in the database, it does not interfere with the indexing of common events. - -Another solution is for Relays that want to implement this functionality and use a No-SQL database with mongodb that already supports large documents without harming performance. - -The relay can allow access to this data via URL, having its own URL pattern for these cases. And if you receive a `NIP-94` referring to a `NIP-95` you can include the URL in the proper `NIP-94` tag - -Client Behavior ---------------- -The client can use this event for any type of storage it wants. The functionality of uploading an image directly through the client's interface and including it in the note that is being created is a very useful facility for the end user. In this case, 3 events would be created. Kind 30064 with the file converted to base64, Kind 30063 which is the header of this file for dissemination and Kind 1 with the post and the image. - -Also, when used in conjunction with `NIP-94`, it allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, tegegran, etc. - -Example: . - -To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image - -Suggested Use Cases -------------------- -* Provide file storage service that is quickly integrable with nostr clients. -* Create an application similar to pinterest without the need for other protocols. From 2b8f12caab99f465785d17e5ac3532e52ca9c93e Mon Sep 17 00:00:00 2001 From: Fernando Bittencourt Date: Fri, 17 Mar 2023 13:29:22 +0000 Subject: [PATCH 37/54] Update 94.md suggestion by arthurfranca Co-authored-by: arthurfranca --- 94.md | 1 - 1 file changed, 1 deletion(-) diff --git a/94.md b/94.md index 7051ee6c..21eefc95 100644 --- a/94.md +++ b/94.md @@ -8,7 +8,6 @@ Also the goal is to create a base on the protocol for this bountsr "Filesharing Nostr event ------------------ This NIP specifies the use of the `30063` event type (parameterized replaceable event), having in `content` a description of the file content, and a list of tags described below: -* `d` containing the name of the shared file to allow it to be overwritten in the future. * `url` the url to download the file * `type` a string indicating the data type of the file. The MIME types format must be used (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) * `decrypt` (optional) If the file is encrypted, you must indicate in the first value the algorithm used to encrypt the file and in the second value the parameters that allow the decryption of the file From fddce814a37e66ba9eaf1f1f1f089ce7761309ec Mon Sep 17 00:00:00 2001 From: Fernando Bittencourt Date: Fri, 17 Mar 2023 13:29:55 +0000 Subject: [PATCH 38/54] Update 94.md change tag hash with suggestion by arthurfranca Co-authored-by: arthurfranca --- 94.md | 1 + 1 file changed, 1 insertion(+) diff --git a/94.md b/94.md index 21eefc95..13cd2310 100644 --- a/94.md +++ b/94.md @@ -11,6 +11,7 @@ This NIP specifies the use of the `30063` event type (parameterized replaceable * `url` the url to download the file * `type` a string indicating the data type of the file. The MIME types format must be used (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) * `decrypt` (optional) If the file is encrypted, you must indicate in the first value the algorithm used to encrypt the file and in the second value the parameters that allow the decryption of the file +* `hash` containing the SHA-256 hexencoded string of the file or the BlurHash string (for images). The third array value is the lowercase chosen algorithm name: "sha256" or "blurhash". ```json { From 6b9d93c2857dd4714675543f45e7f55a653d1ff5 Mon Sep 17 00:00:00 2001 From: Fernando Bittencourt Date: Fri, 17 Mar 2023 13:31:22 +0000 Subject: [PATCH 39/54] Update 94.md change hash tag with suggestion by arthutfranca Co-authored-by: arthurfranca --- 94.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/94.md b/94.md index 13cd2310..13315e0c 100644 --- a/94.md +++ b/94.md @@ -24,7 +24,7 @@ This NIP specifies the use of the `30063` event type (parameterized replaceable ["url",], ["decrypt",,], ["p", <32-bytes hex of a pubkey>, ], - ["hash",< SHA256 hexencoded string of the file> + ["hash", "LKN]Rv%2Tw=w]~RBVZRi};RPxuwH", "blurhash"] ], "content": , "sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> From 088c3bba1d730dcc80b376153288f918005ca3ce Mon Sep 17 00:00:00 2001 From: Fernando Bittencourt Date: Fri, 17 Mar 2023 13:34:04 +0000 Subject: [PATCH 40/54] Update 94.md fixed by arthurfranca Co-authored-by: arthurfranca --- 94.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/94.md b/94.md index 13315e0c..81e2bf27 100644 --- a/94.md +++ b/94.md @@ -23,7 +23,7 @@ This NIP specifies the use of the `30063` event type (parameterized replaceable ["d", ], ["url",], ["decrypt",,], - ["p", <32-bytes hex of a pubkey>, ], + ["type", "image/webp"], ["hash", "LKN]Rv%2Tw=w]~RBVZRi};RPxuwH", "blurhash"] ], "content": , From 40fa44b0fc0f358995bf8c162087a11173d912cc Mon Sep 17 00:00:00 2001 From: Fernando Bittencourt Date: Fri, 17 Mar 2023 13:34:21 +0000 Subject: [PATCH 41/54] Update 94.md change to regular event Co-authored-by: arthurfranca --- 94.md | 1 - 1 file changed, 1 deletion(-) diff --git a/94.md b/94.md index 81e2bf27..dfc77d93 100644 --- a/94.md +++ b/94.md @@ -20,7 +20,6 @@ This NIP specifies the use of the `30063` event type (parameterized replaceable "created_at": , "kind": 30063, "tags": [ - ["d", ], ["url",], ["decrypt",,], ["type", "image/webp"], From bd32adfc2aba90b3a3e486c7b856c93480301992 Mon Sep 17 00:00:00 2001 From: frbittencourt Date: Fri, 17 Mar 2023 13:41:46 +0000 Subject: [PATCH 42/54] change to regular event --- 94.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/94.md b/94.md index dfc77d93..533b49cb 100644 --- a/94.md +++ b/94.md @@ -7,7 +7,7 @@ Also the goal is to create a base on the protocol for this bountsr "Filesharing Nostr event ------------------ -This NIP specifies the use of the `30063` event type (parameterized replaceable event), having in `content` a description of the file content, and a list of tags described below: +This NIP specifies the use of the `1063` event type (parameterized replaceable event), having in `content` a description of the file content, and a list of tags described below: * `url` the url to download the file * `type` a string indicating the data type of the file. The MIME types format must be used (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) * `decrypt` (optional) If the file is encrypted, you must indicate in the first value the algorithm used to encrypt the file and in the second value the parameters that allow the decryption of the file @@ -18,12 +18,12 @@ This NIP specifies the use of the `30063` event type (parameterized replaceable "id": <32-bytes lowercase hex-encoded sha256 of the the serialized event data>, "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>, "created_at": , - "kind": 30063, + "kind": 1063, "tags": [ ["url",], ["decrypt",,], - ["type", "image/webp"], - ["hash", "LKN]Rv%2Tw=w]~RBVZRi};RPxuwH", "blurhash"] + ["type", ], + ["hash", "LKN]Rv%2Tw=w]~RBVZRi};RPxuwH", <"blurhash" or "sha256">] ], "content": , "sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> From f766a850cd6cc72f35681906b519031745cbc5a8 Mon Sep 17 00:00:00 2001 From: Fernando Bittencourt Date: Tue, 28 Mar 2023 09:57:56 +0100 Subject: [PATCH 43/54] Apply suggestions from code review add sugestion of arthurfranca and nryo-o Co-authored-by: arthurfranca Co-authored-by: Ryo_o <127748188+nryo-o@users.noreply.github.com> --- 94.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/94.md b/94.md index 533b49cb..005ef267 100644 --- a/94.md +++ b/94.md @@ -8,7 +8,7 @@ Also the goal is to create a base on the protocol for this bountsr "Filesharing Nostr event ------------------ This NIP specifies the use of the `1063` event type (parameterized replaceable event), having in `content` a description of the file content, and a list of tags described below: -* `url` the url to download the file +* `r` the url to download the file, without trailing slash * `type` a string indicating the data type of the file. The MIME types format must be used (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) * `decrypt` (optional) If the file is encrypted, you must indicate in the first value the algorithm used to encrypt the file and in the second value the parameters that allow the decryption of the file * `hash` containing the SHA-256 hexencoded string of the file or the BlurHash string (for images). The third array value is the lowercase chosen algorithm name: "sha256" or "blurhash". @@ -20,7 +20,7 @@ This NIP specifies the use of the `1063` event type (parameterized replaceable e "created_at": , "kind": 1063, "tags": [ - ["url",], + ["r",], ["decrypt",,], ["type", ], ["hash", "LKN]Rv%2Tw=w]~RBVZRi};RPxuwH", <"blurhash" or "sha256">] From bfd2a0fc38f85371a85f47891565f410ed0af48f Mon Sep 17 00:00:00 2001 From: frbittencourt Date: Wed, 5 Apr 2023 15:11:59 +0100 Subject: [PATCH 44/54] fixed text description --- 94.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/94.md b/94.md index 005ef267..78c7056c 100644 --- a/94.md +++ b/94.md @@ -7,8 +7,8 @@ Also the goal is to create a base on the protocol for this bountsr "Filesharing Nostr event ------------------ -This NIP specifies the use of the `1063` event type (parameterized replaceable event), having in `content` a description of the file content, and a list of tags described below: -* `r` the url to download the file, without trailing slash +This NIP specifies the use of the `1063` event type, having in `content` a description of the file content, and a list of tags described below: +* `r` the url to download the file * `type` a string indicating the data type of the file. The MIME types format must be used (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) * `decrypt` (optional) If the file is encrypted, you must indicate in the first value the algorithm used to encrypt the file and in the second value the parameters that allow the decryption of the file * `hash` containing the SHA-256 hexencoded string of the file or the BlurHash string (for images). The third array value is the lowercase chosen algorithm name: "sha256" or "blurhash". From 34af61df41f7e6c7668cd2c6fbce17042503751e Mon Sep 17 00:00:00 2001 From: frbittencourt Date: Wed, 12 Apr 2023 14:03:52 +0100 Subject: [PATCH 45/54] nip update to reach consensus with other nips --- 94.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/94.md b/94.md index 78c7056c..5c125651 100644 --- a/94.md +++ b/94.md @@ -8,10 +8,14 @@ Also the goal is to create a base on the protocol for this bountsr "Filesharing Nostr event ------------------ This NIP specifies the use of the `1063` event type, having in `content` a description of the file content, and a list of tags described below: -* `r` the url to download the file -* `type` a string indicating the data type of the file. The MIME types format must be used (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) -* `decrypt` (optional) If the file is encrypted, you must indicate in the first value the algorithm used to encrypt the file and in the second value the parameters that allow the decryption of the file -* `hash` containing the SHA-256 hexencoded string of the file or the BlurHash string (for images). The third array value is the lowercase chosen algorithm name: "sha256" or "blurhash". +* `url` the url to download the file +* `m` a string indicating the data type of the file. The MIME types format must be used (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) +* `"aes-256-gcm"` (optional) key and nonce for AES-GCM encryption with tagSize always 128bits +* `x` containing the SHA-256 hexencoded string of the file. +* `size` (optional) size of file in bytes +* `magnet` (optional) URI to magnet file +* `i` (optional) torrent infohash +* `blurhash`(optional) for cosmetic purposes ```json { @@ -20,10 +24,14 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr "created_at": , "kind": 1063, "tags": [ - ["r",], - ["decrypt",,], - ["type", ], - ["hash", "LKN]Rv%2Tw=w]~RBVZRi};RPxuwH", <"blurhash" or "sha256">] + ["url",], + ["aes-256-gcm",, ], + ["m", ], + ["x",], + ["size", ], + ["magnet", ], + ["i",], + ["blurhash", ] ], "content": , "sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> From 92536d8b562d20a37aee92fc4e001937845f4ae7 Mon Sep 17 00:00:00 2001 From: Asai Toshiya Date: Fri, 21 Apr 2023 00:45:35 +0900 Subject: [PATCH 46/54] Add NIP-94 and kind 1063 to README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 836a5930..d47bf76a 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/fia - [NIP-58: Badges](58.md) - [NIP-65: Relay List Metadata](65.md) - [NIP-78: Application-specific data](78.md) +- [NIP-94: File Header](94.md) ## Event Kinds @@ -77,6 +78,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/fia | `42` | Channel Message | [28](28.md) | | `43` | Channel Hide Message | [28](28.md) | | `44` | Channel Mute User | [28](28.md) | +| `1063` | File Header | [94](94.md) | | `1984` | Reporting | [56](56.md) | | `9734` | Zap Request | [57](57.md) | | `9735` | Zap | [57](57.md) | From 4b9847802a9fb1a6d13b3967976bca78b5eacb0c Mon Sep 17 00:00:00 2001 From: jiftechnify Date: Fri, 21 Apr 2023 13:04:48 +0900 Subject: [PATCH 47/54] fix: re-add NIP-15 to the list --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d47bf76a..fb0ddb78 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/fia - [NIP-12: Generic Tag Queries](12.md) - [NIP-13: Proof of Work](13.md) - [NIP-14: Subject tag in text events.](14.md) +- [NIP-15: Nostr Marketplace (for resilient marketplaces)](15.md) - [NIP-16: Event Treatment](16.md) - [NIP-18: Reposts](18.md) - [NIP-19: bech32-encoded entities](19.md) From c5f43a8f9047184258f0e59f3e1fcd759acca4e2 Mon Sep 17 00:00:00 2001 From: michaelhall923 Date: Fri, 21 Apr 2023 09:04:20 -0400 Subject: [PATCH 48/54] Update 01.md Info on "e" and "p" tags is kind of hard to find so I added a link to it in the place that I intuitively looked for it. --- 01.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01.md b/01.md index ae138246..a07a0dff 100644 --- a/01.md +++ b/01.md @@ -107,5 +107,5 @@ A relay may choose to treat different message kinds differently, and it may or m ## Other Notes: - Clients should not open more than one websocket to each relay. One channel can support an unlimited number of subscriptions, so clients should do that. -- The `tags` array can store a tag identifier as the first element of each subarray, plus arbitrary information afterward (always as strings). This NIP defines `"p"` — meaning "pubkey", which points to a pubkey of someone that is referred to in the event —, and `"e"` — meaning "event", which points to the id of an event this event is quoting, replying to or referring to somehow. +- The `tags` array can store a tag identifier as the first element of each subarray, plus arbitrary information afterward (always as strings). This NIP defines `"p"` — meaning "pubkey", which points to a pubkey of someone that is referred to in the event —, and `"e"` — meaning "event", which points to the id of an event this event is quoting, replying to or referring to somehow. See [NIP-10](https://github.com/nostr-protocol/nips/blob/127d5518bfa9a4e4e7510490c0b8d95e342dfa4b/10.md) for a detailed description of "e" and "p" tags. - The `` item present on the `"e"` and `"p"` tags is an optional (could be set to `""`) URL of a relay the client could attempt to connect to fetch the tagged event or other events from a tagged profile. It MAY be ignored, but it exists to increase censorship resistance and make the spread of relay addresses more seamless across clients. From bf8f8e2708ad8bd45c60429c161c0706f8cfdf14 Mon Sep 17 00:00:00 2001 From: Vivek Ganesan Date: Mon, 24 Apr 2023 16:41:00 +0530 Subject: [PATCH 49/54] blurhash explanation --- 94.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/94.md b/94.md index 5c125651..87b0f3a7 100644 --- a/94.md +++ b/94.md @@ -15,7 +15,7 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr * `size` (optional) size of file in bytes * `magnet` (optional) URI to magnet file * `i` (optional) torrent infohash -* `blurhash`(optional) for cosmetic purposes +* `blurhash`(optional) the [blurhash](https://github.com/woltapp/blurhash) to show while the file is being loaded by the client ```json { From 5d0cbcbebfde5b3a32bf8c6fda12cfde40c1bb65 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 24 Apr 2023 14:57:37 -0300 Subject: [PATCH 50/54] reword NIP-94 to remove confusion. --- 94.md | 36 ++++++++++++++---------------------- README.md | 2 +- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/94.md b/94.md index 87b0f3a7..d29548e9 100644 --- a/94.md +++ b/94.md @@ -1,13 +1,17 @@ -NIP-94 - File Header +NIP-94 ====== -`draft` `optional` `author:frbitten` -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. -Also the goal is to create a base on the protocol for this bountsr "Filesharing App" (https://bountsr.org/p2p-filesharing/) to be implemented. +File Metadata +------------- + +`draft` `optional` `author:frbitten` `author:kieran` `author:lovvtide` `author:fiatjaf` + +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. + +## Event format -Nostr event ------------------- This NIP specifies the use of the `1063` event type, having in `content` a description of the file content, and a list of tags described below: + * `url` the url to download the file * `m` a string indicating the data type of the file. The MIME types format must be used (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) * `"aes-256-gcm"` (optional) key and nonce for AES-GCM encryption with tagSize always 128bits @@ -15,7 +19,7 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr * `size` (optional) size of file in bytes * `magnet` (optional) URI to magnet file * `i` (optional) torrent infohash -* `blurhash`(optional) the [blurhash](https://github.com/woltapp/blurhash) to show while the file is being loaded by the client +* `blurhash`(optional) the [blurhash](https://github.com/woltapp/blurhash) to show while the file is being loaded by the client ```json { @@ -38,20 +42,8 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr } ``` -Client Behavior ---------------- -The client can use this event as they see fit. Either showing events in the same feed as kind 1 events or creating a specific feed for file listings. +## Suggested use cases -It allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, telegram, etc. - -Example: - -To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image - - -Suggested Use Cases -------------------- -* A relay for indexing shared files. For example to promote torrents -* A Pinterest-like relay and app where people can share their portfolio and inspire others. +* A relay for indexing shared files. For example, to promote torrents. +* A pinterest-like client where people can share their portfolio and inspire others. * A simple way to distribute configurations and software updates. -* Specialized relays can provide collections of emojis, memes and animated gifs to be used in notes. diff --git a/README.md b/README.md index fb0ddb78..0a00d0ee 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/fia - [NIP-58: Badges](58.md) - [NIP-65: Relay List Metadata](65.md) - [NIP-78: Application-specific data](78.md) -- [NIP-94: File Header](94.md) +- [NIP-94: File Metadata](94.md) ## Event Kinds From 6fb9e54f7b4886272f7464aba2f0971543d8df40 Mon Sep 17 00:00:00 2001 From: arkin0x <99223753+arkin0x@users.noreply.github.com> Date: Mon, 24 Apr 2023 14:34:02 -0500 Subject: [PATCH 51/54] example was incorrect the example event id had 21 leading zeroes, not 20 I provided new C code that has been tested to work (I couldn't get the original example code to work) and I provided some JavaScript code to test event ids as well. I did not re-compute the event id for the example event; I simply changed the nonce to be 21. Since it is an example, it may not matter that the event id is not correct. --- 13.md | 72 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/13.md b/13.md index e3662a57..2c60929c 100644 --- a/13.md +++ b/13.md @@ -10,6 +10,8 @@ This NIP defines a way to generate and interpret Proof of Work for nostr notes. `difficulty` is defined to be the number of leading zero bits in the `NIP-01` id. For example, an id of `000000000e9d97a1ab09fc381030b346cdd7a142ad57e6df0b46dc9bef6c7e2d` has a difficulty of `36` with `36` leading 0 bits. +`002f...` is `0000 0000 0010 1111...` in binary, which has 10 leading zeroes. Do not forget to count leading zeroes for hex digits <= `7`. + Mining ------ @@ -36,7 +38,7 @@ Example mined note [ "nonce", "776797", - "20" + "21" ] ], "content": "It's just me mining my own business", @@ -47,33 +49,61 @@ Example mined note Validating ---------- -Here is some reference C code for calculating the difficulty (aka number of leading zero bits) in a nostr note id: +Here is some reference C code for calculating the difficulty (aka number of leading zero bits) in a nostr event id: ```c -int zero_bits(unsigned char b) -{ - int n = 0; +#include +#include +#include - if (b == 0) - return 8; +int countLeadingZeroes(const char *hex) { + int count = 0; - while (b >>= 1) - n++; + for (int i = 0; i < strlen(hex); i++) { + int nibble = (int)strtol((char[]){hex[i], '\0'}, NULL, 16); + if (nibble == 0) { + count += 4; + } else { + count += __builtin_clz(nibble) - 28; + break; + } + } - return 7-n; + return count; } -/* find the number of leading zero bits in a hash */ -int count_leading_zero_bits(unsigned char *hash) -{ - int bits, total, i; - for (i = 0, total = 0; i < 32; i++) { - bits = zero_bits(hash[i]); - total += bits; - if (bits != 8) - break; - } - return total; +int main(int argc, char *argv[]) { + if (argc != 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + return 1; + } + + const char *hex_string = argv[1]; + int result = countLeadingZeroes(hex_string); + printf("Leading zeroes in hex string %s: %d\n", hex_string, result); + + return 0; +} +``` + +Here is some JavaScript code for doing the same thing: + +```javascript +// hex should be a hexadecimal string (with no 0x prefix) +function countLeadingZeroes(hex) { + let count = 0; + + for (let i = 0; i < hex.length; i++) { + const nibble = parseInt(hex[i], 16); + if (nibble === 0) { + count += 4; + } else { + count += Math.clz32(nibble) - 28; + break; + } + } + + return count; } ``` From 61475db6f43068c535b275ef48e0faecf461ac76 Mon Sep 17 00:00:00 2001 From: arkin0x <99223753+arkin0x@users.noreply.github.com> Date: Mon, 24 Apr 2023 14:43:15 -0500 Subject: [PATCH 52/54] forgot to update the initial nonce in the explanation --- 13.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/13.md b/13.md index 2c60929c..360bde6c 100644 --- a/13.md +++ b/13.md @@ -18,7 +18,7 @@ Mining To generate PoW for a `NIP-01` note, a `nonce` tag is used: ```json -{"content": "It's just me mining my own business", "tags": [["nonce", "1", "20"]]} +{"content": "It's just me mining my own business", "tags": [["nonce", "1", "21"]]} ``` When mining, the second entry to the nonce tag is updated, and then the id is recalculated (see [NIP-01](./01.md)). If the id has the desired number of leading zero bits, the note has been mined. It is recommended to update the `created_at` as well during this process. From badabd513e659964d5fb357fab97dd8319acc98a Mon Sep 17 00:00:00 2001 From: Asai Toshiya Date: Tue, 25 Apr 2023 18:23:32 +0900 Subject: [PATCH 53/54] Reword description of kind 1063 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0a00d0ee..e7c89144 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/fia | `42` | Channel Message | [28](28.md) | | `43` | Channel Hide Message | [28](28.md) | | `44` | Channel Mute User | [28](28.md) | -| `1063` | File Header | [94](94.md) | +| `1063` | File Metadata | [94](94.md) | | `1984` | Reporting | [56](56.md) | | `9734` | Zap Request | [57](57.md) | | `9735` | Zap | [57](57.md) | From 346036208ccca6f31313f1e909ff17ea3563fb46 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Fri, 28 Apr 2023 10:21:18 -0500 Subject: [PATCH 54/54] Add dim tag to NIP 94 --- 94.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/94.md b/94.md index d29548e9..24dd346f 100644 --- a/94.md +++ b/94.md @@ -4,7 +4,7 @@ NIP-94 File Metadata ------------- -`draft` `optional` `author:frbitten` `author:kieran` `author:lovvtide` `author:fiatjaf` +`draft` `optional` `author:frbitten` `author:kieran` `author:lovvtide` `author:fiatjaf` `author:staab` 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. @@ -17,6 +17,7 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr * `"aes-256-gcm"` (optional) key and nonce for AES-GCM encryption with tagSize always 128bits * `x` containing the SHA-256 hexencoded string of the file. * `size` (optional) size of file in bytes +* `dim` (optional) size of file in pixels in the form `x` * `magnet` (optional) URI to magnet file * `i` (optional) torrent infohash * `blurhash`(optional) the [blurhash](https://github.com/woltapp/blurhash) to show while the file is being loaded by the client @@ -33,6 +34,7 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr ["m", ], ["x",], ["size", ], + ["dim", ], ["magnet", ], ["i",], ["blurhash", ]