From 4593a1304b66c0b8c2baadef1d3db75ce427c741 Mon Sep 17 00:00:00 2001 From: Chad Curtis Date: Sat, 19 Jul 2025 04:29:53 +0000 Subject: [PATCH] Context regarding what a unique d-tag means in implementation. --- CONTEXT.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/CONTEXT.md b/CONTEXT.md index 801d06b..f074fde 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -226,6 +226,40 @@ An event's kind number determines the event's behavior and storage characteristi Kinds below 1000 are considered "legacy" kinds, and may have different storage characteristics based on their kind definition. For example, kind 1 is regular, while kind 3 is replaceable. +#### D-Tag Management for Addressable Events + +For addressable events (kinds 30000-39999), the `d` tag identifies logical content. Use content-derived identifiers that remain consistent across updates. + +**❌ Wrong - Iterative d-tag:** +```json +{ + "kind": 30023, + "tags": [["d", "review-1"]], + "content": "Initial review..." +} + +{ + "kind": 30023, + "tags": [["d", "review-2"]], + "content": "Updated review..." +} +``` + +**✅ Correct - Consistent d-tag:** +```json +{ + "kind": 30023, + "tags": [["d", "product-review-iphone-15-pro"]], + "content": "Initial review..." +} + +{ + "kind": 30023, + "tags": [["d", "product-review-iphone-15-pro"]], + "content": "Updated review..." +} +``` + ### Content Field Design Principles When designing new event kinds, the `content` field should be used for semantically important data that doesn't need to be queried by relays. **Structured JSON data generally shouldn't go in the content field** (kind 0 being an early exception).