跳转到主要内容
OMA 事件是网络中信息交换的原子单位。每个事件都遵循 NIP-01 格式,OMA 模型嵌入在 content 字段中。
{
  "id": "<32-bytes lowercase hex-encoded sha256 of the serialized event data>",
  "pubkey": "<32-bytes lowercase hex-encoded public key of the event creator>",
  "created_at": <unix timestamp in seconds>,
  "kind": <integer between 0 and 65535>,
  "tags": [
    ["<arbitrary string>", "..."]
    // ...
  ],
  "content": "<embedded model>",
  "sig": "<64-bytes lowercase hex of the signature of the sha256 hash of the serialized event data, which is the same as the \"id\" field>"
}

字段

  • id —— 事件内容的确定性哈希值。任何字段发生变化,ID 都会变化。用于在整个网络中唯一引用事件。
  • pubkey —— 事件作者的公钥。这是发布该事件的公司或用户的身份。
  • kind —— 标识事件类型的整数。OMA 定义了自己的 kind 编号(例如挂单使用 31001,报价使用 2014)。节点和客户端通过它来正确过滤和路由事件。
  • tags —— 用于过滤和链接事件的键值对。完整参考请参见标签
  • content —— 作为 JSON 字符串嵌入的 OMA 模型。对于挂单,这是明文;对于报价和响应,则是加密内容。
  • sig —— 对事件 ID 的加密签名,由作者的私钥生成。它证明该事件由对应公钥的持有者创建,且未被篡改。