# NIP33

## 参数化可替换事件

`draft` `optional` `author:Semisol` `author:Kukks` `author:Cameri` `author:Giszmo`

该 NIP 添加了一个新的事件范围，允许替换具有相同 `d` 标签和种类的事件，而不像 NIP-16 仅替换为种类。

## 实施

标签的值定义为标签名称后标签的第一个参数。

A*参数化可替换事件*被定义为具有种类 `30000 <= n < 40000` 的事件。在接收到具有比当前已知的具有相同种类和第一 `d` 标签值的最新可替换事件更新的时间戳的参数化可替换事件时，应当丢弃旧事件并用较新事件替换。缺少或 `d` 没有值的标记应被解释为等同于值为空字符串的 `d` 标记。来自同一作者的事件与以下 `tags` 任何一项相互替换：

* `“标签”：[[“D ”，“”]`
* `"tags":[]`：具有空值的隐式 `d` 标记
* `"tags":[["d"]]`：隐式空值 `""`
* `"tags":[["d",""],["d","not empty"]]`：仅考虑第一个 `d` 标记
* `"tags":[["d"],["d","some value"]]`：仅考虑第一个 `d` 标记
* `"tags":[["e"]]`：与无标记相同
* `"tags":[["d","","1"]]`：只考虑第一个值（ `""`）

客户端不应使用 `d` 具有多个值的标记，并且即使标记没有允许使用 `#d` 筛选器进行查询的值，也应包含该 `d` 标记。

## 引用和标记

通常（根据 NIP-01、NIP-12） `"p"`，标签用于引用公钥， `"e"` 标签用于引用事件 ID，并且 `note`、 `npub` `nprofile` 或 `nevent` 是事件标签的等价物（即， `nprofile` 通常被转换为标签 `["p", "<event hex id>", "<relay url>"]`）。

为了支持到参数化可替换事件的链接， `naddr` 在 NIP-19 上引入了代码。它包括事件作者和 `d` 标记（和中继）的公钥，以便可以找到引用的公钥和 `d` 标记的组合。

`naddr` 代码中 `tags` 的等效项是标记 `"a"`，由 `["a", "<kind>:<pubkey>:<d-identifier>", "<relay url>"]` 组成。

## 客户行为

客户端应使用该 `supported_nips` 字段来了解中继是否支持此 NIP.客户端可以向可能不支持此 NIP 的中继发送参数化可替换事件，并且客户端查询应为中继发送多个事件做好准备，并且应使用最新的事件，并建议发送 `#d` 标签过滤器。客户端应该考虑到这样一个事实，即丢失的 `d` 标记或没有值的标记不会在标记过滤器中返回，并且建议客户端始终包含 `d` 具有值的标记。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sherry-pang.gitbook.io/nostr-cn/fu-lu-1-nip-xiang-jie/33.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
