AN

Nostr + Arweave 探索

0 88

Original by PermaDAO

Nostr(Notes and Other Stuff Transmitted by Relays)是一个轻量级的底层去中心社交协议,协议具体规则称为NIPs(Nostr Improvement Proposas),NIPs 包含一组强制规则和可选规则。

协议中所有的消息都会被用户使用私钥签名,所以都是可验证的。用户在网络上只使用公钥地址进行匿名交互。

它的目标是建立一个抗审查的社交网络,让用户真正掌握社交媒体的自主权。

relay & client & event

Nostr 中包含最核心的两个部分是relay和client。

relay 即中继器,负责存储和处理用户消息,本质是 WebSocket 服务器,为用户提供服务,nostr 协议中定义了relay 实现标准以及 relay 与 client 端到端的数据传输规则。

用户消息称为 Event,每个 Event 都会经过用户签名,签名为 Schnorr(Bitcoin Taproot中使用的BIP340)。

// Event structure
{
  "id": <32-bytes sha256 of the the serialized event data>
  "pubkey": <32-bytes hex-encoded public key of the event creator>,
  "created_at": <unix timestamp in seconds>,
  "kind": <integer>,
  "tags": [
    ["e", <32-bytes hex of the id of another event>, <recommended relay URL>],
    ["p", <32-bytes hex of the key>, <recommended relay URL>],
    ... // other kinds of tags may be included later
  ]
  "content": <arbitrary string>,
  "sig": <64-bytes signature of the sha256 hash of the serialized event data, which is the same as the "id" field>,
}

client 是与 relay 交互的前端 APP,它可以从relay订阅任意 Event。client 只通过公钥进行识别,完全匿名的与 relay 进行交互,relay 会使用消息过滤器将消息推送给client([Subscription Filter](<https://github.com/fiatjaf/nostr/blob/master/nips/01.md#communication-between-clients-and-relays>))。

client 可以连接任意多个 relay,订阅不同内容,client 获取的内容和 relay 相关。

nostr 不是一个 p2p 网络,relay 之间、client 之间都没有交互。一个 relay 只和 client 交互,同时 client 可订阅不同 relay 的内容。

Nostr的意义

nostr 是一个极简协议,非常的开放,所以说任何事情都下放给了 relay 和 client 去做,这也是 nostr 的强大之处。

基于 nostr 可以构建任何类型的 relay,免费的、付费的、私有的、公开的、加密的等等,你可以将数据存到 aws 云,也可以存在本地,也可以存到其他公链上,nostr 都没有限制。

同时 nostr 对 event 的内容也没有任何限制,event 更接近通用存储的载体,这就需要 relay 或者 client 去完成内容的审核。

nostr 协议规定 relay 可以拒绝转发消息,但不能篡改消息,这意味着用户发的消息即使被一个 relay 屏蔽,也可以寻找另一 relay 转发,或者可以自己搭建一个 relay, 这样的网络中用户的消息永远无法被完全屏蔽。

nostr 是一个无区块链的去中心协议,它没有链式结构、没有共识层,却依然可以达到去中心的目的。甚至它是一个比区块链更底层的社交协议,relay 也可以搭建在任何公链之上。

nostr 也没有激励层,这交给了 relay 去决定,relay 可以让用户付费提供高级服务,比如消息加密、视频文件托管等。

Nostr + Arweave

虽然 nostr 对 relay 的数据存储没有规定,但如果要做到完全去中心化、内容不会丢失,还需要一种存储解决方案,nostr 把这个交给relay的实现者去解决。

可以通过 Arweave 将 relay 的消息进行存储,就达到了完全去中心的效果。Arweave 是一个数据永存网络,能保证数据永久存储且不被篡改。relay 可以将消息存储到后,即使这个 relay 掉线、或者被屏蔽,依然可以启动另一个relay,从 Arweave 拉取所有历史消息,这样一个新的 relay 服务就建立起来了。更进一步任何人都可以启动 relay,从 Arweave 拉取历史消息,这样就建立起一个抗审查、去中心的的社交网络。

可以说 Arweave 和 nostr 的契合度非常高,是 nostr 完美的去中心存储解决方案。


Join our
Telegram / Discord / Twitter / CN Twitter

Leave A Reply

Your email address will not be published.