Replies: 1 comment
-
My guess is that the chaincode named |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Recently, while learning Fabric, I encountered some issues when trying to interact with the test-network using the Fabric Gateway client API.
My node version is 2.5.11.
The network uses the default configuration of the test network, which includes two organizations, each with one peer node, and the default channel created is "mychannel".
The chaincode has been debugged and runs successfully on my Ubuntu.
Here is my Java code:
public void uploadScoreToChain(ScoreToChainDTO scoreToChainDTO) { .... try (Gateway gateway = builder.connect()){ Network network = gateway.getNetwork(blockChainConfig.getChannelName()); Contract contract = network.getContract(getContractName()); String key = scoreToChainDTO.stateKey(); String scoreToChainDTOStr = JsonUtil.toJsonStr(scoreToChainDTO); contract.submitTransaction(methodName, key, scoreToChainDTOStr); } catch (Throwable e) { .... } }
An error occurs at contract.submitTransaction:
Caused by: org.hyperledger.fabric.client.EndorseException: io.grpc.StatusRuntimeException: FAILED_PRECONDITION: no combination of peers can be derived which satisfy the endorsement policy: No metadata was found for chaincode ScoreContract in channel mychannel
Logs from the peer0.org1.example.com node.

Additionally, performing a contract.evaluateTransaction query also results in an error:
org.hyperledger.fabric.client.GatewayException: io.grpc.StatusRuntimeException: FAILED_PRECONDITION: no peers available to evaluate chaincode ScoreContract in channel mychannel
Logs from the peer0.org1.example.com node.

There are no logs from peer0.org2.example.com, possibly due to some configuration issues, but I am not sure how to solve it, feeling a bit at a loss.
This is my Gateway.Builder Java bean configuration class:
`@Bean
public Gateway.Builder gateway() throws Exception {
// Create client identity based on X.509 certificate.
Reader certReader = Files.newBufferedReader(Paths.get("src/main/resources/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]"));
X509Certificate certificate = Identities.readX509Certificate(certReader);
Identity identity = new X509Identity("Org1MSP", certificate);
Beta Was this translation helpful? Give feedback.
All reactions