Currently I am trying to build private dapp using ganache-cli as a blockchain backend with aws ec2 instance.

I get the expected result when ssh from another shell.


curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' localhost:8545


{"id":67,"jsonrpc":"2.0","result":"EthereumJS TestRPC/v2.10.2/ethereum-js"}

Here is my VPC setting for 8545 port:

enter image description here

Also netstat command result:

ubuntu@ip-192-168-0-102:~$ netstat -an | grep 8545
tcp        0      0*               LISTEN

However, I get following error when I set up MetaMask's custom rpc like: {MY_PUBLIC_IP}:8545 even though my ganache docker (and ipfs) is running. Is there anything that I am missing?

inpage.js:1 MetaMask - RPC Error: JsonRpcEngine: Response has no error or result for request:
  "id": 1852126408,
  "jsonrpc": "2.0",
  "method": "eth_chainId",
  "params": [],
  "origin": "{MY_PUBLIC_IP_HERE}"

WebSocket connection to 'ws://{MY_PUBLIC_IP_HERE}/' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT

and here is my docker-compose setting:

version: "3"
    image: trufflesuite/ganache-cli:latest
      - ""
      - ""
    - node
    - /app/ganache-core.docker.cli.js
    - --deterministic
    - --db=/ganache_data
    - --mnemonic
    - 'minimum symptom minute gloom tragic situate silver mechanic salad amused elite beef'
    - --hostname
    - ''
    restart: always
    build: ./ipfs
      - ""
      - ""
      - ""
      - ""
      - ""
    restart: always

1 Answer 1


You said you are setting up your set up MetaMask's custom rpc as: {MY_PUBLIC_IP}:8545, while I can see your ganache and IPFS are set to your localhost.

Try setting Metamask to the same IP as your localhost: Hope this helps.

  • Sorry for the confusion. Ganache is set up on AWS cloud, not my local laptop. it's a similar situation like this post : medium.com/nxtplus/…
    – user76333
    Jun 30, 2020 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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