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 -
node2.eth.local:
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=0.0.0.0 --rpc-ws-enabled --rpc-ws-host=0.0.0.0 --discovery-enabled=false
--p2p-host=0.0.0.0 --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
ports:
- 8545:8545
- 8546:8546
volumes:
- './besu/node2:/var/lib/besu'
networks:
local_net:
rpc.node2.eth.local:
image: pegasyseng/ethsigner:0.4.0
command: >-
--chain-id=12345 --downstream-http-host=node2.eth.local --downstream-http-port=8545
--http-listen-host=0.0.0.0 --http-listen-port=8555 file-based-signer
--password-file=/var/lib/ethsigner/password.txt --key-file=/var/lib/ethsigner/keystore/account.txt
ports:
- 8555:8555
volumes:
- './ethsigner/node2:/var/lib/ethsigner'
depends_on:
- node2.eth.local
networks:
local_net:
networks:
local_net:
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?