[英]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.
因此,作为开发人员,您可以选择此字节数组的内容。
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.