我试图在我的网站后端使用https://github.com/kesar/ethereum-php。
我按照教程http://iotbl.blogspot.ca/2017/03/setting-up-private-ethereum-testnet.html在UbuntuServer16.04上建立了两个本地链。
这就是geth版本打印的内容:
Geth
Version: 1.8.2-stable
Git Commit: b8b9f7f4476a30a0aaf6077daade6ae77f969960
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.9.4
Operating System: linux
GOPATH=
GOROOT=/usr/lib/go-1.9我就是这样开始锁链的:
geth无发现-详细的9-networkid 50000 -端口50000 -datadir Chain02 01/控制台geth -无发现-详细的9-networkid 50000 -端口50001 -datadir Chain02 02/控制台
我能够为chain2添加一个对等终端,并命令net.peerCount按预期显示1。
通过这种工作,我试图通过https://github.com/kesar/ethereum-php/blob/master/README.md,并遇到了一个超时。这是我的PHP代码:
$client = new EthereumClient('http://127.0.0.1:50000');
$iBlockNum = $client->eth()->blockNumber() ;这就是我在geth日志中看到的:
TRACE[03-08|15:56:06] Accepted connection addr=127.0.0.1:43610
TRACE[03-08|15:56:11] Failed RLPx handshake addr=127.0.0.1:43610 conn=inbound err="read tcp 127.0.0.1:50000->127.0.0.1:43610: i/o timeout"
TRACE[03-08|15:56:11] Setting up connection failed id=0000000000000000 err="read tcp 127.0.0.1:50000->127.0.0.1:43610: i/o timeout"这就是wireshark所显示的从端口43610发送到端口50000的情况:
{"jsonrpc":"2.0",“方法”:“eth_blockNumber”,"id":83}
但是端口50000没有回复。
我正在Eclipse中调试的另一个细节。不确定它是否能影响互动。
另一件事:当我连接到http://truffleframework.com/ganache/时,上面的php代码工作得很好。
发布于 2018-03-11 19:57:40
我犯了个错误。下面是允许php客户端连接的选项:
geth --nodiscover --verbosity 9 --networkid 50000 --datadir ./Chain01/ --rpcvhosts "127.0.0.1,::1" --rpc --rpcapi db,eth,net,web3,personal --cache=1024 --rpcport 50000 --rpcaddr 127.0.0.1 --rpccorsdomain "*" https://ethereum.stackexchange.com/questions/42275
复制相似问题