NIPs nostr improvement proposals

NIP-66 - Relay Discovery and Liveness Monitoring

Table of Contents

Relay Discovery and Liveness Monitoring

draft optional

This NIP defines events for relay discovery and the announcement of relay monitors.

Relay Discovery Events

30166 relay discovery events document relay characteristics inferred either from a relay's NIP 11 document, or via probing.

Information 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.

content MAY include the stringified JSON of the relay's NIP-11 informational document.

The only required tag is the d tag, which MUST be set to the relay's normalized URL. For relays not accessible via URL, a hex-encoded pubkey MAY be used instead.

Other tags include:

Tags 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"]].

Example:

{
"id": "<eventid>",
"pubkey": "<monitor's pubkey>",
"created_at": "<created_at [some recent date ...]>",
"signature": "<signature>",
"content": "<optional nip 11 document>",
"kind": 30166,
"tags": [
["d","wss://some.relay/"],
["n", "clearnet"],
["N", "40"],
["N", "33"],
["R", "!payment"],
["R", "auth"],
["g", "ww8p1r4t8"],
["l", "en", "ISO-639-1"],
["t", "nsfw" ],
["rtt-open", 234 ]
]
}

Relay Monitor Announcements

Kind 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.

Tags include:

Monitors SHOULD also publish a kind 0 profile and a kind 10002 relay selections event.

Example:

{
"id": "<eventid>",
"pubkey": "<monitor's pubkey>",
"created_at": "<created_at [some recent date ...]>",
"signature": "<signature>",
"content": "",
"tags": [
[ "timeout", "open", "5000" ],
[ "timeout", "read", "3000" ],
[ "timeout", "write", "3000" ],
[ "timeout", "nip11", "3000" ],
[ "frequency", "3600" ],
[ "c", "ws" ],
[ "c", "nip11" ],
[ "c", "ssl" ],
[ "c", "dns" ],
[ "c", "geo" ]
[ "g", "ww8p1r4t8" ]
]
}