mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-12-08 16:18:50 +00:00
Compare commits
19 Commits
mplorentz-
...
bigger-nip
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8782df594 | ||
|
|
4de6a69931 | ||
|
|
5b7d338200 | ||
|
|
2ade2e6229 | ||
|
|
85f3282e46 | ||
|
|
77fdeeb6f1 | ||
|
|
b96b72b488 | ||
|
|
507830c5c4 | ||
|
|
473f651b3e | ||
|
|
257e8700ea | ||
|
|
121258a611 | ||
|
|
5a371a5b92 | ||
|
|
4f09333ab5 | ||
|
|
8cdfe98e74 | ||
|
|
4ba28112e6 | ||
|
|
951aaa8ba1 | ||
|
|
c076437282 | ||
|
|
45f6d598a1 | ||
|
|
611b635186 |
129
11.md
129
11.md
@@ -21,6 +21,10 @@ When a relay receives an HTTP(s) request with an `Accept` header of `application
|
||||
"supported_nips": <a list of NIP numbers supported by the relay>,
|
||||
"software": <string identifying relay software URL>,
|
||||
"version": <string version identifier>
|
||||
"privacy_policy": <a link to a text file describing the relay's privacy policy>,
|
||||
"terms_of_service": <a link to a text file describing the relay's term of service>,
|
||||
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
@@ -74,21 +78,30 @@ The relay server implementation MAY be provided in the `software` attribute. If
|
||||
|
||||
The relay MAY choose to publish its software version as a string attribute. The string format is defined by the relay implementation. It is recommended this be a version number or commit identifier.
|
||||
|
||||
### Privacy Policy
|
||||
|
||||
The relay owner/admin MAY choose to link to a privacy policy document, which describes how the relay utilizes user data. Data collection, data usage, data retention, monetization of data, and third party data sharing SHOULD be included.
|
||||
|
||||
### Terms of Service
|
||||
|
||||
The relay owner/admin MAY choose to link to a terms of service document.
|
||||
|
||||
|
||||
|
||||
Extra Fields
|
||||
------------
|
||||
|
||||
### Server Limitations
|
||||
|
||||
These are limitations imposed by the relay on clients. Your client
|
||||
should expect that requests which exceed these *practical* limitations
|
||||
should expect that requests exceed these *practical* limitations
|
||||
are rejected or fail immediately.
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"limitation": {
|
||||
"max_message_length": 16384,
|
||||
"max_subscriptions": 20,
|
||||
"max_filters": 100,
|
||||
"max_subscriptions": 300,
|
||||
"max_limit": 5000,
|
||||
"max_subid_length": 100,
|
||||
"max_event_tags": 100,
|
||||
@@ -98,33 +111,30 @@ are rejected or fail immediately.
|
||||
"payment_required": true,
|
||||
"restricted_writes": true,
|
||||
"created_at_lower_limit": 31536000,
|
||||
"created_at_upper_limit": 3
|
||||
"created_at_upper_limit": 3,
|
||||
"default_limit": 500
|
||||
},
|
||||
// other fields...
|
||||
}
|
||||
```
|
||||
|
||||
- `max_message_length`: this is the maximum number of bytes for incoming JSON that the relay
|
||||
- `max_message_length`: the maximum number of bytes for incoming JSON that the relay
|
||||
will attempt to decode and act upon. When you send large subscriptions, you will be
|
||||
limited by this value. It also effectively limits the maximum size of any event. Value is
|
||||
calculated from `[` to `]` and is after UTF-8 serialization (so some unicode characters
|
||||
calculated from `[` to `]` after UTF-8 serialization (so some unicode characters
|
||||
will cost 2-3 bytes). It is equal to the maximum size of the WebSocket message frame.
|
||||
|
||||
- `max_subscriptions`: total number of subscriptions that may be
|
||||
active on a single websocket connection to this relay. It's possible
|
||||
that authenticated clients with a (paid) relationship to the relay
|
||||
active on a single websocket connection to this relay. Authenticated clients with a (paid) relationship to the relay
|
||||
may have higher limits.
|
||||
|
||||
- `max_filters`: maximum number of filter values in each subscription.
|
||||
Must be one or higher.
|
||||
|
||||
- `max_subid_length`: maximum length of subscription id as a string.
|
||||
|
||||
- `max_limit`: the relay server will clamp each filter's `limit` value to this number.
|
||||
This means the client won't be able to get more than this number
|
||||
of events from a single subscription filter. This clamping is typically done silently
|
||||
by the relay, but with this number, you can know that there are additional results
|
||||
if you narrowed your filter's time range or other parameters.
|
||||
if you narrow your filter's time range or other parameters.
|
||||
|
||||
- `max_event_tags`: in any event, this is the maximum number of elements in the `tags` list.
|
||||
|
||||
@@ -142,7 +152,7 @@ Even if set to False, authentication may be required for specific actions.
|
||||
|
||||
- `payment_required`: this relay requires payment before a new connection may perform any action.
|
||||
|
||||
- `restricted_writes`: this relay requires some kind of condition to be fulfilled in order to
|
||||
- `restricted_writes`: this relay requires some kind of condition to be fulfilled to
|
||||
accept events (not necessarily, but including `payment_required` and `min_pow_difficulty`).
|
||||
This should only be set to `true` when users are expected to know the relay policy before trying
|
||||
to write to it -- like belonging to a special pubkey-based whitelist or writing only events of
|
||||
@@ -152,6 +162,8 @@ a specific niche kind or content. Normal anti-spam heuristics, for example, do n
|
||||
|
||||
- `created_at_upper_limit`: 'created_at' upper limit
|
||||
|
||||
- `default_limit`: The maximum returned events if you send a filter with the limit set to 0.
|
||||
|
||||
### Event Retention
|
||||
|
||||
There may be a cost associated with storing data forever, so relays
|
||||
@@ -212,7 +224,7 @@ flexibility is up to the client software.
|
||||
```
|
||||
|
||||
- `relay_countries`: a list of two-level ISO country codes (ISO 3166-1 alpha-2) whose
|
||||
laws and policies may affect this relay. `EU` may be used for European Union countries.
|
||||
laws and policies may affect this relay. `EU` may be used for European Union countries. A `*` can be used for global relays.
|
||||
|
||||
Remember that a relay may be hosted in a country which is not the
|
||||
country of the legal entities who own the relay, so it's very
|
||||
@@ -237,7 +249,7 @@ To support this goal, relays MAY specify some of the following values.
|
||||
|
||||
- `language_tags` is an ordered list
|
||||
of [IETF language tags](https://en.wikipedia.org/wiki/IETF_language_tag) indicating
|
||||
the major languages spoken on the relay.
|
||||
the major languages spoken on the relay. A `*` can be used for global relays.
|
||||
|
||||
- `tags` is a list of limitations on the topics to be discussed.
|
||||
For example `sfw-only` indicates that only "Safe For Work" content
|
||||
@@ -276,49 +288,82 @@ Relays that require payments may want to expose their fee schedules.
|
||||
|
||||
### Examples
|
||||
|
||||
As of 2 May 2023 the following command provided these results:
|
||||
As of 25 March 2025 the following command provided these results:
|
||||
|
||||
```bash
|
||||
$ curl -H "Accept: application/nostr+json" https://eden.nostr.land | jq
|
||||
curl -H "Accept: application/nostr+json" https://jellyfish.land | jq
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"description": "nostr.land family of relays (us-or-01)",
|
||||
"name": "nostr.land",
|
||||
"pubkey": "52b4a076bcbbbdc3a1aefa3735816cf74993b1b8db202b01c883c58be7fad8bd",
|
||||
"software": "custom",
|
||||
"name": "JellyFish",
|
||||
"description": "Stay Immortal!",
|
||||
"banner": "https://image.nostr.build/7fdefea2dec1f1ec25b8ce69362566c13b2b7f13f1726c2e4584f05f64f62496.jpg",
|
||||
"pubkey": "bf2bee5281149c7c350f5d12ae32f514c7864ff10805182f4178538c2c421007",
|
||||
"contact": "hi@dezh.tech",
|
||||
"software": "https://github.com/dezh-tech/immortal",
|
||||
"supported_nips": [
|
||||
1,
|
||||
2,
|
||||
4,
|
||||
9,
|
||||
11,
|
||||
12,
|
||||
16,
|
||||
20,
|
||||
22,
|
||||
28,
|
||||
33,
|
||||
40
|
||||
13,
|
||||
17,
|
||||
40,
|
||||
42,
|
||||
59,
|
||||
62,
|
||||
70
|
||||
],
|
||||
"version": "1.0.1",
|
||||
"limitation": {
|
||||
"payment_required": true,
|
||||
"max_message_length": 65535,
|
||||
"max_event_tags": 2000,
|
||||
"max_subscriptions": 20,
|
||||
"auth_required": false
|
||||
},
|
||||
"payments_url": "https://eden.nostr.land",
|
||||
"version": "immortal - 0.0.9",
|
||||
"relay_countries": [
|
||||
"*"
|
||||
],
|
||||
"language_tags": [
|
||||
"*"
|
||||
],
|
||||
"tags": [],
|
||||
"posting_policy": "https://jellyfish.land/tos.txt",
|
||||
"payments_url": "https://jellyfish.land/relay",
|
||||
"icon": "https://image.nostr.build/2547e9ec4b23589e09bc7071e0806c3d4293f76284c58ff331a64bce978aaee8.jpg",
|
||||
"retention": [],
|
||||
"fees": {
|
||||
"subscription": [
|
||||
{
|
||||
"amount": 2500000,
|
||||
"unit": "msats",
|
||||
"period": 2592000
|
||||
"amount": 3000,
|
||||
"period": 2628003,
|
||||
"unit": "sats"
|
||||
},
|
||||
{
|
||||
"amount": 8000,
|
||||
"period": 7884009,
|
||||
"unit": "sats"
|
||||
},
|
||||
{
|
||||
"amount": 15000,
|
||||
"period": 15768018,
|
||||
"unit": "sats"
|
||||
},
|
||||
{
|
||||
"amount": 28000,
|
||||
"period": 31536036,
|
||||
"unit": "sats"
|
||||
}
|
||||
]
|
||||
},
|
||||
"limitation": {
|
||||
"auth_required": false,
|
||||
"max_message_length": 70000,
|
||||
"max_subid_length": 256,
|
||||
"max_subscriptions": 350,
|
||||
"min_pow_difficulty": 0,
|
||||
"payment_required": true,
|
||||
"restricted_writes": true,
|
||||
"max_event_tags": 2000,
|
||||
"max_content_length": 70000,
|
||||
"created_at_lower_limit": 0,
|
||||
"created_at_upper_limit": 2147483647,
|
||||
"default_limit": 500,
|
||||
"max_limit": 5000
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
46
22.md
46
22.md
@@ -18,9 +18,9 @@ and `p` for the author of the parent item.
|
||||
|
||||
```jsonc
|
||||
{
|
||||
kind: 1111,
|
||||
content: '<comment>',
|
||||
tags: [
|
||||
"kind": 1111,
|
||||
"content": "<comment>",
|
||||
"tags": [
|
||||
// root scope: event addresses, event ids, or I-tags.
|
||||
["<A, E, I>", "<address, id or I-value>", "<relay or web page hint>", "<root event's pubkey, if an E tag>"],
|
||||
// the root item kind
|
||||
@@ -64,9 +64,9 @@ A comment on a blog post looks like this:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
kind: 1111,
|
||||
content: 'Great blog post!',
|
||||
tags: [
|
||||
"kind": 1111,
|
||||
"content": "Great blog post!",
|
||||
"tags": [
|
||||
// top-level comments scope to event addresses or ids
|
||||
["A", "30023:3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289:f9347ca7", "wss://example.relay"],
|
||||
// the root kind
|
||||
@@ -91,9 +91,9 @@ A comment on a [NIP-94](94.md) file looks like this:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
kind: 1111,
|
||||
content: 'Great file!',
|
||||
tags: [
|
||||
"kind": 1111,
|
||||
"content": "Great file!",
|
||||
"tags": [
|
||||
// top-level comments have the same scope and reply to addresses or ids
|
||||
["E", "768ac8720cdeb59227cf95e98b66560ef03d8bc9a90d721779e76e68fb42f5e6", "wss://example.relay", "3721e07b079525289877c366ccab47112bdff3d1b44758ca333feb2dbbbbe5bb"],
|
||||
// the root kind
|
||||
@@ -115,9 +115,9 @@ A reply to a comment looks like this:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
kind: 1111,
|
||||
content: 'This is a reply to "Great file!"',
|
||||
tags: [
|
||||
"kind": 1111,
|
||||
"content": "This is a reply to \"Great file!\"",
|
||||
"tags": [
|
||||
// nip-94 file event id
|
||||
["E", "768ac8720cdeb59227cf95e98b66560ef03d8bc9a90d721779e76e68fb42f5e6", "wss://example.relay", "fd913cd6fa9edb8405750cd02a8bbe16e158b8676c0e69fdc27436cc4a54cc9a"],
|
||||
// the root kind
|
||||
@@ -138,9 +138,9 @@ A comment on a website's url looks like this:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
kind: 1111,
|
||||
content: 'Nice article!',
|
||||
tags: [
|
||||
"kind": 1111,
|
||||
"content": "Nice article!",
|
||||
"tags": [
|
||||
// referencing the root url
|
||||
["I", "https://abc.com/articles/1"],
|
||||
// the root "kind": for an url, the kind is its domain
|
||||
@@ -159,11 +159,11 @@ A podcast comment example:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
id: "80c48d992a38f9c445b943a9c9f1010b396676013443765750431a9004bdac05",
|
||||
pubkey: "252f10c83610ebca1a059c0bae8255eba2f95be4d1d7bcfa89d7248a82d9f111",
|
||||
kind: 1111,
|
||||
content: "This was a great episode!",
|
||||
tags: [
|
||||
"id": "80c48d992a38f9c445b943a9c9f1010b396676013443765750431a9004bdac05",
|
||||
"pubkey": "252f10c83610ebca1a059c0bae8255eba2f95be4d1d7bcfa89d7248a82d9f111",
|
||||
"kind": 1111,
|
||||
"content": "This was a great episode!",
|
||||
"tags": [
|
||||
// podcast episode reference
|
||||
["I", "podcast:item:guid:d98d189b-dc7b-45b1-8720-d4b98690f31f", "https://fountain.fm/episode/z1y9TMQRuqXl2awyrQxg"],
|
||||
// podcast episode type
|
||||
@@ -181,9 +181,9 @@ A reply to a podcast comment:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
kind: 1111,
|
||||
content: "I'm replying to the above comment.",
|
||||
tags: [
|
||||
"kind": 1111,
|
||||
"content": "I'm replying to the above comment.",
|
||||
"tags": [
|
||||
// podcast episode reference
|
||||
["I", "podcast:item:guid:d98d189b-dc7b-45b1-8720-d4b98690f31f", "https://fountain.fm/episode/z1y9TMQRuqXl2awyrQxg"],
|
||||
// podcast episode type
|
||||
|
||||
2
26.md
2
26.md
@@ -1,3 +1,5 @@
|
||||
> __Warning__ `unrecommended`: adds unecessary burden for little gain
|
||||
|
||||
NIP-26
|
||||
=======
|
||||
|
||||
|
||||
31
44.md
31
44.md
@@ -84,10 +84,12 @@ NIP-44 version 2 has the following design characteristics:
|
||||
- Slice 76-byte HKDF output into: `chacha_key` (bytes 0..32), `chacha_nonce` (bytes 32..44), `hmac_key` (bytes 44..76)
|
||||
4. Add padding
|
||||
- Content must be encoded from UTF-8 into byte array
|
||||
- Validate plaintext length. Minimum is 1 byte, maximum is 65535 bytes
|
||||
- Validate plaintext length. Minimum is 1 byte, maximum is 4294967296 bytes
|
||||
- Padding format is: `[plaintext_length: u16][plaintext][zero_bytes]`
|
||||
- Padding algorithm is related to powers-of-two, with min padded msg size of 32 bytes
|
||||
- Plaintext length is encoded in big-endian as first 2 bytes of the padded blob
|
||||
- Plaintext length is encoded in big-endian:
|
||||
- if smaller than 65536, as a u16 in the first 2 bytes of the padded blob;
|
||||
- if greater than 65536, the first 6 bytes of the padded blob, the first 2 being zero and the other 4 being the actual encoded length as u32
|
||||
5. Encrypt padded content
|
||||
- Use ChaCha20, with key and nonce from step 3
|
||||
6. Calculate MAC (message authentication code)
|
||||
@@ -124,7 +126,9 @@ validation rules, refer to BIP-340.
|
||||
6. Decrypt ciphertext
|
||||
- Use ChaCha20 with key and nonce from step 3
|
||||
7. Remove padding
|
||||
- Read the first two BE bytes of plaintext that correspond to plaintext length
|
||||
- Read the first 2 bytes,
|
||||
- if they're zero, read the next 4 bytes as the u32 big-endian plaintext length;
|
||||
- otherwise interpret those 2 bytes as the u16 plaintext length
|
||||
- Verify that the length of sliced plaintext matches the value of the two BE bytes
|
||||
- Verify that calculated padding from step 3 of the [encryption](#Encryption) process matches the actual padding
|
||||
|
||||
@@ -148,8 +152,6 @@ validation rules, refer to BIP-340.
|
||||
- `x[i:j]`, where `x` is a byte array and `i, j <= 0` returns a `(j - i)`-byte array with a copy of the
|
||||
`i`-th byte (inclusive) to the `j`-th byte (exclusive) of `x`.
|
||||
- Constants `c`:
|
||||
- `min_plaintext_size` is 1. 1 byte msg is padded to 32 bytes.
|
||||
- `max_plaintext_size` is 65535 (64kB - 1). It is padded to 65536 bytes.
|
||||
- Functions
|
||||
- `base64_encode(string)` and `base64_decode(bytes)` are Base64 ([RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648), with padding)
|
||||
- `concat` refers to byte array concatenation
|
||||
@@ -182,16 +184,27 @@ def calc_padded_len(unpadded_len):
|
||||
def pad(plaintext):
|
||||
unpadded = utf8_encode(plaintext)
|
||||
unpadded_len = len(plaintext)
|
||||
if (unpadded_len < c.min_plaintext_size or
|
||||
unpadded_len > c.max_plaintext_size): raise Exception('invalid plaintext length')
|
||||
prefix = write_u16_be(unpadded_len)
|
||||
if (unpadded_len < 1 or
|
||||
unpadded_len > 4294967295): raise Exception('invalid plaintext length')
|
||||
if unpadded_len > 65536:
|
||||
prefix = concat(
|
||||
[0, 0],
|
||||
write_u32_be(unpadded_len),
|
||||
)
|
||||
else:
|
||||
prefix = write_u16_be(unpadded_len)
|
||||
suffix = zeros(calc_padded_len(unpadded_len) - unpadded_len)
|
||||
return concat(prefix, unpadded, suffix)
|
||||
|
||||
# Converts padded bytearray to unpadded plaintext
|
||||
def unpad(padded):
|
||||
unpadded_len = read_uint16_be(padded[0:2])
|
||||
unpadded = padded[2:2+unpadded_len]
|
||||
if unpadded_len == 0:
|
||||
unpadded_len = read_uint32_be(padded[2:6])
|
||||
unpadded = padded[6:6+unpadded_len]
|
||||
else:
|
||||
unpadded = padded[2:2+unpadded_len]
|
||||
|
||||
if (unpadded_len == 0 or
|
||||
len(unpadded) != unpadded_len or
|
||||
len(padded) != 2 + calc_padded_len(unpadded_len)): raise Exception('invalid padding')
|
||||
|
||||
2
60.md
2
60.md
@@ -68,7 +68,7 @@ There can be multiple `kind:7375` events for the same mint, and multiple proofs
|
||||
|
||||
* `.content` is a [NIP-44](44.md) encrypted payload:
|
||||
* `mint`: The mint the proofs belong to.
|
||||
* `proofs`: unecoded proofs
|
||||
* `proofs`: unencoded proofs
|
||||
* `del`: token-ids that were destroyed by the creation of this token. This assists with state transitions.
|
||||
|
||||
When one or more proofs of a token are spent, the token event should be [NIP-09](09.md)-deleted and, if some proofs are unspent from the same token event, a new token event should be created rolling over the unspent proofs and adding any change outputs to the new token event (the change output should include a `del` field).
|
||||
|
||||
8
61.md
8
61.md
@@ -46,10 +46,10 @@ Clients MUST prefix the public key they P2PK-lock with `"02"` (for nostr<>cashu
|
||||
|
||||
```jsonc
|
||||
{
|
||||
kind: 9321,
|
||||
content: "Thanks for this great idea.",
|
||||
pubkey: "<sender-pubkey>",
|
||||
tags: [
|
||||
"kind": 9321,
|
||||
"content": "Thanks for this great idea.",
|
||||
"pubkey": "<sender-pubkey>",
|
||||
"tags": [
|
||||
[ "proof", "{\"amount\":1,\"C\":\"02277c66191736eb72fce9d975d08e3191f8f96afb73ab1eec37e4465683066d3f\",\"id\":\"000a93d6f8a1d2c4\",\"secret\":\"[\\\"P2PK\\\",{\\\"nonce\\\":\\\"b00bdd0467b0090a25bdf2d2f0d45ac4e355c482c1418350f273a04fedaaee83\\\",\\\"data\\\":\\\"02eaee8939e3565e48cc62967e2fde9d8e2a4b3ec0081f29eceff5c64ef10ac1ed\\\"}]\"}" ],
|
||||
[ "u", "https://stablenut.umint.cash" ],
|
||||
[ "e", "<nutzapped-event-id>", "<relay-hint>" ],
|
||||
|
||||
51
65.md
51
65.md
@@ -6,11 +6,9 @@ Relay List Metadata
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
Defines a replaceable event using `kind:10002` to advertise preferred relays for discovering a user's content and receiving fresh content from others.
|
||||
Defines a replaceable event using `kind:10002` to advertise relays where the user generally **writes** to and relays where the user generally **reads** mentions.
|
||||
|
||||
The event MUST include a list of `r` tags with relay URIs and a `read` or `write` marker. Relays marked as `read` / `write` are called READ / WRITE relays, respectively. If the marker is omitted, the relay is used for both purposes.
|
||||
|
||||
The `.content` is not used.
|
||||
The event MUST include a list of `r` tags with relay URLs as value and an optional `read` or `write` marker. If the marker is omitted, the relay is both **read** and **write**.
|
||||
|
||||
```jsonc
|
||||
{
|
||||
@@ -26,45 +24,20 @@ The `.content` is not used.
|
||||
}
|
||||
```
|
||||
|
||||
This NIP doesn't fully replace relay lists that are designed to configure a client's usage of relays (such as `kind:3` style relay lists). Clients MAY use other relay lists in situations where a `kind:10002` relay list cannot be found.
|
||||
When downloading events **from** a user, clients SHOULD use the **write** relays of that user.
|
||||
|
||||
## When to Use Read and Write Relays
|
||||
When downloading events **about** a user, where the user was tagged (mentioned), clients SHOULD use the user's **read** relays.
|
||||
|
||||
When seeking events **from** a user, Clients SHOULD use the WRITE relays of the user's `kind:10002`.
|
||||
When publishing an event, clients SHOULD:
|
||||
|
||||
When seeking events **about** a user, where the user was tagged, Clients SHOULD use the READ relays of the user's `kind:10002`.
|
||||
- Send the event to the **write** relays of the author
|
||||
- Send the event to all **read** relays of each tagged user
|
||||
- Send the author's `kind:10002` event to all relays the event was published to
|
||||
|
||||
When broadcasting an event, Clients SHOULD:
|
||||
### Size
|
||||
|
||||
- Broadcast the event to the WRITE relays of the author
|
||||
- Broadcast the event to all READ relays of each tagged user
|
||||
Clients SHOULD guide users to keep `kind:10002` lists small (2-4 relays of each category).
|
||||
|
||||
## Motivation
|
||||
### Discoverability
|
||||
|
||||
The old model of using a fixed relay list per user centralizes in large relay operators:
|
||||
|
||||
- Most users submit their posts to the same highly popular relays, aiming to achieve greater visibility among a broader audience
|
||||
- Many users are pulling events from a large number of relays in order to get more data at the expense of duplication
|
||||
- Events are being copied between relays, oftentimes to many different relays
|
||||
|
||||
This NIP allows Clients to connect directly with the most up-to-date relay set from each individual user, eliminating the need of broadcasting events to popular relays.
|
||||
|
||||
## Final Considerations
|
||||
|
||||
1. Clients SHOULD guide users to keep `kind:10002` lists small (2-4 relays).
|
||||
|
||||
2. Clients SHOULD spread an author's `kind:10002` event to as many relays as viable.
|
||||
|
||||
3. `kind:10002` events should primarily be used to advertise the user's preferred relays to others. A user's own client may use other heuristics for selecting relays for fetching data.
|
||||
|
||||
4. DMs SHOULD only be broadcasted to the author's WRITE relays and to the receiver's READ relays to keep maximum privacy.
|
||||
|
||||
5. If a relay signals support for this NIP in their [NIP-11](11.md) document that means they're willing to accept kind 10002 events from a broad range of users, not only their paying customers or whitelisted group.
|
||||
|
||||
6. Clients SHOULD deduplicate connections by normalizing relay URIs according to [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986#section-6).
|
||||
|
||||
7. When publishing to a relay, clients SHOULD ensure the user's `kind 10002` is also available on that relay. Relays SHOULD accept and serve `kind 10002` notes for any pubkey whose notes they store. Relays MAY scrape the network for missing `kind 10002` events. The goal here is that for any note served from a relay the user can also request the author's relay selections as a way of bootstrapping further context discovery.
|
||||
|
||||
## Related articles
|
||||
- [Outbox model](https://mikedilger.com/gossip-model/)
|
||||
- [What is the Outbox Model?](https://habla.news/u/hodlbod@coracle.social/8YjqXm4SKY-TauwjOfLXS)
|
||||
Clients SHOULD spread an author's `kind:10002` event to as many relays as viable, paying attention to relays that, at any moment, serve naturally as well-known public indexers for these relay lists (where most other clients and users are connecting to in order to publish and fetch those).
|
||||
|
||||
6
66.md
6
66.md
@@ -1,4 +1,8 @@
|
||||
# NIP-66: Relay Discovery and Liveness Monitoring
|
||||
NIP-66
|
||||
======
|
||||
|
||||
Relay Discovery and Liveness Monitoring
|
||||
-------------------
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
|
||||
6
69.md
6
69.md
@@ -1,6 +1,8 @@
|
||||
# NIP-69
|
||||
NIP-69
|
||||
======
|
||||
|
||||
## Peer-to-peer Order events
|
||||
Peer-to-peer Order events
|
||||
-------------------------
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
|
||||
5
7D.md
5
7D.md
@@ -6,15 +6,14 @@ Threads
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
A thread is a `kind 11` event. Threads SHOULD include a `subject` with a summary
|
||||
of the thread's topic.
|
||||
A thread is a `kind 11` event. Threads SHOULD include a `title`.
|
||||
|
||||
```json
|
||||
{
|
||||
"kind": 11,
|
||||
"content": "Good morning",
|
||||
"tags": [
|
||||
["subject", "GM"]
|
||||
["title", "GM"]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
9
84.md
9
84.md
@@ -40,3 +40,12 @@ last value of the tag.
|
||||
### Context
|
||||
Clients MAY include a `context` tag, useful when the highlight is a subset of a paragraph and displaying the
|
||||
surrounding content might be beneficial to give context to the highlight.
|
||||
|
||||
## Quote Highlights
|
||||
A `comment` tag may be added to create a quote highlight. This MUST be rendered like a quote repost with the highlight as the quoted note.
|
||||
|
||||
This is to prevent the creation and multiple notes (highlight + kind 1) for a single highlight action, which looks bad in micro-blogging clients where these notes may appear in succession.
|
||||
|
||||
p-tag mentions MUST have a `mention` attribute to distinguish it from authors and editors.
|
||||
|
||||
r-tag urls from the comment MUST have a `mention` attribute to distinguish from the highlighted source url. The source url MUST have the `source` attribute.
|
||||
|
||||
61
B0.md
Normal file
61
B0.md
Normal file
@@ -0,0 +1,61 @@
|
||||
NIP-B0
|
||||
======
|
||||
|
||||
Web Bookmarking
|
||||
---------------
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
This NIP defines `kind:39701` (an _addressable event_) for a URI as a web bookmark which uses the HTTP (Hypertext transfer protocol) scheme.
|
||||
These web bookmark events are _addressable_ and deletable per [NIP-09](09.md).
|
||||
|
||||
### Editability
|
||||
|
||||
Web bookmarks are meant to be editable, so they should include a `d` tag with an identifier for the bookmark. Clients should take care to only publish and read these events from relays that implement that. If they don't do that they should also take care to hide old versions of the same bookmark they may receive.
|
||||
|
||||
### Format
|
||||
|
||||
The format uses an _addressable event_ of `kind:39701`.
|
||||
|
||||
The `.content` of these events should be a detailed description of the web bookmark. It is required but can be an empty string.
|
||||
|
||||
The `d` tag is required.
|
||||
|
||||
In this way web bookmarks events can be queried by the `d` tag by clients, which is just their URL without the scheme, which is always and everywhere assumed to be `https://` or `http://`.
|
||||
|
||||
The querystring and the hash must be removed entirely, unless their requirement is explicitly stated either by the user or by some hardcoded list of URLs that rely on querystrings for basic routing provided by the client.
|
||||
|
||||
### Metadata
|
||||
|
||||
For the date of the last update the `.created_at` field should be used. For "tags"/"hashtags" (i.e. topics about which the event might be of relevance) the `t` tag should be used.
|
||||
|
||||
Other metadata fields can be added as tags to the event as necessary.
|
||||
|
||||
* `"published_at"`, for the timestamp in unix seconds (stringified) of the first time the bookmark was published
|
||||
* `"title"`, title about bookmark and can be used as a attribute for the HTML link element
|
||||
|
||||
## Example event
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"kind": 39701,
|
||||
"id": "d7a92714f81d0f712e715556aee69ea6da6bfb287e6baf794a095d301d603ec7",
|
||||
"pubkey": "2729620da105979b22acfdfe9585274a78c282869b493abfa4120d3af2061298",
|
||||
"created_at": 1738869705,
|
||||
"tags": [
|
||||
// Required tags
|
||||
["d", "alice.blog/post"],
|
||||
// Optional tags
|
||||
["published_at", "1738863000"],
|
||||
["title", "Blog insights by Alice"],
|
||||
["t", "post"],
|
||||
["t", "insight"]
|
||||
],
|
||||
"content": "A marvelous insight by Alice about the nature of blogs and posts.",
|
||||
"sig": "36d34e6448fe0223e9999361c39c492a208bc423d2fcdfc2a3404e04df7c22dc65bbbd62dbe8a4373c62e4d29aac285b5aa4bb9b4b8053bd6207a8b45fbd0c98"
|
||||
}
|
||||
```
|
||||
|
||||
### Replies & Comments
|
||||
|
||||
Replies to `kind 39701` MUST use `kind 1111` events as comments with [NIP-22](22.md).
|
||||
41
B7.md
Normal file
41
B7.md
Normal file
@@ -0,0 +1,41 @@
|
||||
NIP-B7
|
||||
======
|
||||
|
||||
Blossom media
|
||||
-------------
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
This NIP specifies how Nostr clients can use [Blossom][] for handling media.
|
||||
|
||||
Blossom is a set of standards (called BUDs) for dealing with servers that store files addressable by their SHA-256 sums. Nostr clients may make use of all the BUDs for allowing users to upload files, manage their own files and so on, but most importantly Nostr clients SHOULD make use of [BUD-03][] to fetch `kind:10063` lists of servers for each user:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "e4bee088334cb5d38cff1616e964369c37b6081be997962ab289d6c671975d71",
|
||||
"pubkey": "781208004e09102d7da3b7345e64fd193cd1bc3fce8fdae6008d77f9cabcd036",
|
||||
"content": "",
|
||||
"kind": 10063,
|
||||
"created_at": 1708774162,
|
||||
"tags": [
|
||||
["server", "https://blossom.self.hosted"],
|
||||
["server", "https://cdn.blossom.cloud"]
|
||||
],
|
||||
"sig": "cc5efa74f59e80622c77cacf4dd62076bcb7581b45e9acff471e7963a1f4d8b3406adab5ee1ac9673487480e57d20e523428e60ffcc7e7a904ac882cfccfc653"
|
||||
}
|
||||
```
|
||||
|
||||
Whenever a Nostr client finds a URL in an event published by a given user and that URL ends a 64-character hex string (with or without an ending file extension) and that URL is not available anymore, that means that string is likely a representation of a sha256 and that the user may have a `kind:10063` list of Blossom servers published.
|
||||
|
||||
Given that, the client SHOULD look into the `kind:10063` list for other Blossom servers and lookup for the same 64-character hex string in them, by just using the hex string as a path (optionally with the file extension at the end), producing a URL like `https://blossom.self.hosted/<hex-string>.png`.
|
||||
|
||||
When downloading such files Nostr clients SHOULD verify that the sha256-hash of its contents matches the 64-character hex string.
|
||||
|
||||
More information can be found at [BUD-03][].
|
||||
|
||||
### More complex interactions
|
||||
|
||||
Clients may use other facilities exposed by Blossom servers (for example, for checking if a file exists in a Blossom server, instead of actually downloading it) which are better documented in the [BUDs][Blossom].
|
||||
|
||||
[Blossom]: https://github.com/hzrd149/blossom
|
||||
[BUD-03]: https://github.com/hzrd149/blossom/blob/master/buds/03.md
|
||||
6
C0.md
6
C0.md
@@ -1,4 +1,8 @@
|
||||
# NIP-C0: Code Snippets
|
||||
NIP-C0
|
||||
======
|
||||
|
||||
Code Snippets
|
||||
-------------
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
|
||||
11
README.md
11
README.md
@@ -44,7 +44,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
|
||||
- [NIP-23: Long-form Content](23.md)
|
||||
- [NIP-24: Extra metadata fields and tags](24.md)
|
||||
- [NIP-25: Reactions](25.md)
|
||||
- [NIP-26: Delegated Event Signing](26.md)
|
||||
- [NIP-26: Delegated Event Signing](26.md) --- **unrecommended**: adds unecessary burden for little gain
|
||||
- [NIP-27: Text Note References](27.md)
|
||||
- [NIP-28: Public Chat](28.md)
|
||||
- [NIP-29: Relay-based Groups](29.md)
|
||||
@@ -89,6 +89,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
|
||||
- [NIP-73: External Content IDs](73.md)
|
||||
- [NIP-75: Zap Goals](75.md)
|
||||
- [NIP-78: Application-specific data](78.md)
|
||||
- [NIP-7D: Threads](7D.md)
|
||||
- [NIP-84: Highlights](84.md)
|
||||
- [NIP-86: Relay Management API](86.md)
|
||||
- [NIP-88: Polls](88.md)
|
||||
@@ -99,7 +100,8 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
|
||||
- [NIP-96: HTTP File Storage Integration](96.md)
|
||||
- [NIP-98: HTTP Auth](98.md)
|
||||
- [NIP-99: Classified Listings](99.md)
|
||||
- [NIP-7D: Threads](7D.md)
|
||||
- [NIP-B0: Web Bookmarks](B0.md)
|
||||
- [NIP-B7: Blossom](B7.md)
|
||||
- [NIP-C0: Code Snippets](C0.md)
|
||||
- [NIP-C7: Chats](C7.md)
|
||||
|
||||
@@ -247,6 +249,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
|
||||
| `34550` | Community Definition | [72](72.md) |
|
||||
| `38383` | Peer-to-peer Order events | [69](69.md) |
|
||||
| `39000-9` | Group metadata events | [29](29.md) |
|
||||
| `39701` | Web bookmarks | [B0](B0.md) |
|
||||
|
||||
[NUD: Custom Feeds]: https://wikifreedia.xyz/cip-01/
|
||||
[nostrocket]: https://github.com/nostrocket/NIPS/blob/main/Problems.md
|
||||
@@ -341,7 +344,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
|
||||
| `preimage` | hash of `bolt11` invoice | -- | [57](57.md) |
|
||||
| `price` | price | currency, frequency | [99](99.md) |
|
||||
| `proxy` | external ID | protocol | [48](48.md) |
|
||||
| `published_at` | unix timestamp (string) | -- | [23](23.md) |
|
||||
| `published_at` | unix timestamp (string) | -- | [23](23.md), [B0](B0.md) |
|
||||
| `relay` | relay url | -- | [42](42.md), [17](17.md) |
|
||||
| `relays` | relay list | -- | [57](57.md) |
|
||||
| `repo` | Reference to the origin repository | -- | [C0](C0.md) |
|
||||
@@ -350,7 +353,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
|
||||
| `subject` | subject | -- | [14](14.md), [17](17.md), [34](34.md) |
|
||||
| `summary` | summary | -- | [23](23.md), [52](52.md) |
|
||||
| `thumb` | badge thumbnail | dimensions in pixels | [58](58.md) |
|
||||
| `title` | article title | -- | [23](23.md) |
|
||||
| `title` | title | -- | [23](23.md), [B0](B0.md) |
|
||||
| `tracker` | torrent tracker URL | -- | [35](35.md) |
|
||||
| `web` | webpage URL | -- | [34](34.md) |
|
||||
| `zap` | pubkey (hex), relay URL | weight | [57](57.md) |
|
||||
|
||||
Reference in New Issue
Block a user