简体   繁体   English

Hyperledger Composer / fabric中的主数据和交易数据关系

[英]Master data and transaction data relations in hyperledger composer/fabric

I want my master data and transaction data to always match. 我希望主数据和交易数据始终匹配。 The master data is off-chain and the transaction data on-chain. 主数据是链外的,交易数据是链上的。

The master data consists of several records from several tables. 主数据由来自多个表的多个记录组成。 I want the transaction data to always match the master data. 我希望交易数据始终与主数据匹配。 My participants are trusted, but it could be that one could go rogue and adapt the off-chain master data. 我的参与者是值得信任的,但是可能是流氓破坏了链下主数据。

I know that hashing is the way to go here. 我知道哈希是解决问题的方法。 I see loads of examples that a string is hashed. 我看到了很多示例,这些示例对字符串进行哈希处理。 But I am not sure how to hash multiple records. 但是我不确定如何散列多个记录。 Do I put them all into an object, convert that into a string and hash it? 我是否将它们全部放入对象中,将其转换为字符串并进行哈希处理? Is there a cleaner way to do this? 有没有更清洁的方法可以做到这一点?

In almost all implementations a hash is calculated over an array of bytes, any bytes. 在几乎所有的实现中,哈希都是在字节数组(任何字节)上计算的。 So you as a developer can choose the content of this byte array. 因此,作为开发人员,您可以选择此字节数组的内容。

  1. You can deserialize some object representation of the rows and hash that. 您可以反序列化行的某些对象表示形式并对其进行哈希处理。
  2. You can get the rows as a byte array (if your implementation supports that). 您可以将行作为字节数组获取(如果您的实现支持的话)。
  3. You can concatenate all the fields and hash that. 您可以连接所有字段并对其进行哈希处理。
  4. etc. etc. etc.. 等等等等等等

So the answer is you can choose what to hash it all depends on what you want to verify. 因此,答案是您可以选择要散列的内容,这完全取决于您要验证的内容。 The only thing to be aware of is that when checking the hash you should use the same method. 唯一需要注意的是,在检查哈希时,您应该使用相同的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 超级账本结构中的商业票据中没有交易数据 - No transaction data in commercial-paper in hyperledger fabric Hyperledger Fabric:获取所有块的块数据 - Hyperledger Fabric: Get Block Data for all blocks Hyperledger Composer - 找不到交易错误 - Hyperledger Composer - can't find transaction error 在超级账本结构中动态执行交易时出错 - Error while executing the transaction dynamically in hyperledger fabric Hyperledger结构:由于缺少配置数据,网络配置无效 - Hyperledger fabric : Invalid network configuration due to missing configuration data 在 Hyperledger Fabric 中,有没有办法将分类帐数据解码为人类可读的形式? - In Hyperledger Fabric, is there a way to decode ledger data to human readable form? Hyperledger Composer:使用来自HTML表单的数据添加参与者 - Hyperledger Composer: Add participant using data from HTML form Hyperledger Fabric Version 2: How to query Block Header such as data hash, previous hash by using Fabric Node SDK 2.2 - Hyperledger Fabric Version 2: How to query Block Header such as data hash, previous hash by using Fabric Node SDK 2.2 Fabric Javascript SDK和Hyperledger Composer之间的功能区别是什么? - What are the functional differences between Fabric Javascript SDK and Hyperledger Composer? Hyperledger Fabric Node.js SDK:离线交易签名问题 - Hyperledger Fabric Node.js SDK: Issue with offline transaction signatures
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM