upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornostr-wine <124309146+nostr-wine@users.noreply.github.com>2023-03-18 18:44:31 -0400
committerfiatjaf_ <fiatjaf@gmail.com>2023-03-19 16:22:45 -0300
commitf7b57e3735fc95482d9485d21c4439b9d21851ac (patch)
treee39410b6693e5caa94653c072a3a3e13551efebc
parentdbbf7902d9e11f3515961ff026daf961cd0d10bd (diff)
Add proposed extensions to NIP-11
Take the proposed changes from https://github.com/nostr-protocol/nips/pull/163 and put them in NIP-11 under "Extra Fields"
-rw-r--r--11.md197
1 files changed, 197 insertions, 0 deletions
diff --git a/11.md b/11.md
index 8cdb85e..a8386ba 100644
--- a/11.md
+++ b/11.md
@@ -56,3 +56,200 @@ The relay server implementation MAY be provided in the `software` attribute. If
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
60Extra Fields
61-----------------
62
63### Server Limitations ###
64
65These are limitations imposed by the relay on clients. Your client
66should expect that requests which exceed these *practical* limitations
67are rejected or fail immediately.
68
69```json
70{
71...
72 limitation: {
73 max_message_length: 16384,
74 max_subscriptions: 20,
75 max_filters: 100,
76 max_limit: 5000,
77 max_subid_length: 100,
78 min_prefix: 4,
79 max_event_tags: 100,
80 max_content_length: 8196,
81 min_pow_difficulty: 30,
82 auth_required: true,
83 payment_required: true,
84 }
85...
86}
87```
88
89- `max_message_length`: this is the maximum number of bytes for incoming JSON that the relay
90will attempt to decode and act upon. When you send large subscriptions, you will be
91limited by this value. It also effectively limits the maximum size of any event. Value is
92calculated from `[` to `]` and is after UTF-8 serialization (so some unicode characters
93will cost 2-3 bytes). It is equal to the maximum size of the WebSocket message frame.
94
95- `max_subscriptions`: total number of subscriptions that may be
96active on a single websocket connection to this relay. It's possible
97that authenticated clients with a (paid) relationship to the relay
98may have higher limits.
99
100- `max_filters`: maximum number of filter values in each subscription.
101Must be one or higher.
102
103- `max_subid_length`: maximum length of subscription id as a string.
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.
109This 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
111by the relay, but with this number, you can know that there are additional results
112if you narrowed your filter's time range or other parameters.
113
114- `max_event_tags`: in any event, this is the maximum number of elements in the `tags` list.
115
116- `max_content_length`: maximum number of characters in the `content`
117field of any event. This is a count of unicode characters. After
118serializing into JSON it may be larger (in bytes), and is still
119subject to the `max_message_length`, if defined.
120
121- `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.
123
124- `auth_required`: this relay requires [NIP-42](42.md) authentication
125to happen before a new connection may perform any other action.
126Even if set to False, authentication may be required for specific actions.
127
128- `payment_required`: this relay requires payment before a new connection may perform any action.
129
130### Event Retention ###
131
132There may be a cost associated with storing data forever, so relays
133may wish to state retention times. The values stated here are defaults
134for unauthenticated users and visitors. Paid users would likely have
135other policies.
136
137Retention times are given in seconds, with `null` indicating infinity.
138If zero is provided, this means the event will not be stored at
139all, and preferably an error will be provided when those are received.
140
141```json
142{
143...
144 retention: [
145 { kinds: [0, 1, [5, 7], [40, 49]], time: 3600 },
146 { kinds: [[40000, 49999], time: 100 },
147 { kinds: [[30000, 39999], count: 1000 },
148 { time: 3600, count: 10000 }
149 ]
150...
151}
152```
153
154`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
156start and end values. Events of indicated kind (or all) are then limited to a `count`
157and or time period.
158
159It is possible to effectively blacklist Nostr-based protocols that rely on
160a specific `kind` number, by giving a retention time of zero for those `kind` values.
161While that is unfortunate, it does allow clients to discover servers that will
162support their protocol quickly via a single HTTP fetch.
163
164There is no need to specify retention times for _ephemeral events_ as defined
165in [NIP-16](16.md) since they are not retained.
166
167
168### Content Limitations ###
169
170Some 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
172clients are encouraged to use encryption to work around this limitation.
173
174It is not possible to describe the limitations of each country's laws
175and policies which themselves are typically vague and constantly shifting.
176
177Therefore, this field allows the relay operator to indicate which
178country's' laws might end up being enforced on them, and then
179indirectly on their users's content.
180
181Users should be able to avoid relays in countries they don't like,
182and/or select relays in more favourable zones. Exposing this
183flexibility is up to the client software.
184
185```json
186{
187...
188 relay_countries: [ 'CA', 'US' ],
189...
190}
191```
192
193- `relay_countries`: a list of two-level ISO country codes (ISO 3166-1 alpha-2) whose
194 laws and policies may affect this relay. `EU` may be used for European Union countries.
195
196Remember that a relay may be hosted in a country which is not the
197country of the legal entities who own the relay, so it's very
198likely a number of countries are involved.
199
200
201### Community Preferences ###
202
203For public text notes at least, a relay may try to foster a
204local community. This would encourage users to follow the global
205feed on that relay, in addition to their usual individual follows.
206To support this goal, relays MAY specify some of the following values.
207
208```json
209{
210...
211 language_tags: [ 'en', 'en-419' ],
212 tags: [ 'sfw-only', 'bitcoin-only', 'anime' ],
213 posting_policy: 'https://example.com/posting-policy.html',
214...
215}
216```
217
218- `language_tags` is an ordered list
219 of [IETF language tags](https://en.wikipedia.org/wiki/IETF_language_tag) indicating
220 the major languages spoken on the relay.
221
222- `tags` is a list of limitations on the topics to be discussed.
223 For example `sfw-only` indicates hat only "Safe For Work" content
224 is encouraged on this relay. This relies on assumptions of what the
225 "work" "community" feels "safe" talking about. In time, a common
226 set of tags may emerge that allow users to find relays that suit
227 their needs, and client software will be able to parse these tags easily.
228 The `bitcoin-only` tag indicates that any *altcoin*, *"crypto"* or *blockchain*
229 comments will be ridiculed without mercy.
230
231- `posting_policy` is a link to a human-readable page which specifies the
232 community policies for the relay. In cases where `sfw-only` is True, it's
233 important to link to a page which gets into the specifics of your posting policy.
234
235The `description` field should be used to describe your community
236goals and values, in brief. The `posting_policy` is for additional
237detail and legal terms. Use the `tags` field to signify limitations
238on content, or topics to be discussed, which could be machine
239processed by appropriate client software.
240
241### Pay-To-Relay ###
242
243Relays that require payments may want to expose their fee schedules.
244
245```json
246{
247...
248 payments_url: "https://my-relay/payments",
249 fees: {
250 "admission": [{ amount: 1000000, unit: 'msats' }],
251 "subscription": [{ amount: 5000000, unit: 'msats', period: 2592000 }],
252 "publication": [{ kinds: [4], amount: 100, unit: 'msats' }],
253 },
254...
255}