fabric icon indicating copy to clipboard operation
fabric copied to clipboard

Improve error message for private data not available on a peer

Open denyeart opened this issue 3 years ago • 5 comments

Improve message "private data matching public hash version is not available. Public hash version = %s, Private data version = %s" to indicate the actual issue, that is, private data wasn’t distributed to that peer collection member for a specific key and therefore the peer can’t endorse future transactions for the key.

denyeart avatar Jan 04 '22 17:01 denyeart

I'm getting this error when trying to read another Orgs private collection withmemberOnlyRead:false does this have to do with distribution

zdenardi avatar Sep 07 '23 15:09 zdenardi

Copying the response sent on mailing list here.

Org2 cannot query Org1 private data on their own Org2 peer. The whole point of private data is that it stays private to Org1 and only Org1 can choose to disclose it. There are generally two options for sharing/transferring the private data:

Org2 client application can send a query request to an Org1 peer. Org1’s chaincode would check if the client is authorized to query the data (perhaps using a combination of the client identity information, passed arguments, and the specific state information). If authorized, Org1 chaincode can choose to return data to Org2 client (and potentially endorse a ledger update). Note, this is where memberOnlyRead comes in... if it is true the request will automatically return an error. If it is false then you can use custom logic in the chaincode to determine if the client is authorized.

Org1 could provide Org2 the private data out of band in another application. Org2 can then query their own Org2 peer and using GetPrivateDataHash() can confirm that a hash of the private data matches the on-chain hash. For example, if transferring an asset from Org1 to Org2 you may do this to confirm an asset on the ledger prior to the actual transfer.

denyeart avatar Sep 13 '23 22:09 denyeart

@denyeart I noticed that this issue has not been addressed yet. Are there any plans to work on this issue in the near future? If it's alright with you, I would be more than happy to assist in resolving this issue. Please let me know if you could use my help.

satota2 avatar Feb 29 '24 05:02 satota2

@satota2 You are more than welcome to improve the message, thank you!

denyeart avatar Feb 29 '24 16:02 denyeart

@denyeart Thank you! I'll consider some improvements.

satota2 avatar Mar 04 '24 01:03 satota2