Getting error 4 when starting the hyperledger caliper benchmark - hyperledger-fabric

I created a functional network with 3 nodes and an orderer using the hyperleger fabric, in which I can carry out the communication between all nodes, executing existing operations in smart contracts. This network does not have TLS validation between nodes. The cryptographic material was created in one of the nodes and distributed among the other nodes in the network.
Now I'm trying to check the performance of the network using the hyperledger caliper. I created the test file, the network file and the other files needed to perform the performance evaluation, however, I am getting Error 4 in return.
Someone could help me, I am stuck on this problem for a few weeks and I don't see how to solve
it.
2021.01.07-01:58:10.942 info [caliper] [cli-launch-manager] Set workspace path: /home/ubuntu/caliper/monitor-benchmark
2021.01.07-01:58:10.944 info [caliper] [cli-launch-manager] Set benchmark configuration path: /home/ubuntu/caliper/monitor-benchmark/config.yaml
2021.01.07-01:58:10.944 info [caliper] [cli-launch-manager] Set network configuration path: /home/ubuntu/caliper/monitor-benchmark/net.yaml
2021.01.07-01:58:10.944 info [caliper] [cli-launch-manager] Set SUT type: fabric
2021.01.07-01:58:10.978 info [caliper] [benchmark-validator] No observer specified, will default to `none`
2021.01.07-01:58:10.978 info [caliper] [caliper-engine] Starting benchmark flow
2021.01.07-01:58:11.518 info [caliper] [fabric-connector] Initializing gateway connector compatible with installed SDK: 1.4.14
2021.01.07-01:58:11.651 info [caliper] [connectors/v1/fabric-gateway] Creating new InMemoryWallets for organizations
2021.01.07-01:58:11.664 info [caliper] [caliper-engine] Network configuration attribute "caliper.command.start" is not present, skipping start command
2021.01.07-01:58:11.665 info [caliper] [connectors/v1/fabric-gateway] Fabric SDK version: 1.4.14; TLS: none
2021-01-07T01:58:12.118Z - error: [FabricCAClientService.js]: Failed to enroll admin, error:%o message=Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 192.169.0.4:7054], stack=Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 192.169.0.4:7054]
at ClientRequest.request.on (/home/ubuntu/caliper/monitor-benchmark/node_modules/fabric-ca-client/lib/FabricCAClient.js:487:12)
at ClientRequest.emit (events.js:198:13)
at Socket.socketErrorListener (_http_client.js:401:9)
at Socket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
2021.01.07-01:58:12.119 error [caliper] [caliper-engine] Error while performing "init" step: Error: Couldn't enroll Org1's registrar or set it as user context: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 192.169.0.4:7054]
2021.01.07-01:58:12.120 info [caliper] [caliper-engine] Executed "init" step in 0.456 seconds
2021.01.07-01:58:12.120 info [caliper] [caliper-engine] Network configuration attribute "caliper.command.end" is not present, skipping end command
2021.01.07-01:58:12.120 error [caliper] [cli-launch-manager] Benchmark failed with error code 4
If necessary, I make the configuration files available to help find the cause of the problem.

From the errors shown above, it looks like a credentials issue.
I would recommend moving up to using the v2 fabric connector that is present in the most recent (0.4.2) Caliper release. It is based on the use of an explicit caliper configuration file that references Fabric Common Connection Profiles. There is a tutorial present in the Caliper documentation that should help you create the required resources, currently accessible at https://hyperledger.github.io/caliper/v0.4.2/fabric-tutorial/tutorials-fabric-existing/

Related

Error while performing "test" step: Error: Module "#hyperledger/fabric-gateway" could not be loaded: SyntaxError: Unexpected token '.'

Error while performing "test" step: Error: Module "#hyperledger/fabric-gateway" could not be loaded: SyntaxError: Unexpected token '.'
caliper benchmarking is throwing this issue:
hyperledger fabric 2.4.6
caliper-cli 0.5.0
fabric-SUT 2.2
npx caliper launch manager --caliper-workspace ./ --caliper-networkconfig networks/fabric/test-network.yaml --caliper-benchconfig benchmarks/scenario/simple/config.yaml --caliper-flow-only-test --caliper-fabric-gateway-enabled --caliper-fabric-gateway-discovery
2022.11.14-11:14:46.705 info [caliper] [cli-launch-manager] Set workspace path: /home/anita/fabric/caliper-benchmarks
2022.11.14-11:14:46.706 info [caliper] [cli-launch-manager] Set benchmark configuration path: /home/anita/fabric/caliper-benchmarks/benchmarks/scenario/simple/config.yaml
2022.11.14-11:14:46.706 info [caliper] [cli-launch-manager] Set network configuration path: /home/anita/fabric/caliper-benchmarks/networks/fabric/test-network.yaml
2022.11.14-11:14:46.706 info [caliper] [cli-launch-manager] Set SUT type: fabric
2022.11.14-11:14:46.741 info [caliper] [benchmark-validator] No observer specified, will default to `none`
2022.11.14-11:14:46.741 info [caliper] [caliper-engine] Starting benchmark flow
2022.11.14-11:14:46.742 info [caliper] [caliper-engine] Skipping start commands due to benchmark flow conditioning
2022.11.14-11:14:46.742 info [caliper] [caliper-engine] Skipping initialization phase due to benchmark flow conditioning
2022.11.14-11:14:46.742 info [caliper] [caliper-engine] Skipping install smart contract phase due to benchmark flow conditioning
2022.11.14-11:14:46.783 error [caliper] [caliper-engine] Error while performing "test" step: Error: Module "#hyperledger/fabric-gateway" could not be loaded: SyntaxError: Unexpected token '.'
Searched paths: /home/anita/node_modules/#hyperledger/caliper-fabric/node_modules/#hyperledger/caliper-core/lib/common/utils/node_modules,/home/anita/node_modules/#hyperledger/caliper-fabric/node_modules/#hyperledger/caliper-core/lib/common/node_modules,/home/anita/node_modules/#hyperledger/caliper-fabric/node_modules/#hyperledger/caliper-core/lib/node_modules,/home/anita/node_modules/#hyperledger/caliper-fabric/node_modules/#hyperledger/caliper-core/node_modules,/home/anita/node_modules/#hyperledger/caliper-fabric/node_modules/#hyperledger/node_modules,/home/anita/node_modules/#hyperledger/caliper-fabric/node_modules,/home/anita/node_modules/#hyperledger/node_modules,/home/anita/node_modules,/home/node_modules,/node_modules
at Function.loadModule (/home/anita/node_modules/#hyperledger/caliper-fabric/node_modules/#hyperledger/caliper-core/lib/common/utils/caliper-utils.js:118:19)
at Function.moduleIsInstalled (/home/anita/node_modules/#hyperledger/caliper-fabric/node_modules/#hyperledger/caliper-core/lib/common/utils/caliper-utils.js:181:26)
at _determineInstalledNodeSDKandVersion (/home/anita/node_modules/#hyperledger/caliper-fabric/lib/FabricConnectorFactory.js:45:22)
at CaliperEngine.connectorFactory [as adapterFactory] (/home/anita/node_modules/#hyperledger/caliper-fabric/lib/FabricConnectorFactory.js:132:17)
at CaliperEngine.run (/home/anita/node_modules/#hyperledger/caliper-cli/node_modules/#hyperledger/caliper-core/lib/manager/caliper-engine.js:149:64)
at Function.handler (/home/anita/node_modules/#hyperledger/caliper-cli/lib/launch/lib/launchManager.js:62:43)
at Object.module.exports.handler (/home/anita/node_modules/#hyperledger/caliper-cli/lib/launch/launchManagerCommand.js:46:44)
at Object.runCommand (/home/anita/node_modules/#hyperledger/caliper-cli/node_modules/yargs/lib/command.js:240:40)
at Object.parseArgs [as _parseArgs] (/home/anita/node_modules/#hyperledger/caliper-cli/node_modules/yargs/yargs.js:1154:41)
at Object.runCommand (/home/anita/node_modules/#hyperledger/caliper-cli/node_modules/yargs/lib/command.js:198:30)
2022.11.14-11:14:46.783 info [caliper] [caliper-engine] Skipping end command due to benchmark flow conditioning
2022.11.14-11:14:46.783 error [caliper] [cli-launch-manager] Benchmark failed with error code 6
Error: Benchmark failed with error code 6
at Function.handler (/home/anita/node_modules/#hyperledger/caliper-cli/lib/launch/lib/launchManager.js:70:23)
at processTicksAndRejections (internal/process/task_queues.js:97:5)

Hyperledger Caliper gateway error: Unexpected error during benchmark execution: Error: Please retry with the gateway flag

I am trying to run Hyperleger Caliper but I am getting the following error:
Unexpected error during benchmark execution: Error: Caliper currently only supports gateway based operation using the 2.1.0 Fabric-SDK. Please retry with the gateway flag
ubuntu#IoT-Node-00:~/caliper-benchmarks$ npx caliper launch manager --caliper-workspace . --caliper-benchconfig benchmarks/scenario/simple/config.yaml --caliper-networkconfig networks/fabric/v2/v2.1.0/2org1peergoleveldb_raft/fabric-go-tls-solo.yaml
2021.08.08-17:31:08.227 info [caliper] [cli-launch-manager] Set workspace path: /home/ubuntu/caliper-benchmarks
2021.08.08-17:31:08.230 info [caliper] [cli-launch-manager] Set benchmark configuration path: /home/ubuntu/caliper-benchmarks/benchmarks/scenario/simple/config.yaml
2021.08.08-17:31:08.231 info [caliper] [cli-launch-manager] Set network configuration path: /home/ubuntu/caliper-benchmarks/networks/fabric/v2/v2.1.0/2org1peergoleveldb_raft/fabric-go-tls-solo.yaml
2021.08.08-17:31:08.231 info [caliper] [cli-launch-manager] Set SUT type: fabric
2021.08.08-17:31:08.353 info [caliper] [benchmark-validator] No observer specified, will default to `none`
2021.08.08-17:31:08.354 info [caliper] [caliper-engine] Starting benchmark flow
2021.08.08-17:31:09.896 info [caliper] [fabric-connector] Initializing standard connector compatible with installed SDK: 2.1.0
2021.08.08-17:31:09.964 error [caliper] [cli-launch-manager] Unexpected error during benchmark execution: Error: Caliper currently only supports gateway based operation using the 2.1.0 Fabric-SDK. Please retry with the gateway flag
Usage:
caliper launch manager --caliper-bind-sut fabric:1.4 [other options]
Options:
--help, -h Show usage information [boolean]
--version Show version information [boolean]
--caliper-bind-sut The name and version of the platform to bind to [string]
--caliper-bind-cwd The working directory for performing the SDK install [string]
--caliper-bind-args Additional arguments to pass to "npm install". Use the "=" notation when setting this parameter [string]
--caliper-bind-file Yaml file to override default (supported) package versions when binding an SDK [string]
Error: Caliper currently only supports gateway based operation using the 2.1.0 Fabric-SDK. Please retry with the gateway flag
at _loadAppropriateConnectorClass (/home/ubuntu/caliper-benchmarks/node_modules/#hyperledger/caliper-fabric/lib/FabricConnectorFactory.js:79:19)
at CaliperEngine.connectorFactory [as adapterFactory] (/home/ubuntu/caliper-benchmarks/node_modules/#hyperledger/caliper-fabric/lib/FabricConnectorFactory.js:122:62)
at CaliperEngine.run (/home/ubuntu/caliper-benchmarks/node_modules/#hyperledger/caliper-core/lib/manager/caliper-engine.js:93:36)
at Function.handler (/home/ubuntu/caliper-benchmarks/node_modules/#hyperledger/caliper-cli/lib/launch/lib/launchManager.js:62:43)
at Object.module.exports.handler (/home/ubuntu/caliper-benchmarks/node_modules/#hyperledger/caliper-cli/lib/launch/launchManagerCommand.js:46:44)
at Object.runCommand (/home/ubuntu/caliper-benchmarks/node_modules/yargs/lib/command.js:240:40)
at Object.parseArgs [as _parseArgs] (/home/ubuntu/caliper-benchmarks/node_modules/yargs/yargs.js:1154:41)
at Object.runCommand (/home/ubuntu/caliper-benchmarks/node_modules/yargs/lib/command.js:198:30)
at Object.parseArgs [as _parseArgs] (/home/ubuntu/caliper-benchmarks/node_modules/yargs/yargs.js:1154:41)
at Object.get [as argv] (/home/ubuntu/caliper-benchmarks/node_modules/yargs/yargs.js:1088:21)
Try running the following commands,
npx caliper bind --caliper-bind-sut fabric:2.1
npx caliper launch manager --caliper-workspace . --caliper-benchconfig benchmarks/scenario/simple/config.yaml --caliper-networkconfig networks/fabric/v2/v2.1.0/2org1peergoleveldb_raft/fabric-go-tls-solo.yaml --caliper-flow-only-test --caliper-fabric-gateway-enabled
npx caliper launch manager --caliper-workspace . --caliper-benchconfig benchmarks/scenario/simple/config.yaml --caliper-networkconfig networks/fabric/v2/v2.1.0/2org1peergoleveldb_raft/fabric-go-tls-solo.yaml --caliper-flow-only-test --caliper-fabric-gateway-usegateway --caliper-fabric-gateway-discovery
See Setting up and Running a Performance Benchmark on an existing network

Is there any restriction on chaincode language for using Idemix in Hyperledger Fabric?

Using Idemix in Hyperledger Fabric to submit transactions
I have been exploring idemix in hyperledger fabric v2.2. I tried submitting transactions via peer cli as idemix identity but it returns me an error when chaincode is in Java or Javascript, but works when Go chaincode is used. So I want to know if there are any restrictions on the chaincode language to be used if idemix identities are used to submit transactions. Following are sections of logs received.
Error logs for java
Cli
Error: endorsement failure during invoke. response: status:500 message:"error in simulation: transaction returned with failure: Could not create new client identity"
Chaincode container
11:42:24:528 SEVERE org.hyperledger.fabric.Logger error Could not create new client identityorg.hyperledger.fabric.contract.ContractRuntimeException: Could not create new client identity
at org.hyperledger.fabric.contract.Context.<init>(Context.java:59)
... 11 more
Caused by: java.io.IOException: Empty input
at java.base/sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:106)
... 14 more
caused by ..Could not parse certificate: java.io.IOException: Empty input java.security.cert.CertificateException: Could not parse certificate: java.io.IOException: Empty input
at java.base/sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:110)
at java.base/java.security.cert.CertificateFactory.generateCertificate(CertificateFactory.java:355)
...
Peer container
2020-09-21 11:42:24.396 UTC [endorser] callChaincode -> INFO 06b finished chaincode: basic duration: 104ms channel=mychannel txID=5ec99579
2020-09-21 11:42:24.398 UTC [endorser] SimulateProposal -> ERRO 06c failed to invoke chaincode basic, error: transaction returned with failure: Could not create new client identity
github.com/hyperledger/fabric/core/chaincode.processChaincodeExecutionResult
/go/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:182
...
Error logs for javascript
Cli
Error: endorsement failure during invoke. response: status:500 message:"error in simulation: transaction returned with failure: Error: Failed to find start line or end line of the certificate."
Chaincode container
2020-09-22T08:41:44.648Z error [c-api:contracts-spi/chaincodefromcontract.js] [mychannel-a91f4fa4] Error: Failed to find start line or end line of the certificate.
2020-09-22T08:41:44.652Z error [c-api:lib/handler.js] [mychannel-a91f4fa4] Calling chaincode Invoke() returned error response [Error: Failed to find start line or end line of the certificate.
at normalizeX509 (/usr/local/src/node_modules/fabric-shim/lib/chaincode.js:387:15)
at new ClientIdentity (/usr/local/src/node_modules/fabric-shim/lib/chaincode.js:258:32)
at ChaincodeFromContract.invokeFunctionality (/usr/local/src/node_modules/fabric-shim/lib/contract-spi/chaincodefromcontract.js:354:35)
at ChaincodeFromContract.Invoke (/usr/local/src/node_modules/fabric-shim/lib/contract-spi/chaincodefromcontract.js:315:21)
at handleMessage (/usr/local/src/node_modules/fabric-shim/lib/handler.js:602:47)
at ChaincodeMessageHandler.handleTransaction (/usr/local/src/node_modules/fabric-shim/lib/handler.js:390:9)
at ClientDuplexStreamImpl.<anonymous> (/usr/local/src/node_modules/fabric-shim/lib/handler.js:330:30)
at ClientDuplexStreamImpl.emit (events.js:311:20)
at addChunk (_stream_readable.js:294:12)
at readableAddChunk (_stream_readable.js:275:11)]. Sending ERROR message back to peer
Peer container
2020-09-22 08:41:44.658 UTC [endorser] callChaincode -> INFO 06c finished chaincode: basic duration: 25ms channel=mychannel txID=a91f4fa4
2020-09-22 08:41:44.658 UTC [endorser] SimulateProposal -> ERRO 06d failed to invoke chaincode basic, error: transaction returned with failure: Error: Failed to find start line or end line of the certificate.
github.com/hyperledger/fabric/core/chaincode.processChaincodeExecutionResult
/go/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:182
...
Setup Info
fabric version: 2.2
idemix identities generated using idemixgen tool
X.509 identities generated using cryptogen tool
chaincode invoked using peer chaincode invoke command
chaincode: asset-transfer-basic
chaincode languages: java, javascript
repository link to fabric samples
using fabric deployment on docker compose
References
https://hyperledger-fabric.readthedocs.io/en/release-2.2/idemix.html
https://hyperledger-fabric.readthedocs.io/en/release-2.2/idemixgen.html
Yes, For the moment you can only use Idemix with go based chaincodes. As you wan see on the documentations of hyperledger fabric Idemix ,
The cid (Client Identity) library (for Go only) has been extended to
support the GetAttributeValue function when an Idemix credential is
used

What is Benchmark error code 4 in Hyperledger Caliper

error: [FabricCAClientService.js]: Failed to enroll admin, error:%o message=Could not parse enrollment response [Client sent an HTTP request to an HTTPS server.
] as JSON due to error [SyntaxError: Unexpected token C in JSON at position 0], stack=Error: Could not parse enrollment response [Client sent an HTTP request to an HTTPS server.
] as JSON due to error [SyntaxError: Unexpected token C in JSON at position 0]
at IncomingMessage.response.on (F:\SE\3rd_Year\FYP\Blockchain\hyperledger-template\hyperledger-caliper\node_modules\fabric-client\node_modules\fabric-ca-client\lib\FabricCAClient.js:475:21)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
2020.06.06-23:24:43.152 error [caliper] [caliper-engine] Error while performing "init" step: Error: Couldn't enroll Patient's registrar or set it as user context: Could not parse enrollment response [Client sent an HTTP request to an HTTPS server.
] as JSON due to error [SyntaxError: Unexpected token C in JSON at position 0]
2020.06.06-23:24:43.153 info [caliper] [caliper-engine] Executed "init" step in 0.527 seconds
2020.06.06-23:24:43.153 info [caliper] [caliper-engine] Network configuration attribute "caliper.command.end" is not present, skipping end command
2020.06.06-23:24:43.154 error [caliper] [cli-launch-master] Benchmark failed with error code 4
This is the output of the bash. I have no idea what causes this. My network has 3 organizations with 2 peers each and one orderer. And I have edited the fabic-node.yaml file to match the requirements.
IF anyone has any suggestions on what to do im all ears. Thank you
Basically, error code 4 is when you try to initialize connection with blockchain (SUT) but failed, error code 5 is when you fail to install smart contract and error code 6 is for other errors (e.g configuration)

hyperledger fabric calling enrollment endpoint failed with error

I was trying to deploy hyperledger fabric on multiple hosts using this code and used the balance transfer chaincode using node-SDK. While I tried to enroll the user, I got the following error:
[2019-01-10 18:12:20.635] [ERROR] Helper -
[FabricCAClientService.js]: Failed to enroll admin, error:Error:
Calling enrollment endpoint failed with error [Error: write EPROTO
140678895621952:error:140770FC:SSL
routines:SSL23_GET_SERVER_HELLO:unknown
protocol:../deps/openssl/openssl/ssl/s23_clnt.c:827:
]
at ClientRequest.request.on (/home/muzzam/Downloads/hlf-docker-swarm/hlf-app/node_modules/fabric-ca-client/lib/FabricCAClient.js:492:12)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at TLSSocket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at onwriteError (_stream_writable.js:417:12)
at onwrite (_stream_writable.js:439:5)
at _destroy (internal/streams/destroy.js:39:7)
at TLSSocket.Socket._destroy (net.js:568:3)
can anyone give me an idea of what could be going wrong? If you need any of my configuration file, i can provide that
I was able to find my error.
I was not setting the TLS enabled parameter in docker containing CA service.
You need to set the following properties in yaml file containg the CA services:
environment:
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_TLS_CERTFILE=<location to certificate file>
- FABRIC_CA_SERVER_TLS_KEYFILE=<location to key file>

Resources