【问题标题】:How hyperledger Fabric cost storage of machine?hyperledger Fabric 如何存储机器?
【发布时间】:2019-03-23 21:27:04
【问题描述】:

我正在使用 hyperledger Fabric 和 Composer 启动我的区块链,我进行了 17000 多笔交易,但它在对等容器中花费了 1.8GB(~100KB/交易)。我计算了一笔交易的存储,可能只需要 1KB+。所以我的问题是结构如何将数据保存在分类帐中?
我使用了 rest-api 来查找我的记录,例如:

[
  {
    "$class": "org.chembeango.io.Compound",
    "compoundId": "870-77-9",
    "name": "3-acetyloxy-4-(trimethylazaniumyl)butanoate",
    "smiles": "CC(=O)OC(CC(=O)[O-])C[N+](C)(C)C",
    "cas": "870-77-9",
    "source": "pubchem",
    "location": "http://192.168.11.111:9200/compounds",
    "owner": "resource:org.chembeango.io.CompoundParticipant#cp1@email.com"
  },
  {
    "$class": "org.chembeango.io.Compound",
    "compoundId": "pubchem-2",
    "name": "(2-acetyloxy-3-carboxypropyl)-trimethylazanium",
    "smiles": "CC(=O)OC(CC(=O)O)C[N+](C)(C)C",
    "cas": "pubchem-2",
    "source": "pubchem",
    "location": "http://192.168.11.111:9200/compounds",
    "owner": "resource:org.chembeango.io.CompoundParticipant#cp1@email.com"
  },
...

每个事务可能会创建多个事件,但我认为这不会为每个事务花费如此大的存储空间。

我的频道的块配置是:

BatchTimeout: 2s

BatchSize:
    MaxMessageCount: 10
    AbsoluteMaxBytes: 99 MB
    PreferredMaxBytes: 512 KB

我在每个区块中创建 1 个交易,每个区块都有其最小大小吗?

【问题讨论】:

    标签: hyperledger-fabric hyperledger-composer


    【解决方案1】:

    我发现了我的问题,我在我的 logic.js 中添加了查询功能,比如

    const validateActions = await query('selectAllValidateActions');
    

    我跟踪了块文件并发现日志是:

    ,Asset:org.chembeango.io.ValidateAction96�
    3
    ,Asset:org.chembeango.io.ValidateAction96�
    3
    ,Asset:org.chembeango.io.ValidateAction96�
    3
    ,Asset:org.chembeango.io.ValidateAction96�
    3
    ,Asset:org.chembeango.io.ValidateAction96�
    3
    ,Asset:org.chembeango.io.ValidateAction96�
    3
    ,Asset:org.chembeango.io.ValidateAction96�
    3
    ,Asset:org.chembeango.io.ValidateAction96�
    3
    ,Asset:org.chembeango.io.ValidateAction96�
    3
    ,Asset:org.chembeango.io.ValidateAction96�
    ...
    

    也许交易会将我的所有查询结果记录到分类帐中。
    所以账本保存了很多无用的信息。
    但是为什么 composer 查询结果可能会保存到账本中呢?

    【讨论】:

      猜你喜欢
      • 2018-08-19
      • 2019-01-15
      • 2019-01-31
      • 1970-01-01
      • 1970-01-01
      • 2017-12-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多