Reputation: 1
while running the secured-asset transfer in hyperledger fabric I am getting this error and the query command is not passing
Command:- peer chaincode query -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n secured -c '{"function":"GetAssetPrivateProperties","Args":["asset1"]}'
Error:- Error: endorsement failure during query. response: status:500 message:"asset private details does not exist in client org's collection: asset1"
Can anyone help me with it ??
Upvotes: 0
Views: 161
Reputation: 1
The source code from the hyperledger /fabric-samples seems is not compatible with the command provided in the hyperledger fabric document.
Change the code in the repository of
fabric-samples/asset-transfer-secured-agreement/chaincode-go/asset_transfer.go
Add argument asset_id string
to this function head.
CreateAsset(ctx contractapi.TransactionContextInterface,asset_id string, publicDescription string)
In this function body
comment this line assetID := hex.EncodeToString(hash.Sum(nil))
and reset the assetID := asset_id
hope helpful
Upvotes: 0
Reputation: 560
This error is thrown from the chaincode. Make sure you have added the data to the private data collection with the key 'asset1' before querying it. Also, orderer endpoints are not required for query command.
peer chaincode query -C mychannel -n basic -c '{"function":"GetAssetPrivateProperties","Args":["asset1"]}'
Upvotes: 0