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:
authorSemisol <45574030+Semisol@users.noreply.github.com>2023-11-19 01:45:41 +0100
committerGitHub <noreply@github.com>2023-11-19 01:45:41 +0100
commitda19c078ab892b578a5c35968443205c9e8ac27f (patch)
tree17a9f4f3105acdae234d3bc67e42571aed261fa2 /11.md
parent4d709d1804de45bab3739ce814d4b0c0b211c273 (diff)
parent5dcfe85306434f21ecb1e7a47edd92b2e3e64f9a (diff)
Merge branch 'master' into clarify-json-serialization
Diffstat (limited to '11.md')
-rw-r--r--11.md176
1 files changed, 93 insertions, 83 deletions
diff --git a/11.md b/11.md
index ec46b36..ab05f31 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-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.
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,21 @@ 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 "created_at_lower_limit": 31536000,
84 } 83 "created_at_upper_limit": 3
85... 84 },
85 ...
86} 86}
87``` 87```
88 88
@@ -102,9 +102,6 @@ Must be one or higher.
102 102
103- `max_subid_length`: maximum length of subscription id as a string. 103- `max_subid_length`: maximum length of subscription id as a string.
104 104
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. 105- `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 106This 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 107of events from a single subscription filter. This clamping is typically done silently
@@ -118,7 +115,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 115serializing into JSON it may be larger (in bytes), and is still
119subject to the `max_message_length`, if defined. 116subject to the `max_message_length`, if defined.
120 117
121- `min_pow_difficulty`: new events will require at least this difficulty of PoW, 118- `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. 119based on [NIP-13](13.md), or they will be rejected by this server.
123 120
124- `auth_required`: this relay requires [NIP-42](42.md) authentication 121- `auth_required`: this relay requires [NIP-42](42.md) authentication
@@ -127,9 +124,13 @@ Even if set to False, authentication may be required for specific actions.
127 124
128- `payment_required`: this relay requires payment before a new connection may perform any action. 125- `payment_required`: this relay requires payment before a new connection may perform any action.
129 126
130### Event Retention ### 127- `created_at_lower_limit`: 'created_at' lower limit as defined in [NIP-22](22.md)
128
129- `created_at_upper_limit`: 'created_at' upper limit as defined in [NIP-22](22.md)
130
131### Event Retention
131 132
132There may be a cost associated with storing data forever, so relays 133There may be a cost associated with storing data forever, so relays
133may wish to state retention times. The values stated here are defaults 134may wish to state retention times. The values stated here are defaults
134for unauthenticated users and visitors. Paid users would likely have 135for unauthenticated users and visitors. Paid users would likely have
135other policies. 136other policies.
@@ -140,18 +141,16 @@ all, and preferably an error will be provided when those are received.
140 141
141```json 142```json
142{ 143{
143...
144 "retention": [ 144 "retention": [
145 { "kinds": [0, 1, [5, 7], [40, 49]], "time": 3600 }, 145 {"kinds": [0, 1, [5, 7], [40, 49]], "time": 3600},
146 { "kinds": [[40000, 49999]], "time": 100 }, 146 {"kinds": [[40000, 49999]], "time": 100},
147 { "kinds": [[30000, 39999]], "count": 1000 }, 147 {"kinds": [[30000, 39999]], "count": 1000},
148 { "time": 3600, "count": 10000 } 148 {"time": 3600, "count": 10000}
149 ] 149 ]
150...
151} 150}
152``` 151```
153 152
154`retention` is a list of specifications: each will apply to either all kinds, or 153`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 154a 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` 155start and end values. Events of indicated kind (or all) are then limited to a `count`
157and/or time period. 156and/or time period.
@@ -161,11 +160,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 160While that is unfortunate, it does allow clients to discover servers that will
162support their protocol quickly via a single HTTP fetch. 161support their protocol quickly via a single HTTP fetch.
163 162
164There is no need to specify retention times for _ephemeral events_ as defined 163There 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 164
167 165### Content Limitations
168### Content Limitations ###
169 166
170Some relays may be governed by the arbitrary laws of a nation state. This 167Some 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 168may limit what content can be stored in cleartext on those relays. All
@@ -184,9 +181,8 @@ flexibility is up to the client software.
184 181
185```json 182```json
186{ 183{
187...
188 "relay_countries": [ "CA", "US" ], 184 "relay_countries": [ "CA", "US" ],
189... 185 ...
190} 186}
191``` 187```
192 188
@@ -198,7 +194,7 @@ country of the legal entities who own the relay, so it's very
198likely a number of countries are involved. 194likely a number of countries are involved.
199 195
200 196
201### Community Preferences ### 197### Community Preferences
202 198
203For public text notes at least, a relay may try to foster a 199For public text notes at least, a relay may try to foster a
204local community. This would encourage users to follow the global 200local community. This would encourage users to follow the global
@@ -207,11 +203,10 @@ To support this goal, relays MAY specify some of the following values.
207 203
208```json 204```json
209{ 205{
210... 206 "language_tags": ["en", "en-419"],
211 "language_tags": [ "en", "en-419" ], 207 "tags": ["sfw-only", "bitcoin-only", "anime"],
212 "tags": [ "sfw-only", "bitcoin-only", "anime" ],
213 "posting_policy": "https://example.com/posting-policy.html", 208 "posting_policy": "https://example.com/posting-policy.html",
214... 209 ...
215} 210}
216``` 211```
217 212
@@ -238,60 +233,75 @@ detail and legal terms. Use the `tags` field to signify limitations
238on content, or topics to be discussed, which could be machine 233on content, or topics to be discussed, which could be machine
239processed by appropriate client software. 234processed by appropriate client software.
240 235
241### Pay-To-Relay ### 236### Pay-to-Relay
242 237
243Relays that require payments may want to expose their fee schedules. 238Relays that require payments may want to expose their fee schedules.
244 239
245```json 240```json
246{ 241{
247...
248 "payments_url": "https://my-relay/payments", 242 "payments_url": "https://my-relay/payments",
249 "fees": { 243 "fees": {
250 "admission": [{ "amount": 1000000, "unit": "msats" }], 244 "admission": [{ "amount": 1000000, "unit": "msats" }],
251 "subscription": [{ "amount": 5000000, "unit": "msats", "period": 2592000 }], 245 "subscription": [{ "amount": 5000000, "unit": "msats", "period": 2592000 }],
252 "publication": [{ "kinds": [4], "amount": 100, "unit": "msats" }], 246 "publication": [{ "kinds": [4], "amount": 100, "unit": "msats" }],
253 }, 247 },
254... 248 ...
255} 249}
256``` 250```
257 251
258### Icon ### 252### Icon
259 253
260A URL pointing to an image to be used as an icon for the relay. Recommended to be squared in shape. 254A URL pointing to an image to be used as an icon for the relay. Recommended to be squared in shape.
261 255
262```json 256```json
263{ 257{
264...
265 "icon": "https://nostr.build/i/53866b44135a27d624e99c6165cabd76ac8f72797209700acb189fce75021f47.jpg", 258 "icon": "https://nostr.build/i/53866b44135a27d624e99c6165cabd76ac8f72797209700acb189fce75021f47.jpg",
266... 259 ...
267} 260}
268``` 261```
269 262
270### Examples ### 263### Examples
271As of 2 May 2023 the following `curl` command provided these results. 264
272 265As of 2 May 2023 the following command provided these results:
273 >curl -H "Accept: application/nostr+json" https://eden.nostr.land 266
274 267```
275 {"name":"eden.nostr.land", 268~> curl -H "Accept: application/nostr+json" https://eden.nostr.land | jq
276 "description":"Eden Nostr Land - Toronto 1-01", 269
277 "pubkey":"00000000827ffaa94bfea288c3dfce4422c794fbb96625b6b31e9049f729d700", 270{
278 "contact":"me@ricardocabral.io", 271 "description": "nostr.land family of relays (us-or-01)",
279 "supported_nips":[1,2,4,9,11,12,15,16,20,22,26,28,33,40], 272 "name": "nostr.land",
280 "supported_nip_extensions":["11a"], 273 "pubkey": "52b4a076bcbbbdc3a1aefa3735816cf74993b1b8db202b01c883c58be7fad8bd",
281 "software":"git+https://github.com/Cameri/nostream.git", 274 "software": "custom",
282 "version":"1.22.6", 275 "supported_nips": [
283 "limitation":{"max_message_length":1048576, 276 1,
284 "max_subscriptions":10, 277 2,
285 "max_filters":2500, 278 4,
286 "max_limit":5000, 279 9,
287 "max_subid_length":256, 280 11,
288 "min_prefix":4, 281 12,
289 "max_event_tags":2500, 282 16,
290 "max_content_length":65536, 283 20,
291 "min_pow_difficulty":0, 284 22,
292 "auth_required":false, 285 28,
293 "payment_required":true}, 286 33,
294 "payments_url":"https://eden.nostr.land/invoices", 287 40
295 "fees":{"admission":[{"amount":5000000,"unit":"msats"}], 288 ],
296 "publication":[]}}, 289 "version": "1.0.1",
297 "icon": "https://nostr.build/i/53866b44135a27d624e99c6165cabd76ac8f72797209700acb189fce75021f47.jpg" 290 "limitation": {
291 "payment_required": true,
292 "max_message_length": 65535,
293 "max_event_tags": 2000,
294 "max_subscriptions": 20,
295 "auth_required": false
296 },
297 "payments_url": "https://eden.nostr.land",
298 "fees": {
299 "subscription": [
300 {
301 "amount": 2500000,
302 "unit": "msats",
303 "period": 2592000
304 }
305 ]
306 },
307}