Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: 修改36_MerkleTree中proof数量计算公式 #714

Merged
merged 1 commit into from
May 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion 36_MerkleTree/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ tags:

![Merkle Tree](./img/36-1.png)

`Merkle Tree`允许对大型数据结构的内容进行有效和安全的验证(`Merkle Proof`)。对于有`N`个叶子结点的`Merkle Tree`,在已知`root`根值的情况下,验证某个数据是否有效(属于`Merkle Tree`叶子结点)只需要`log(N)`个数据(也叫`proof`),非常高效。如果数据有误,或者给的`proof`错误,则无法还原出`root`根植。
`Merkle Tree`允许对大型数据结构的内容进行有效和安全的验证(`Merkle Proof`)。对于有`N`个叶子结点的`Merkle Tree`,在已知`root`根值的情况下,验证某个数据是否有效(属于`Merkle Tree`叶子结点)只需要`ceil(log₂N)`个数据(也叫`proof`),非常高效。如果数据有误,或者给的`proof`错误,则无法还原出`root`根植。
下面的例子中,叶子`L1`的`Merkle proof`为`Hash 0-1`和`Hash 1`:知道这两个值,就能验证`L1`的值是不是在`Merkle Tree`的叶子中。为什么呢?
因为通过叶子`L1`我们就可以算出`Hash 0-0`,我们又知道了`Hash 0-1`,那么`Hash 0-0`和`Hash 0-1`就可以联合算出`Hash 0`,然后我们又知道`Hash 1`,`Hash 0`和`Hash 1`就可以联合算出`Top Hash`,也就是root节点的hash。

Expand Down