1
votes

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.

1
Got a issue that in my chaincode am not returning error if chaincode produce an error .But If i have to fetch both type of data(Simple Ledger & Private Data) in a single transaction then which approach i should follow. ?Debut Infotech
You can work with both regular data and private data within the same transaction.Dave Enyeart

1 Answers

2
votes

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