0

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.

request:

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

response:

{"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 127.0.0.1:8545          0.0.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"
services:
  ganache:
    image: trufflesuite/ganache-cli:latest
    ports:
      - "127.0.0.1:8545:8545"
      - "127.0.0.1:8546:8546"
    entrypoint:
    - 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
    - '0.0.0.0'
    restart: always
  ipfs:
    build: ./ipfs
    ports:
      - "127.0.0.1:4001:4001"
      - "127.0.0.1:4002:4002/udp"
      - "127.0.0.1:5001:5001"
      - "127.0.0.1:8080:8080"
      - "127.0.0.1:8081:8081"
    restart: always
0

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: 127.0.0.1:8545. Hope this helps.

| improve this answer | |
  • 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/… – kphex Jun 30 at 12:32

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.