kesar / ethereum-php

Ethereum Client in PHP
103 stars 50 forks source link

Failed RLPx handshake #7

Closed notreadyyet closed 6 years ago

notreadyyet commented 6 years ago

Hi, pardon a question of a naive newbie: I am probably overlooking some simple configuration setting. I am following a tutorial http://iotbl.blogspot.ca/2017/03/setting-up-private-ethereum-testnet.html to set up two local chains on Ubuntu Server 16.04. This is what geth version prints: 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

This is how I start the chains: geth --nodiscover --verbosity 9 --networkid 50000 --port 50000 --datadir Chain01/ console geth --nodiscover --verbosity 9 --networkid 50000 --port 50001 –datadir Chain02/ console

I am able to add a peer inside terminal for chain2 and command net.peerCount displays 1 as expected.

With that working I tried to go through README.md and ran into a timeout. This is my PHP code: $client = new EthereumClient('http://127.0.0.1:50000'); $iBlockNum = $client->eth()->blockNumber() ;

This is what I see in the geth’s log: 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"

This is what wireshark shows as being sent from port 43610 to port 50000: {"jsonrpc":"2.0","method":"eth_blockNumber","id":83} but port 50000 does not reply.

One other detail I am debugging in Eclipse oxygen. Not sure whether it can affect the interaction. Another thing: the php code above works fine when I connect to Ganache.

Thank you.

notreadyyet commented 6 years ago

I've made a fool of myself. Here are the options that allow php client to connect: 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 "*"

digitaldonkey commented 6 years ago

It's a complicated matter ;) For development I recommend Truffles Ganache/ client. But testing on a real GETH client is a very good idea in the current state.