I am stuck with a weird situation. I create a local Ethereum network with Hyperledger Besu in docker environment. I try to deploy contracts to a rpc node using Truffle(different container in same docker network).

1.) When I have static IP configured for Besu nodes in the docker-compose, and I use the service name in truffle, contract deployment goes through fine.

2.) If I do not configure static IPs, in the docker-compose, for some reason the contract deployment is stuck. Why?

I have tried to see if there is network connectivity issue. Pinged the Besu node via hostname and IP(dynamically allocated by docker) which went through. Here's the trailing logs I see, post which it is indefinitely stuck -

truffle-envt-besu-setup |
truffle-envt-besu-setup | 1_initial_migration.js
truffle-envt-besu-setup | ======================
truffle-envt-besu-setup |
truffle-envt-besu-setup | Deploying 'Migrations'
truffle-envt-besu-setup | ----------------------
truffle-envt-besu-setup | > transaction hash: 0x1a673f0f62c4f0690eb444d4922cd257b16f72bfff3e4d0362a50f3f9353ede6
truffle-envt-besu-setup | - Blocks: 0 Seconds: 0

Here's a snippet of the docker-compose -

    image: hyperledger/besu:1.3.9
    command: >-
      --data-path=/var/lib/besu --genesis-file=/var/lib/besu/genesis.json --rpc-http-enabled 
      --rpc-http-host= --rpc-ws-enabled --rpc-ws-host= --discovery-enabled=false 
      --p2p-host= --rpc-http-api=ETH,NET,WEB3,DEBUG,MINER,ADMIN,TXPOOL,CLIQUE 
      --rpc-ws-api=ETH,NET,WEB3,DEBUG,MINER,ADMIN,TXPOOL,CLIQUE --rpc-http-cors-origins='*' 
      --host-whitelist='*' --min-gas-price=0
      - 8545:8545
      - 8546:8546
      - './besu/node2:/var/lib/besu'

    image: pegasyseng/ethsigner:0.4.0
    command: >-
      --chain-id=12345 --downstream-http-host=node2.eth.local --downstream-http-port=8545 
      --http-listen-host= --http-listen-port=8555 file-based-signer 
      --password-file=/var/lib/ethsigner/password.txt --key-file=/var/lib/ethsigner/keystore/account.txt
      - 8555:8555
      - './ethsigner/node2:/var/lib/ethsigner'
      - node2.eth.local

    driver: bridge

Here's a snippet of the truffle-config.js file -

     besu_docker: {     
            host: "rpc.node2.eth.local", 
            network_id: "*",
            port: 8555,
            gas: 4500000,
            gasPrice: 0

Is there something obvious I am missing?


I think you have an error in your truffle-config.js The port should be 8545 instead of 8555.

| improve this answer | |
  • Hey thanks @Abdelhamid for looking through. But that's not an issue as it works perfectly fine with the same ports for a dynamic IP. On a second note, I have realized that the static IP has something to do with the configuration in the genesis.json file. Once I have clarity, I will post a resolution here. – Rajeev Ranjan May 15 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.