nips/17.md

74 lines
2.0 KiB
Markdown
Raw Normal View History

2023-06-13 18:12:31 -04:00
NIP-17
======
Event Metadata
---------------
`draft` `optional` `author:arthurfranca`
Relays may attach event metadata to requested events.
## Motivation
To save relay and client bandwidth.
2023-06-13 18:12:31 -04:00
## Fields
All extra fields live inside an extra `meta` key.
2023-06-13 18:12:31 -04:00
### Returned Event Example
```js
{
2023-07-18 18:04:43 -04:00
"kind": ..., // 1, 30023, 0, ...
..., // regular event fields
"meta": {
// v REQUIRED v
"isRoot": true, // true when the event holds no `e` nor `a` tags
"language": "en", // ISO 639-1 code of detected using event.content language
// ISO 3166-1 alpha-2 code. Detection strategies:
// - detected by IP
// - extracted from "g" (geohash) tag
// - selecting one of the countries that use the detected "language" as the main one
"country": "US",
// ^ REQUIRED ^
// v OPTIONAL v
2023-06-13 18:12:31 -04:00
"replies": 10, // direct descendant kind 1 reply count
"reposts": 20, // NIP-18 repost count
"views": 900, // request count from different IPs, device ids or pubkeys
"followers": 500, // sent with kind 0 events; the value is 0 otherwise
2023-06-13 18:12:31 -04:00
"zaps": 7, // kind 9735 count
"zap_amount": 10000, // kind 9735 millisats amount sum
"reactions": {
"+": 12, // kind 7 "+" reaction count (should be the sum of "+" and all emoji reactions)
"-": 3, // kind 7 "-" reaction count
"🤙️": 10 // kind 7 specific emoji reaction count
},
"relays": ["wss://relay.url"] // event found originally on these relays
// ^ OPTIONAL ^
2023-06-13 18:12:31 -04:00
}
}
```
2023-07-04 09:46:35 -04:00
## Filters
2023-07-18 18:04:43 -04:00
Relays MUST support extra `REQ` message's filter attributes inside the `meta` field. Multiple
fields inside the `meta` key are considered "AND" conditions.
2023-07-04 09:46:35 -04:00
#### Is Root
2023-07-04 09:46:35 -04:00
`["REQ", <sub_id>, { "kinds": [1], ..., "meta": { "isRoot": false } }]`
2023-07-04 09:46:35 -04:00
### Language
2023-07-04 09:46:35 -04:00
The array is considered "OR" condition.
2023-07-18 18:04:43 -04:00
`["REQ", <sub_id>, { "kinds": [1], ..., "meta": { "language": ["en", "pt"] } }]`
2023-07-18 18:04:43 -04:00
#### Country
2023-07-18 18:04:43 -04:00
The array is considered "OR" condition.
2023-07-04 09:46:35 -04:00
`["REQ", <sub_id>, { "kinds": [1], ..., "meta": { "country": ["US", "GB"] } }]`