Storage data in private data collection has a different value #fabric #couchdb

Joao Antunes

Hi all,

I've encountered a strange issue and couldn't find any opened issue regarding this.

Currently using JAVA to develop the chaincde


I'm using private data collections to store data. The stored data is something like:

{"item":"itemName", "quantity", 1.0}

The quantity is a BigDecimal.


From what I can check, when we store the data above, the hash that is generated by fabric has the ".0" value in it.

The problem comes when I try to get the data from private data collection. It returns with no ".0" value.

Then when I'm validating the value with its hash, I get a mismatch.


Shouldn't the value be stored as it is sent to couchdb?

Joao Antunes

Is anyone faced with this issue?

Joao Antunes

Any ideas regarding this error?

Mark Lewis

I'll say first that this is not something I have experimented with myself. Private data values are put and retrieved using the ChaincodeStub as byte-array or string data, whereas what you're presenting is JSON, which I guess is what you are seeing in CouchDB? Do you have a minimal example chaincode implementation that demonstrates how you are putting and getting the private data that can be used to reproduce the problem? If so, it might be worth creating an issue to report a potential bug.