Search code examples
cloud9-ideethereum

Ethereum Test RPC working in Cloud9 with Truffle


Does anybody know how to get the Ethereum Test RPC to work on Cloud9? I can run truffle serve and see the result on port 8080. But when I try testrpc -p 8081, my truffle application can't access testrpc. I have also configured my truffle app.json to point to 8081 instead of the default 8545.

Edit: When I try netstat -tulpn as @Justin suggested, I get the following:

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:8081          0.0.0.0:*               LISTEN      2926/python     
tcp6       0      0 :::8080                 :::*                    LISTEN      2906/node       
tcp6       0      0 :::22                   :::*                    LISTEN      -

Edit: Ok, here is my new attempt at this:

  1. testrpc --port 8081 --domain 0.0.0.0
    This seems to properly start the testrpc client on the public interface
  2. Update the app.json to contain
    "rpc": { "host": "localhost", "port": 8081 }
  3. truffle deploy
  4. Update the app.json to contain
    "rpc": { "host": "project-user.c9users.io", "port": 8081 }
  5. truffle serve
  6. Open browser to http://project-user.c9users.io
  7. Receive JavaScript error Uncaught Error: CONNECTION ERROR: Couldn't connect to node http://project-user.c9users.io:8081.

The new 'netstat -tulpn' returns:

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:8081            0.0.0.0:*               LISTEN      1194/python     
tcp6       0      0 :::8080                 :::*                    LISTEN      1581/node       
tcp6       0      0 :::22                   :::*                    LISTEN      -

Edit: I ran Wireshark on the browser communication and am getting this back when the JavaScript tries to communicate with testrpc. I get a 302 Moved Temporarily with location https://c9users.io:8081/_user_content/authorize?redirect=http%3A%2F%2Fproject-user.c9users.io%2F. This issue seems to have gone unresolved at https://community.c9.io/t/url-to-running-code-gets-stuck-on-authentication/142.


Solution

  • This is a bug with Cloud9. This was answered at XMLHttpRequest cannot load cloud 9 io.

    This is a temporary bug that arose as a result of changing the app preview URL from c9.io to c9users.io. The change was made in order to protect users and increase security. A fix will be out for this soon.

    In the meantime you can set your application to public (your code will still be private and undiscoverable) by clicking "Share" in the top right and then checking the box next to your application URL.