有人知道如何让以太坊测试 RPC 在 Cloud9 上运行吗?我可以truffle serve
在 8080 端口上运行并查看结果。但是当我尝试时testrpc -p 8081
,我的 truffle 应用程序无法访问 testrpc。我还将松露 app.json 配置为指向 8081 而不是默认的 8545。
编辑:当我netstat -tulpn
按照@Justin 的建议尝试时,我得到以下信息:
(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 -
编辑:好的,这是我的新尝试:
testrpc --port 8081 --domain 0.0.0.0
这似乎可以在公共接口上正确启动 testrpc 客户端- 更新 app.json 以包含
"rpc": { "host": "localhost", "port": 8081 } truffle deploy
- 更新 app.json 以包含
"rpc": { "host": "project-user.c9users.io", "port": 8081 } truffle serve
- 打开浏览器到http://project-user.c9users.io
- 收到 JavaScript 错误
Uncaught Error: CONNECTION ERROR: Couldn't connect to node http://project-user.c9users.io:8081.
新的“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 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
with location 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没有得到解决。