Debut Infotech
Debut Infotech

Reputation: 472

Hyperledger Fabric Private Data Collection

I am running BYFN(Default) as a network and here is my chaincode used for test purpose Chaincode link My collection config is Config File Link . Now Let me explain the issue. When i Query from authorized peer means any of peer of ORG1 its gives me correct result

{
  "public_data": {
    "docType": "car",
    "name": "Honda Amaze",
    "color": "blue",
    "size": 35,
    "owner": "tom"
  },
  "privatedata": {
    "docType": "car",
    "name": "Honda Amaze",
    "owner_address": "Vill anyari url alinagar Moradabad"
  }
}

But when I query from unauthorized peer means any peer of organization 2 then inspite of error message that we can't access data. I am getting response as

{
  "public_data": {
    "docType": "car",
    "name": "Honda Amaze",
    "color": "blue",
    "size": 35,
    "owner": "tom"
  },
  "privatedata": {
    "docType": "",
    "name": "",
    "owner_address": ""
  }
}

You can see that private data is not there . If i run marbels private data exmple it gives me error from unauthorized peer

{"Error":"Failed to get private details for marble1: GET_STATE failed: transaction ID: b04adebbf165ddc90b4ab897171e1daa7d360079ac18e65fa15d84ddfebfae90: Private data matching public hash version is not available. Public hash version = &version.Height{BlockNum:0x6, TxNum:0x0}, Private data version = (*version.Height)(nil)"}"

No Marbels private example they are not getting data from simple ledger But in my chaincode am getting data from normal ledger and private data both.

Any help Much appereciated.

Thanks in advance.

Upvotes: 1

Views: 1400

Answers (2)

Md Abid Khan
Md Abid Khan

Reputation: 1

This error I also faced but for me it was occurring because I added the peer details of unauthorized peer.

Upvotes: 0

Dave Enyeart
Dave Enyeart

Reputation: 2573

I expect the difference is simply related to your error handling code in your chaincode. You need to handle the error returned by GetPrivateData().

Upvotes: 2

Related Questions