Implementing Private Data Collection in Hyperledger Fabric 2.0 Error - hyperledger-fabric

I tried to implement the private data collections in fabric 2.0 network.I have faced error when I tried to invoke chaincode with the transient data flag.
And it is unable to recognize the method ("priv").
Error: endorsement failure during invoke. response: status:500 message:"error in simulation: transaction returned with failure: Error: You've asked to invoke a function that does not exist: priv"
The "priv" method in chaincode is fairly simple.It is using the putPrivateData() method to store the private data.

I have fixed it.The issue was related to the version of shim api in package.json of chaincode.

Related

Why can't I commit transactions with Caliper to Hyperledger Fabric?

I've got Caliper configured as a subtree of my custom Fabric blockchain. I have it configured correctly in order to connect the network and am running a small set of tests at the moment. The arguments I'm providing are absolutely correct in terms of the custom chaincode being run, but whenever I try to create a transaction via Caliper I get the error:
Failed to perform submit transaction [CreateAsset] using arguments [<ARGS>], with error: TypeError: Cannot read property 'status' of undefined
Anybody encountered this before with Caliper V0.4.2? It's interfacing with a Fabric 2.3.3 instance on local machine via Kubernetes, with the latest SDK bound.
The error occurs on line 237 of transactions.js inside the node_module fabric-network, where there is a strict property comparison on a commit object.
Also it's worth noting that the querying part of my test rounds is yielding expected results... none of those assets get created due to the error thrown, and when querying for a given asset an error like so occurs:
Failed to perform query transaction [ReadAsset] using arguments [<ID>], with error: Error: error in simulation: transaction returned with failure: Error: The asset <ID> does not exist
The closest thing I've been able to find is this ~2 year old issue which isn't exactly what I'm facing but it's the same sort of error at least... any help or pointers would be greatly appreciated because I'm struggling to glean useful information. (Link: https://github.com/hyperledger/caliper/issues/727)
The issue was due to the host names being converted to localhost when you want to work anything except a network running locally via docker. You need to launch caliper with the following extra option
--caliper-fabric-gateway-localhost false

Chaincode Deployment Failed

I am new to Hyperledger fabric. When I am trying to install the Chaincode, I am getting the below error :
Error: proposal failed with status: 500 - failed to invoke backing implementation of 'ApproveChaincodeDefinitionForMyOrg': attempted to redefine uncommitted sequence (1) for namespace marbles03 with unchanged content
Please shed a light on this.
Thank you
After doing some Googling, I found Nikhil Gupta's answer on the hyperledger.org site to be helpful.
This message states that you have already approved the chaincode definition as this org. The chaincode definition with sequence 1 has already been defined for that organization, and you cannot define the same sequence again.
Assuming that you are executing the peer lifecycle chaincode approvemyorg command, you have already approved the chaincode definition with sequence 1, and you cannot redefine it for this organization.

Getting error as Failed to evaluate transaction: Error: No event hubs for strategy

I have implemented the Raft network with TLS with three orderer and installed and initiated Go chaincode however when I am trying to invoke chaincode its giving me error
error: [AbstractStrategy]: constructor: No event hubs for strategy
Failed to evaluate transaction: Error: No event hubs for strategy
Please anybody help me as I am getting this issue first time.
Thanks in advance

Chaincode Query Transcation is not executing in EC2 Insance

please find the image first intsertion was happened sucessfully.I am trying to query my transaction in Amazon-EC2 but it is returning NULL with endorsement failure even though my insertion transaction is working fine in the local system.
This is the error I get:
endorsement failure during invoke. response: status:500 message:"transaction returned with failure: Error: {\"Error\":\"candidate does not exist with: 13VV1A0533\"}"
From the error it seems that the chaincode is missing error handling for scheduleInterview method.
What the error means is that there is no data for the key candidate id.
Do revert if this doesnt help.

Timeout expired while querying large data on Hyperledger Fabric 1.4.1

I am using Hyperledger Fabric 1.4.1, with Kafka ordering service, Couch DB as stateDB, Java chaincode and Java SDK.
I experience timeout expired when I try to send large data to the channel and then query it back.
The data size of the transaction I sent is 512KB, and I can query it from peers.
I tried sending it 7 times with the same id, and I can get all 7 histories with shim function getHistoryForKey. But when I sent it 8 times with the same id, getHistoryForKey failed.
The error message is shown below (from peers):
Error: endorsement failure during query. response: status:500 message:"failed to execute transaction fdfbc5b72efd688136c777f5b114a3cedc62339e42f6c39a27e86ca11b8e3d14: error sending: timeout expired while executing transaction"
I have tried to expand the timeout with following options and their combinations in peer and client:
CORE_CHAINCODE_EXECUTETIMEOUT="120s"
CORE_LEDGER_STATE_COUCHDBCONFIG_REQUESTTIMEOUT="120s"
# (seems this setting is not for Hyperledger Fabric)
CORE_PEER_GRPCOPTIONS_REQUESET_TIMEOUT="120s"
But they didn't help in my case.
I also noticed that the 7 copies of testing data are about 3.5MB, and I tried to query 4MB data (which is about 8 copies) from a peer but failed.
When we check the chaincode runtime docker, we see the following error message:
SEVERE: An error occured on the chaincode stream. Shutting down the chaincode stream.
io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED:
io.grpc.netty.NettyClientTransport$3: Frame size 6294852 exceeds maximum: 4194304.
It seems like there is a grpc limitation on running the java chaincode docker.
We tested with go chaincode, we do not experience the same issue.
We managed to fix that by overriding the ChaincodeBase class
ManagedChannelBuilder<?> newChannelBuilder() throws IOException {
final NettyChannelBuilder builder = NettyChannelBuilder.forAddress(host, port);
logger.info("Configuring channel connection to peer.");
builder.maxInboundMessageSize(104857600);
logger.info("maxInboundMessageSize is 104857600.");
if (tlsEnabled) {
builder.negotiationType(NegotiationType.TLS);
builder.sslContext(createSSLContext());
} else {
builder.usePlaintext(true);
}
return builder;
}
I have submitted a ticket on fabric Jira to support changing the variable without overriding.

Resources