#tetcoin #framework #blockchain #crypto #block-hash

不使用 std noble-mmr

FABRIC Merkle 山脉高端

显示软件包…

1 个稳定版本

2.0.0 2021 年 4 月 4 日

#33#block-hash

35 每月下载次数
8 个软件包中使用(通过 node-runtime

Apache-2.0

1MB
25K SLoC

mmr


lib.rs:

默克尔山脉

概述

有关默克尔山脉(MMR)的详细信息,请参阅此处:https://github.com/mimblewimble/grin/blob/master/doc/mmr.md

MMR 高端从每个块从 LeafDataProvider 获取的叶子数据构建 MMR。MMR 节点存储在

  • 链上存储 - 只有哈希值;不是完整的叶子内容)
  • 链下存储 - 通过索引 API 我们将完整的叶子内容(以及所有内部节点)推送到链下数据库,以便链下工作人员可以访问这些数据。用于 MMR 的哈希值可以独立于其他运行时配置(即不使用 fabric_system::Hashing),因此可以使用与外部链兼容的东西(例如用于以太坊兼容性的 Keccak256)。

根据使用上下文(链下与链上),noble 能够

  • 验证 MMR 叶子证明(链上)
  • 生成叶子证明(链下)

有关如何优化由多个元素组成的叶子证明大小的信息,请参阅 primitives::Compact 文档。

用途是什么?

Primary use case for this noble is to generate MMR root hashes, that can latter on be used by
BEEFY protocol (see <https://github.com/tetcoin/grandpa-bridge-gadget>).
MMR root hashes along with BEEFY will make it possible to build Super Light Clients (SLC) of
Tetcore-based chains. The SLC will be able to follow finality and can be shown proofs of more
details that happened on the source chain.
In that case the chain which contains the noble generates the Root Hashes and Proofs, which
are then presented to another chain acting as a light client which can verify them.

Secondary use case is to archive historical data, but still be able to retrieve them on-demand
if needed. For instance if parent block hashes are stored in the MMR it's possible at any point
in time to provide a MMR proof about some past block hash, while this data can be safely pruned
from on-chain storage.

注意:此 noble 是实验性的,尚未在生产环境中证明其可用性。

依赖关系

~4–13MB
~148K SLoC