[Ethereum] unable to connect Ethereum node even RPC port: 8545 is open

go-ethereumjson-rpcnodejsnodesweb3js

I have created my private Ethereum blockchain network. From different servers I am able to connected and added into the network as peer without any problem.

The way I run my server:

geth --targetgaslimit "994712388" --port 3000 --networkid 23422 --identity node1 
--verbosity 3 --nodiscover --nat none --datadir="/home/miner/MyEthereumEbloc" 
--rpccorsdomain '*' --rpc --rpcaddr "localhost" --
rpcport="8545" --nodiscover --maxpeers=6 --ipcapi "admin,eth,web3" --autodag

As you can see the RPC port is open:

$ telnet localhost 8545
Trying 127.0.0.1...
Connected to localhost.

Inside my geth console:

> admin.startRPC("127.0.0.1", 8545, "*", "web3,net,eth")
HTTP RPC already running on localhost:8545

http://localhost:8545 is the RPC port of my locally running Ethereum node software. But on my browser at http://localhost:8545 I am seeing the following error:

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

Inside the geth console, where I run my bootstrap node; I am running the following code in order to communicate to my local node:

var Web3 = require("web3");
var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));
web3.isConnected()   //returns false

But web3.isConnected() keeps return false.

[Q] I know there is many documentation related to web3 connection to the local node and I have followed all the suggestions. But I am not able the fix the web3 connection problem I am facing. How could I fix this problem? Thank you for your valuable time and help.

I have done the suggestions from following questions:
How to connect a web site to a geth node?, https://forum.ethereum.org/discussion/3414/step-by-step-guide-to-connect-a-web-site-to-a-geth-node, https://gitter.im/ethereum/web3.js/archives/2015/12/31.

Best Answer

EDIT: For other users reading this: The solution is to find in the comments of this answer - launching parameters were wrong.

http requests to the node are not supposed to return anything of use, it's totally fine that you get that response in your browser. Assuming you want to develop a dApp for your private chain, i recommend using https://github.com/ConsenSys/truffle - you tell truffle to communicate with your node, and then it handles all the communication between your website and your private chain. the documentation is really useful: https://truffle.readthedocs.io/en/latest/

Have fun ! :)