博客
关于我
Zcash中的merkle tree
阅读量:270 次
发布时间:2019-03-01

本文共 1022 字,大约阅读时间需要 3 分钟。

1. 引言

note commitment tree 是一种具有固定深度的增量性 Merkle 树,用于存储通过 JoinSplit 转移或 Spend 转移产生的 note commitments。它与 Bitcoin 中的 unspent transaction output set (UTXO set) 有以下相似之处:

  • 存在价值的表达:两者都能表达存在价值的能力。

然而,它们在防双花方面存在显著差异:

  • note commitment tree 是 append-only 的,这意味着它无法用于防双花。

2. Merkle 树结构

note commitment tree 的根节点位于 0 层。在第 h 层,有 (2^h) 个节点,编号从 0 到 (2^h - 1)。每个节点对应一个 255 位的 hash 值。

对于第 h 层的第 i 个节点,其 hash 值表示为 (M_i^h),其中 (M_i^h = \text{MerkleCRH}^{Sapling}(M_{2i}^{h+1}, M_{2i+1}^{h+1}))。

3. note position

note position 指的是一个 note 的 commitment 在最底层(MerkleDepth 为 32)的位置。未使用的 leaf nodes 将关联特定的 hash 值,用于标识未使用的 commitment。

4. Merkle path validity

在 note commitment tree 中,每个节点都关联一个 255 位的 hash 值。通过从 leaf node 到 root 的 Merkle path,可以验证一个 commitment 是否存在于 tree 中。

Merkle path 由一系列 hash 值构成,例如:

[ [M_{sibling(h,i)}^h] ]

其中,(h) 和 (i) 是路径中的参数。通过计算 Merkle path,可以验证给定的 hash 值是否与 root 匹配。

5. 检查 Merkle path

对于一个已知的 Merkle path 和 root,可以验证某个 leaf node 是否存在于树中。例如,给定一个 hash 值 (M_i^{MerkleDepth}),可以通过计算其 Merkle path 并与 root 进行比较,确认其是否有效。

6. 参考资料

[1]

转载地址:http://ckqx.baihongyu.com/

你可能感兴趣的文章
org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned
查看>>
org.apache.ibatis.type.TypeException: Could not resolve type alias 'xxxx'异常
查看>>
org.apache.poi.hssf.util.Region
查看>>
org.apache.xmlbeans.XmlOptions.setEntityExpansionLimit(I)Lorg/apache/xmlbeans/XmlOptions;
查看>>
org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /
查看>>
org.hibernate.HibernateException: Unable to get the default Bean Validation factory
查看>>
org.hibernate.ObjectNotFoundException: No row with the given identifier exists:
查看>>
SQL-CLR 类型映射 (LINQ to SQL)
查看>>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
查看>>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
查看>>
org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size exceeded
查看>>
org.tinygroup.serviceprocessor-服务处理器
查看>>
org/eclipse/jetty/server/Connector : Unsupported major.minor version 52.0
查看>>
org/hibernate/validator/internal/engine
查看>>
Orleans框架------基于Actor模型生成分布式Id
查看>>
SQL-36 创建一个actor_name表,将actor表中的所有first_name以及last_name导入改表。
查看>>
ORM sqlachemy学习
查看>>
Ormlite数据库
查看>>
orm总结
查看>>
os.environ 没有设置环境变量
查看>>