[Ethereum] Cannot access geth by JSON-RPC. It returns {“jsonrpc”:”2.0″,”error”:{“code”:-32600,”message”:”EOF”}}

go-ethereumjson-rpc

I've tried to access geth by rpc.

$ geth --dev --datadir mydir --rpc --rpcaddr "localhost" --rpcport "8545" --rpccorsdomain "*" console

However it has returned the error. Could you tell me how to solve the problem?

{"jsonrpc":"2.0","error":{"code":-32600,"message":"EOF"}}

Update
I've got connected by rpc, however on the browser-solidity I cannot connect my private node.

enter image description here

Best Answer

I suspect it is the command you are using.

This works:

user@Kumquat:~$ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' http://localhost:8545
{"jsonrpc":"2.0","id":1,"result":{"currentBlock":"0x1eb260","highestBlock":"0x1eb478","knownStates":"0x0","pulledStates":"0x0","startingBlock":"0x1eaea3"}}

And this does not work:

user@Kumquat:~$ curl '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' http://localhost:8545
curl: (3) [globbing] nested brace in column 50
{"jsonrpc":"2.0","error":{"code":-32600,"message":"EOF"}}

Here are some simple commands you can test with:

user@Kumquat:~$ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_coinbase","params":[],"id":1}' http://localhost:8545
{"jsonrpc":"2.0","id":1,"result":"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}

user@Kumquat:~$ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":1}' http://localhost:8545
{"jsonrpc":"2.0","id":1,"result":"0x4a817c800"}
Related Topic