From d3cf4399c90f75ad76bdfd50563809deebc3573b Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Wed, 26 Jun 2024 10:11:44 -0400 Subject: [PATCH] Adds more examples. --- 97.md | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/97.md b/97.md index 3da66972..2bf96e67 100644 --- a/97.md +++ b/97.md @@ -8,20 +8,19 @@ Nostr Name System (NNS) Event `30053` defines a DNS record for Nostr. `ip4` and `ip6` tags represent DNS's `A` records. -```jsonc +```js { - "created_at": , "kind": 30053, "tags": [ ["d", ""], - // relays used by the community (w/optional marker) + ["ip4", "230.22.120.232"], ["ip4", "230.22.120.233"], // mirrored servers / client-based load balancing ["ip4", "230.22.120.234"], // mirrored servers / client-based load balancing ["ip6", "FE80:0000:0000:0000:0202:B3FF:FE1E:8329"] // same content as ipv4 ], - ... + // ... } ``` @@ -44,26 +43,49 @@ The `naddr1`'s `relay` field SHOULD have the IP-based URI to the relay (e.g.: `w Clients SHOULD intercept the DNS resolution of any `naddr1` domain name and resolve to IP using the latest version of the NNS replaceable event. If the NNS event cannot be found locally, Clients SHOULD in parallel: -1. Connect to the IP in the `relay` field of the `naddr1` do download a potentially outdated version of the NNS record. +1. Connect to the IP in the `relay` field of the `naddr1` to download a potentially outdated version of the NNS record. 2. Retrieve the latest version of this replaceable from the (NIP-65)[65.md] WRITE relays of the `naddr1`'s pubkey. # HTTP URLs (Media Servers) Clients SHOULD use the NNS address (e.g. `http://naddr1...ccpzu/`), if available, instead of the regular domain name in all URLs, both in tags and in the content of events. +For example, this loads an image without a domain name: + +```js + "kind": 1, + "tags": [], + "content": "NNS is amazing: http://naddr1...ccpzu/image.jpg", + // ...other fields +} +``` + # Relay Hints Clients SHOULD use the NNS record (e.g. `wss://naddr1...ccpzu`), if available, instead of the regular domain name in all relay hints. +For example, this is a reply using an NNS relay hint + +```js +{ + "kind": 1, + "tags": [ + ["e", "", "", "root"], + ], + "content": "", + // ...other fields +} +``` + # Relay Lists Clients SHOULD use the NNS record (e.g. `wss://naddr1...ccpzu`), if available, instead of the DNS in all relay lists. The NNS events to resolve those addresses MUST be broadcasted to the same relays as their kind `10002` -For example: +For example, this is a relay list using NNS addresses -```json +```js { "kind": 10002, "tags": [ @@ -72,6 +94,6 @@ For example: ["r", "wss://naddr1...um5wg", "read"] ], "content": "", - ...other fields + // ...other fields } ```