{"id":"5c6d0e8f20ea53bc1d24954152e291e704fd8d4fbc5d119bb05fee13270a9801","pubkey":"2b39b4ffe62933df970e19366c22c1e092f953f83fcfed754e0f04d5a3b459f9","created_at":1779999367,"kind":30817,"tags":[["d","nip-66"],["title","NIP-66: Relay Discovery and Liveness Monitoring"],["summary","Kind 30166, relay discovery events published by monitors, describing what a relay claims to be and whether it answers."],["s","draft"],["t","nostr"],["t","nip"],["k","10166","Relay Monitor Announcement"],["k","30166","Relay Discovery"],["alt","A specification: NIP-66: Relay Discovery and Liveness Monitoring"],["client","openspecs-import"],["published_at","1741021390"],["proxy","https://github.com/nostr-protocol/nips/blob/656cecc7c0a815b6a2b218d3b5d6f078b3f4dbab/66.md","web"],["x","88148d6e3050f56c7601afb8779e3304ee59c4d85697c38938d69768e64bad4d"]],"content":"NIP-66\n======\n\nRelay Liveness Monitoring\n-------------------------\n\n`draft` `optional` `relay`\n\nThis NIP defines events for relay discovery and the announcement of relay monitors.\n\n## Relay Discovery Events\n\n`30166` relay discovery events document relay characteristics inferred either from a relay's [NIP 11](nostr:naddr1qvzqqqrcvypzq2eeknl7v2fnm7tsuxfkds3vrcyjl9fls070a465urcy6k3mgk0eqqrxu6ts95cnzjt5dcs) document, or via probing.\n\nInformation corresponding to field in a relay's NIP 11 document MAY contradict actual values if monitors find that a different policy is implemented than is advertised.\n\n`content` MAY include the stringified JSON of the relay's NIP-11 informational document.\n\nThe only required tag is the `d` tag, which MUST be set to the relay's [normalized](https://datatracker.ietf.org/doc/html/rfc3986#section-6) URL. For relays not accessible via URL, a hex-encoded pubkey MAY be used instead.\n\nOther tags include:\n\n- `rtt-open` - The relay's open round-trip time in milliseconds.\n- `rtt-read` - The relay's read round-trip time in milliseconds.\n- `rtt-write` - The relay's write round-trip time in milliseconds.\n- `n` - The relay's network type. SHOULD be one of `clearnet`, `tor`, `i2p`, `loki`\n- `T` - The relay type. Enumerated [relay type](https://github.com/nostr-protocol/nips/issues/1282) formatted as `PascalCase`, e.g. `PrivateInbox`\n- `N` - NIPs supported by the relay\n- `R` - Keys corresponding to requirements per [NIP 11](nostr:naddr1qvzqqqrcvypzq2eeknl7v2fnm7tsuxfkds3vrcyjl9fls070a465urcy6k3mgk0eqqrxu6ts95cnzjt5dcs)'s `limitations` array, including `auth`, `writes`, `pow`, and `payment`. False values should be specified using a `!` prefix, for example `!auth`.\n- `t` - A topic associated with this relay\n- `k` - Accepted and unaccepted kinds (false values prepended by `!`) \n- `g` - A [NIP-52](nostr:naddr1qvzqqqrcvypzq2eeknl7v2fnm7tsuxfkds3vrcyjl9fls070a465urcy6k3mgk0eqqrxu6ts956ny2q90l7) geohash\n\nTags with more than one value should be repeated, rather than putting all values in a single tag, for example `[[\"t\", \"cats\"], [\"t\", \"dogs\"]]`, rather than `[[\"t\", \"cats\", \"dogs\"]]`.\n\nExample:\n\n```json\n{\n  \"id\": \"<eventid>\",\n  \"pubkey\": \"<monitor's pubkey>\",\n  \"created_at\": \"<created_at  [some recent date ...]>\",\n  \"signature\": \"<signature>\",\n  \"content\": \"<optional nip 11 document>\",\n  \"kind\": 30166,\n  \"tags\": [\n    [\"d\",\"wss://some.relay/\"],\n    [\"n\", \"clearnet\"],\n    [\"N\", \"40\"],\n    [\"N\", \"33\"],\n    [\"R\", \"!payment\"],\n    [\"R\", \"auth\"],\n    [\"g\", \"ww8p1r4t8\"],\n    [\"l\", \"en\", \"ISO-639-1\"],\n    [\"t\", \"nsfw\" ],\n    [\"rtt-open\", \"234\" ]\n  ]\n}\n```\n\n## Relay Monitor Announcements\n\nKind `10166` relay monitor announcements advertise the author's intent to publish `30166` events. This event is optional and is intended for monitors who intend to provide monitoring services at a regular and predictable frequency.\n\nTags include:\n\n- `frequency` - The frequency in seconds at which the monitor publishes events.\n- `timeout` (optional) - The timeout values for various checks conducted by a monitor. Index `1` is the monitor's timeout in milliseconds. Index `2` describes what test the timeout is used for. If no index `2` is provided, it is inferred that the timeout provided applies to all tests.\n- `c` - a lowercase string describing the checks conducted by a monitor. Examples include `open`, `read`, `write`, `auth`, `nip11`, `dns`, and `geo`.\n- `g` - [NIP-52](nostr:naddr1qvzqqqrcvypzq2eeknl7v2fnm7tsuxfkds3vrcyjl9fls070a465urcy6k3mgk0eqqrxu6ts956ny2q90l7) geohash tag\n\nMonitors SHOULD also publish a `kind 0` profile and a `kind 10002` relay selections event.\n\nExample:\n\n```json\n{\n  \"id\": \"<eventid>\",\n  \"pubkey\": \"<monitor's pubkey>\",\n  \"created_at\": \"<created_at  [some recent date ...]>\",\n  \"signature\": \"<signature>\",\n  \"content\": \"\",\n  \"tags\": [\n    [ \"timeout\", \"open\", \"5000\"  ],\n    [ \"timeout\", \"read\", \"3000\"  ],\n    [ \"timeout\", \"write\", \"3000\" ],\n    [ \"timeout\", \"nip11\", \"3000\" ],\n    [ \"frequency\", \"3600\" ],\n    [ \"c\", \"ws\" ],\n    [ \"c\", \"nip11\" ],\n    [ \"c\", \"ssl\" ],\n    [ \"c\", \"dns\" ],\n    [ \"c\", \"geo\" ]\n    [ \"g\", \"ww8p1r4t8\" ]\n  ]\n}\n```\n\n ## Risk Mitigation                                                                                                                                                 \n                                                                                                                                                                   \n  - Clients MUST NOT require `30166` events to function. Absence of monitoring data MUST NOT prevent relay connections.\n  - A monitor may publish erroneous `30166` events, either by misconfiguration or malicious intent.\n  - Clients SHOULD NOT trust a single source. Defenses include: web-of-trust filtering, querying multiple monitors, and discarding filter results if they would remove an unreasonable proportion of relays.\n","sig":"68bb2aae725a29071dbd478f06c0d40c1bc6be4bc6227977b081dcca8079f6635e31816b538cbc12ddceffad4b62ad565dbc6ce0d97e6c1114033aa00b36f878"}