upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/11.md
diff options
context:
space:
mode:
Diffstat (limited to '11.md')
-rw-r--r--11.md190
1 files changed, 110 insertions, 80 deletions
diff --git a/11.md b/11.md
index b0d6003..a50038a 100644
--- a/11.md
+++ b/11.md
@@ -4,7 +4,7 @@ NIP-11
4Relay Information Document 4Relay Information Document
5--------------------------- 5---------------------------
6 6
7`draft` `optional` `author:scsibug` `author:doc-hex` `author:cameri` 7`draft` `optional`
8 8
9Relays may provide server metadata to clients to inform them of capabilities, administrative contacts, and various server attributes. This is made available as a JSON document over HTTP, on the same URI as the relay's websocket. 9Relays may provide server metadata to clients to inform them of capabilities, administrative contacts, and various server attributes. This is made available as a JSON document over HTTP, on the same URI as the relay's websocket.
10 10
@@ -25,42 +25,42 @@ When a relay receives an HTTP(s) request with an `Accept` header of `application
25Any field may be omitted, and clients MUST ignore any additional fields they do not understand. Relays MUST accept CORS requests by sending `Access-Control-Allow-Origin`, `Access-Control-Allow-Headers`, and `Access-Control-Allow-Methods` headers. 25Any field may be omitted, and clients MUST ignore any additional fields they do not understand. Relays MUST accept CORS requests by sending `Access-Control-Allow-Origin`, `Access-Control-Allow-Headers`, and `Access-Control-Allow-Methods` headers.
26 26
27Field Descriptions 27Field Descriptions
28----------------- 28------------------
29 29
30### Name ### 30### Name
31 31
32A relay may select a `name` for use in client software. This is a string, and SHOULD be less than 30 characters to avoid client truncation. 32A relay may select a `name` for use in client software. This is a string, and SHOULD be less than 30 characters to avoid client truncation.
33 33
34### Description ### 34### Description
35 35
36Detailed plain-text information about the relay may be contained in the `description` string. It is recommended that this contain no markup, formatting or line breaks for word wrapping, and simply use double newline characters to separate paragraphs. There are no limitations on length. 36Detailed plain-text information about the relay may be contained in the `description` string. It is recommended that this contain no markup, formatting or line breaks for word wrapping, and simply use double newline characters to separate paragraphs. There are no limitations on length.
37 37
38### Pubkey ### 38### Pubkey
39 39
40An administrative contact may be listed with a `pubkey`, in the same format as Nostr events (32-byte hex for a `secp256k1` public key). If a contact is listed, this provides clients with a recommended address to send encrypted direct messages (See `NIP-04`) to a system administrator. Expected uses of this address are to report abuse or illegal content, file bug reports, or request other technical assistance. 40An administrative contact may be listed with a `pubkey`, in the same format as Nostr events (32-byte hex for a `secp256k1` public key). If a contact is listed, this provides clients with a recommended address to send encrypted direct messages (See [NIP-17](17.md)) to a system administrator. Expected uses of this address are to report abuse or illegal content, file bug reports, or request other technical assistance.
41 41
42Relay operators have no obligation to respond to direct messages. 42Relay operators have no obligation to respond to direct messages.
43 43
44### Contact ### 44### Contact
45 45
46An alternative contact may be listed under the `contact` field as well, with the same purpose as `pubkey`. Use of a Nostr public key and direct message SHOULD be preferred over this. Contents of this field SHOULD be a URI, using schemes such as `mailto` or `https` to provide users with a means of contact. 46An alternative contact may be listed under the `contact` field as well, with the same purpose as `pubkey`. Use of a Nostr public key and direct message SHOULD be preferred over this. Contents of this field SHOULD be a URI, using schemes such as `mailto` or `https` to provide users with a means of contact.
47 47
48### Supported NIPs ### 48### Supported NIPs
49 49
50As the Nostr protocol evolves, some functionality may only be available by relays that implement a specific `NIP`. This field is an array of the integer identifiers of `NIP`s that are implemented in the relay. Examples would include `1`, for `"NIP-01"` and `9`, for `"NIP-09"`. Client-side `NIPs` SHOULD NOT be advertised, and can be ignored by clients. 50As the Nostr protocol evolves, some functionality may only be available by relays that implement a specific `NIP`. This field is an array of the integer identifiers of `NIP`s that are implemented in the relay. Examples would include `1`, for `"NIP-01"` and `9`, for `"NIP-09"`. Client-side `NIPs` SHOULD NOT be advertised, and can be ignored by clients.
51 51
52### Software ### 52### Software
53 53
54The relay server implementation MAY be provided in the `software` attribute. If present, this MUST be a URL to the project's homepage. 54The relay server implementation MAY be provided in the `software` attribute. If present, this MUST be a URL to the project's homepage.
55 55
56### Version ### 56### Version
57 57
58The 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. 58The 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.
59 59
60Extra Fields 60Extra Fields
61----------------- 61------------
62 62
63### Server Limitations ### 63### Server Limitations
64 64
65These are limitations imposed by the relay on clients. Your client 65These are limitations imposed by the relay on clients. Your client
66should expect that requests which exceed these *practical* limitations 66should expect that requests which exceed these *practical* limitations
@@ -68,21 +68,22 @@ are rejected or fail immediately.
68 68
69```json 69```json
70{ 70{
71...
72 "limitation": { 71 "limitation": {
73 "max_message_length": 16384, 72 "max_message_length": 16384,
74 "max_subscriptions": 20, 73 "max_subscriptions": 20,
75 "max_filters": 100, 74 "max_filters": 100,
76 "max_limit": 5000, 75 "max_limit": 5000,
77 "max_subid_length": 100, 76 "max_subid_length": 100,
78 "min_prefix": 4, 77 "max_event_tags": 100,
79 "max_event_tags": 100, 78 "max_content_length": 8196,
80 "max_content_length": 8196, 79 "min_pow_difficulty": 30,
81 "min_pow_difficulty": 30, 80 "auth_required": true,
82 "auth_required": true, 81 "payment_required": true,
83 "payment_required": true, 82 "restricted_writes": true,
84 } 83 "created_at_lower_limit": 31536000,
85... 84 "created_at_upper_limit": 3
85 },
86 ...
86} 87}
87``` 88```
88 89
@@ -102,9 +103,6 @@ Must be one or higher.
102 103
103- `max_subid_length`: maximum length of subscription id as a string. 104- `max_subid_length`: maximum length of subscription id as a string.
104 105
105- `min_prefix`: for `authors` and `ids` filters which are to match against
106a hex prefix, you must provide at least this many hex digits in the prefix.
107
108- `max_limit`: the relay server will clamp each filter's `limit` value to this number. 106- `max_limit`: the relay server will clamp each filter's `limit` value to this number.
109This means the client won't be able to get more than this number 107This means the client won't be able to get more than this number
110of events from a single subscription filter. This clamping is typically done silently 108of events from a single subscription filter. This clamping is typically done silently
@@ -118,7 +116,7 @@ field of any event. This is a count of unicode characters. After
118serializing into JSON it may be larger (in bytes), and is still 116serializing into JSON it may be larger (in bytes), and is still
119subject to the `max_message_length`, if defined. 117subject to the `max_message_length`, if defined.
120 118
121- `min_pow_difficulty`: new events will require at least this difficulty of PoW, 119- `min_pow_difficulty`: new events will require at least this difficulty of PoW,
122based on [NIP-13](13.md), or they will be rejected by this server. 120based on [NIP-13](13.md), or they will be rejected by this server.
123 121
124- `auth_required`: this relay requires [NIP-42](42.md) authentication 122- `auth_required`: this relay requires [NIP-42](42.md) authentication
@@ -127,9 +125,19 @@ Even if set to False, authentication may be required for specific actions.
127 125
128- `payment_required`: this relay requires payment before a new connection may perform any action. 126- `payment_required`: this relay requires payment before a new connection may perform any action.
129 127
130### Event Retention ### 128- `restricted_writes`: this relay requires some kind of condition to be fulfilled in order to
129accept events (not necessarily, but including `payment_required` and `min_pow_difficulty`).
130This should only be set to `true` when users are expected to know the relay policy before trying
131to write to it -- like belonging to a special pubkey-based whitelist or writing only events of
132a specific niche kind or content. Normal anti-spam heuristics, for example, do not qualify.
133
134- `created_at_lower_limit`: 'created_at' lower limit
131 135
132There may be a cost associated with storing data forever, so relays 136- `created_at_upper_limit`: 'created_at' upper limit
137
138### Event Retention
139
140There may be a cost associated with storing data forever, so relays
133may wish to state retention times. The values stated here are defaults 141may wish to state retention times. The values stated here are defaults
134for unauthenticated users and visitors. Paid users would likely have 142for unauthenticated users and visitors. Paid users would likely have
135other policies. 143other policies.
@@ -140,18 +148,16 @@ all, and preferably an error will be provided when those are received.
140 148
141```json 149```json
142{ 150{
143...
144 "retention": [ 151 "retention": [
145 { "kinds": [0, 1, [5, 7], [40, 49]], "time": 3600 }, 152 {"kinds": [0, 1, [5, 7], [40, 49]], "time": 3600},
146 { "kinds": [[40000, 49999]], "time": 100 }, 153 {"kinds": [[40000, 49999]], "time": 100},
147 { "kinds": [[30000, 39999]], "count": 1000 }, 154 {"kinds": [[30000, 39999]], "count": 1000},
148 { "time": 3600, "count": 10000 } 155 {"time": 3600, "count": 10000}
149 ] 156 ]
150...
151} 157}
152``` 158```
153 159
154`retention` is a list of specifications: each will apply to either all kinds, or 160`retention` is a list of specifications: each will apply to either all kinds, or
155a subset of kinds. Ranges may be specified for the kind field as a tuple of inclusive 161a subset of kinds. Ranges may be specified for the kind field as a tuple of inclusive
156start and end values. Events of indicated kind (or all) are then limited to a `count` 162start and end values. Events of indicated kind (or all) are then limited to a `count`
157and/or time period. 163and/or time period.
@@ -161,11 +167,9 @@ a specific `kind` number, by giving a retention time of zero for those `kind` va
161While that is unfortunate, it does allow clients to discover servers that will 167While that is unfortunate, it does allow clients to discover servers that will
162support their protocol quickly via a single HTTP fetch. 168support their protocol quickly via a single HTTP fetch.
163 169
164There is no need to specify retention times for _ephemeral events_ as defined 170There is no need to specify retention times for _ephemeral events_ since they are not retained.
165in [NIP-16](16.md) since they are not retained.
166
167 171
168### Content Limitations ### 172### Content Limitations
169 173
170Some relays may be governed by the arbitrary laws of a nation state. This 174Some relays may be governed by the arbitrary laws of a nation state. This
171may limit what content can be stored in cleartext on those relays. All 175may limit what content can be stored in cleartext on those relays. All
@@ -184,9 +188,8 @@ flexibility is up to the client software.
184 188
185```json 189```json
186{ 190{
187...
188 "relay_countries": [ "CA", "US" ], 191 "relay_countries": [ "CA", "US" ],
189... 192 ...
190} 193}
191``` 194```
192 195
@@ -198,7 +201,7 @@ country of the legal entities who own the relay, so it's very
198likely a number of countries are involved. 201likely a number of countries are involved.
199 202
200 203
201### Community Preferences ### 204### Community Preferences
202 205
203For public text notes at least, a relay may try to foster a 206For public text notes at least, a relay may try to foster a
204local community. This would encourage users to follow the global 207local community. This would encourage users to follow the global
@@ -207,11 +210,10 @@ To support this goal, relays MAY specify some of the following values.
207 210
208```json 211```json
209{ 212{
210... 213 "language_tags": ["en", "en-419"],
211 "language_tags": [ "en", "en-419" ], 214 "tags": ["sfw-only", "bitcoin-only", "anime"],
212 "tags": [ "sfw-only", "bitcoin-only", "anime" ],
213 "posting_policy": "https://example.com/posting-policy.html", 215 "posting_policy": "https://example.com/posting-policy.html",
214... 216 ...
215} 217}
216``` 218```
217 219
@@ -238,47 +240,75 @@ detail and legal terms. Use the `tags` field to signify limitations
238on content, or topics to be discussed, which could be machine 240on content, or topics to be discussed, which could be machine
239processed by appropriate client software. 241processed by appropriate client software.
240 242
241### Pay-To-Relay ### 243### Pay-to-Relay
242 244
243Relays that require payments may want to expose their fee schedules. 245Relays that require payments may want to expose their fee schedules.
244 246
245```json 247```json
246{ 248{
247...
248 "payments_url": "https://my-relay/payments", 249 "payments_url": "https://my-relay/payments",
249 "fees": { 250 "fees": {
250 "admission": [{ "amount": 1000000, "unit": "msats" }], 251 "admission": [{ "amount": 1000000, "unit": "msats" }],
251 "subscription": [{ "amount": 5000000, "unit": "msats", "period": 2592000 }], 252 "subscription": [{ "amount": 5000000, "unit": "msats", "period": 2592000 }],
252 "publication": [{ "kinds": [4], "amount": 100, "unit": "msats" }], 253 "publication": [{ "kinds": [4], "amount": 100, "unit": "msats" }],
253 }, 254 },
254... 255 ...
255} 256}
256``` 257```
257 258
258### Examples ### 259### Icon
259As of 2 May 2023 the following `curl` command provided these results. 260
260 261A URL pointing to an image to be used as an icon for the relay. Recommended to be squared in shape.
261 >curl -H "Accept: application/nostr+json" https://eden.nostr.land 262
262 263```json
263 {"name":"eden.nostr.land", 264{
264 "description":"Eden Nostr Land - Toronto 1-01", 265 "icon": "https://nostr.build/i/53866b44135a27d624e99c6165cabd76ac8f72797209700acb189fce75021f47.jpg",
265 "pubkey":"00000000827ffaa94bfea288c3dfce4422c794fbb96625b6b31e9049f729d700", 266 ...
266 "contact":"me@ricardocabral.io", 267}
267 "supported_nips":[1,2,4,9,11,12,15,16,20,22,26,28,33,40], 268```
268 "supported_nip_extensions":["11a"], 269
269 "software":"git+https://github.com/Cameri/nostream.git", 270### Examples
270 "version":"1.22.6", 271
271 "limitation":{"max_message_length":1048576, 272As of 2 May 2023 the following command provided these results:
272 "max_subscriptions":10, 273
273 "max_filters":2500, 274```
274 "max_limit":5000, 275~> curl -H "Accept: application/nostr+json" https://eden.nostr.land | jq
275 "max_subid_length":256, 276
276 "min_prefix":4, 277{
277 "max_event_tags":2500, 278 "description": "nostr.land family of relays (us-or-01)",
278 "max_content_length":65536, 279 "name": "nostr.land",
279 "min_pow_difficulty":0, 280 "pubkey": "52b4a076bcbbbdc3a1aefa3735816cf74993b1b8db202b01c883c58be7fad8bd",
280 "auth_required":false, 281 "software": "custom",
281 "payment_required":true}, 282 "supported_nips": [
282 "payments_url":"https://eden.nostr.land/invoices", 283 1,
283 "fees":{"admission":[{"amount":5000000,"unit":"msats"}], 284 2,
284 "publication":[]}} 285 4,
286 9,
287 11,
288 12,
289 16,
290 20,
291 22,
292 28,
293 33,
294 40
295 ],
296 "version": "1.0.1",
297 "limitation": {
298 "payment_required": true,
299 "max_message_length": 65535,
300 "max_event_tags": 2000,
301 "max_subscriptions": 20,
302 "auth_required": false
303 },
304 "payments_url": "https://eden.nostr.land",
305 "fees": {
306 "subscription": [
307 {
308 "amount": 2500000,
309 "unit": "msats",
310 "period": 2592000
311 }
312 ]
313 },
314}