跳到主要内容

证明链

域名以批次为单位注册。每个批次等待约 10 分钟。每个批次产出一份证明。这些证明构成一条自创世起的状态转移链:

genesis_root (empty tree -- known constant)
| +-- "richard.zcash" registered at block 100,
| +-- "john.zcash" registered at block 110,
| ... (could be more registration/update commands)
| ! Proof 1 is generated
| old_root = genesis_root --> new_root_1
| +-- "richard.zcash" put his name on marketplace at block 200,
| +-- "sam.zcash" registered at block 250,
| ... (could be more registration/update commands)
| ! Proof 2 is generated
| old_root = new_root_1 --> new_root_2 (= current root)

每份证明的 old_root 必须等于前一份证明的 new_root。而第一份证明的 old_root 必须等于已知的创世根(一棵空的稀疏默克尔树)。

验证这条链​

验证者通过五个步骤检查整段注册历史:

  1. 取得 SP1 验证密钥 — 它由客户程序的二进制文件确定性地推导得出。规则变更会替换它,因此在变更之前锚定的证明要用当时有效的密钥来验证
  2. 从 BNB Smart Chain 收集证明 — 每一笔发往锚定合约的 commitBatch 交易都在其 calldata 中携带自己的证明和公开值;合约的 RootUpdated 事件可以引导你找到它们。索引器 API 不提供证明
  3. 用该验证密钥逐一验证每份 SP1 证明
  4. 检查这条链 — genesis == P1.old_root、P1.new_root == P2.old_root、...、PN.new_root == current_root
  5. 在链上抽样核对 — 在 ZCash 节点上查找任意一个已承诺的 txid,确认备注、金额和区块都对得上

若所有检查都通过,整段注册历史就是正确的——无需信任索引器。

证明流水线​

注册方用同一个定时器先后运行两个处理器:

ZCash Blockchain
|
Block processor (scans each block, pre-checks commands, waits for 20 confirmations)
|
Batch (open for about 10 minutes, then re-checked against the name state)
|
Batch processor (SP1 proof of the batch's state transition)
|
Anchor contract (verifies the proof on BNB Smart Chain; the new root is a checkpoint)
|
Indexers sync to the checkpoint (replay ZCash and must reach the same root)
|
API Server (GET /v1.0/resolve/{name})

两个处理器轮流工作:当一个批次正在被证明和锚定时,新区块会等待扫描,并在它完成后立即被处理。不会漏掉任何支付——只是晚几分钟才被看到。