0

I am trying to use https://github.com/kesar/ethereum-php on the back-end of my web site.

I followed 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 https://github.com/kesar/ethereum-php/blob/master/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 http://truffleframework.com/ganache/.

  • 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 "*" – user34340 Mar 10 '18 at 23:48
  • You should add your comment as an answer. – Ismael Mar 11 '18 at 17:47
1

I've made a mistake. 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 "*"   

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy