简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM