hyperledger-caliper / caliper

A blockchain benchmark framework to measure performance of multiple blockchain solutions https://wiki.hyperledger.org/display/caliper
https://hyperledger-caliper.github.io/caliper/
Apache License 2.0
654 stars 404 forks source link

Error while performing "init" step: Error: connection not open #1242

Open 0x3N3jVhPUV opened 2 years ago

0x3N3jVhPUV commented 2 years ago

Which Caliper version are you using?

v0.4.0

Which Node.JS version are you using?

v10

Which operating system are you using?

Ubuntu 20.04 lts

Please provide some context for your error. For example, when did the error occur? What were you trying to achieve, and how?

Hello, I am new to Hyperledger Caliper and I would like to benchmark my Besu (IBFT2) private network by adding the URL (websocket) of its RPC endpoint, in the networkconfig.json located in networks/ethereum/1node-clique.

What was the observed incorrect behavior?

When I am trying to launch caliper, I’m gettting an error message which indicates that Caliper cannot communicate with my private network. Logs seem to indicate that Caliper cannot communicate with my private network and I don't understand why since my private network is running.

Please provide the error logs and their surroundings.

Here are the logs: 

2022.02.25-00:22:34.962 error [caliper] [caliper-engine]        Error while performing "init" step: Error: connection not open
2022.02.25-00:22:35.818 error [caliper] [cli-launch-manager]    Benchmark failed with error code 4

Please provide your network configuration file content, if possible.

Here is my networkconfig.json:

{
    "caliper": {
        "blockchain": "ethereum",
        "command" : {
            "start": "sudo docker-compose -f ./networks/ethereum/1node-clique/docker-compose.yml up -d && sleep 60s",
            "end" : "sudo docker-compose -f ./networks/ethereum/1node-clique/docker-compose.yml down"
          }
    },
    "ethereum": {
        "url": "ws://XX.XXX.XXX.XXX",
        "contractDeployerAddress": "0xc0A8e4D217eB85b812aeb1226fAb6F588943C2C2",
        "contractDeployerAddressPassword": "password",
        "fromAddress": "0xc0A8e4D217eB85b812aeb1226fAb6F588943C2C2",
        "fromAddressPassword": "password",
        "transactionConfirmationBlocks": 2,
        "contracts": {
            "simple": {
                "path": "./src/ethereum/simple/simple.json",
                "estimateGas": true,
                "gas": {
                    "query": 100000,
                    "transfer": 70000
                }
            }
        }
    }
}

Please provide any additional information you deem relevant to the error.

Here are the commands that I’m using:

npm init -y
npm install --only=prod \ @hyperledger/caliper-cli@0.4.0
npx caliper launch manager \
    --caliper-bind-sut besu:latest \
    --caliper-workspace . \
    --caliper-benchconfig benchmarks/scenario/simple/config.yaml \
    --caliper-networkconfig networks/ethereum/1node-clique/networkconfig.json
davidkel commented 2 years ago

see https://github.com/hyperledger/caliper-benchmarks/issues/172 it may provide some help

0x3N3jVhPUV commented 2 years ago

Hello @davidkel,

Thank you very much for your answer!

It working fine with "ws://localhost:8546" !

However, when I reproduce the same steps, in order to benchmark my Besu private network by adding the URL ( "ws://xx.xxx.xxx.xxx:8546") of its RPC endpoint, I get an error code 5. I failed to install smart contract but I don't understand why since the contractDeployerAddress and the contractDeployerAddressPrivateKey that I'm using are coming from the genesis.json of my private network.

Last, I'd like to mention that I didn't merge all commands into a single one.

I wonder what I did wrong.

Here are the logs I get, after running the command to benchmark the simple scenario:

2022.03.03-19:39:42.308 info  [caliper] [ethereum-connector]    Creating contracts...
**2022.03.03-19:41:51.662 error [caliper] [caliper-engine]        Error while performing "install" step: Error: connection not open on send()**
2022.03.03-19:41:51.663 info  [caliper] [caliper-engine]        Executed "install" step in 129.355 seconds
2022.03.03-19:41:51.663 info  [caliper] [caliper-engine]        Skipping end command due to benchmark flow conditioning
**2022.03.03-19:41:51.664 error [caliper] [cli-launch-manager]    Benchmark failed with error code 5**

Here is my networkconfig.yml

{
    "caliper": {
        "blockchain": "ethereum",
        "command" : {
            "start": "sudo docker-compose -f ./networks/besu/1node-clique/docker-compose.yml up -d && sleep 60",
            "end" : "sudo docker-compose -f ./networks/besu/1node-clique/docker-compose.yml down"
          }
    },
    "ethereum": {
        "url": "ws://xx.xxx.xxx.xxx:8546",
        "contractDeployerAddress": "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "contractDeployerAddressPrivateKey": "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "fromAddressSeed": "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "transactionConfirmationBlocks": 2,
        "contracts": {
            "simple": {
                "path": "./src/ethereum/simple/simple.json",
                "estimateGas": true,
                "gas": {
                    "query": 100000,
                    "transfer": 70000
                }
            }
        }
    }
}
stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

haerker commented 7 months ago

hello @0x3N3jVhPUV I recently encountered the same issue. How did you resolve it?

victorma17 commented 2 weeks ago

Same issue here, some solution?