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 bandwidth while helping clients show event metadata estimates faster.
|
|
|
|
|
|
|
|
## Fields
|
|
|
|
|
|
|
|
All fields are optional and live inside an extra nip17 key.
|
|
|
|
|
|
|
|
Some fields only make sense for a subset of kinds.
|
|
|
|
|
|
|
|
New fields may be added to this NIP later.
|
|
|
|
|
|
|
|
### Returned Event Example
|
|
|
|
|
|
|
|
```js
|
|
|
|
{
|
|
|
|
"kind": ..., // 1, 23, 0, ...
|
|
|
|
..., // regular keys
|
|
|
|
"nip17": {
|
|
|
|
"+": 8, // kind 7 "+" reaction count
|
|
|
|
"-": 0, // kind 7 "-" reaction count
|
2023-07-04 09:46:35 -04:00
|
|
|
"country": "US", // ISO 3166-1 alpha-2 code extracted from NIP-32 label (geohash/country/... l tag) or detected by IP
|
|
|
|
"emoji": {
|
|
|
|
"🤙️": 10, // kind 7 specific emoji reaction count
|
|
|
|
}
|
2023-06-13 18:12:31 -04:00
|
|
|
"followers": 500, // sent with kind 0
|
|
|
|
"language": "en", // ISO 639-1 code of detected event.content language
|
|
|
|
"relay": "wss://relay.url", // event found originally on this relay
|
|
|
|
"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
|
|
|
|
"zaps": 7, // kind 9735 count
|
|
|
|
"zap_amount": 10000, // kind 9735 millisats amount sum
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
2023-07-04 09:46:35 -04:00
|
|
|
|
|
|
|
## Filter Extensions
|
|
|
|
|
|
|
|
Clients can use extra filter attributes when requesting events.
|
|
|
|
|
|
|
|
Relays should use NIP-11 `supported_nip_extensions` when supporting an extension.
|
|
|
|
|
|
|
|
For example: { "supported_nips": [17], "supported_nip_extensions": ["nip17language", "nip17country"] }
|
|
|
|
|
|
|
|
### NIP-17language
|
|
|
|
|
|
|
|
Filter by language.
|
|
|
|
|
|
|
|
Example request: `["REQ", <sub_id>, { kinds: [1], ..., nip17: { language: ["en", "pt"] } }]`
|
|
|
|
|
|
|
|
### NIP-17country
|
|
|
|
|
|
|
|
Filter by country.
|
|
|
|
|
|
|
|
Example request: `["REQ", <sub_id>, { kinds: [1], ..., nip17: { country: ["US", "GB"] } }]`
|