使用 Truffle 在 Cloud9 中工作的以太坊测试 RPC

Ethereum Test RPC working in Cloud9 with Truffle

有人知道如何让以太坊测试 RPC 在 Cloud9 上运行吗?我可以 运行 truffle serve 并在端口 8080 上查看结果。但是当我尝试 testrpc -p 8081 时,我的 truffle 应用程序无法访问 testrpc。我还配置了我的 truffle app.json 指向 8081 而不是默认的 8545。

编辑: 当我按照@Justin 的建议尝试 netstat -tulpn 时,我得到以下信息:

(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      -

编辑: 好的,这是我的新尝试:

  1. testrpc --port 8081 --domain 0.0.0.0
    这似乎在 public 接口
  2. 上正确启动了 testrpc 客户端
  3. 更新 app.json 以包含
    "rpc":{ "host": "localhost", "port": 8081 }
  4. truffle deploy
  5. 更新 app.json 以包含
    "rpc":{ "host": "project-user.c9users.io", "port": 8081 }
  6. truffle serve
  7. 打开浏览器http://project-user.c9users.io
  8. 收到JavaScript错误Uncaught Error: CONNECTION ERROR: Couldn't connect to node http://project-user.c9users.io:8081.

新 '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      -

编辑: 我 运行 Wireshark 在浏览器通信上,当 JavaScript 尝试与 testrpc 通信时我得到了它。我得到一个 302 Moved Temporarily,位置 https://c9users.io:8081/_user_content/authorize?redirect=http%3A%2F%2Fproject-user.c9users.io%2F。这个问题似乎在 https://community.c9.io/t/url-to-running-code-gets-stuck-on-authentication/142.

没有得到解决

这是 Cloud9 的错误。 .

回答了这个问题

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.