[Ethereum] web3 methods not implemented

go-ethereumjavascriptweb3js

I'm running a geth node on the testnet and trying to run web3.js method from my node server code.

Here's my code

var Web3 = require("web3");
var web3 = new Web3(new Web3.providers.HttpProvider('http://0.0.0.0:8545'));
console.log(web3.net.peerCount);

However, I'm getting net_peerCount method not implemented error.

Infact, I'm getting a similar method not implemented error when I try to access any net or eth methods.

Any help appreciated!

Best Answer

I got it working by running the command i found in the docs https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console#adminstartrpc

admin.startRPC("127.0.0.1", 8545, "*", "web3,db,net,eth")

from my geth console!

Thanks for the suggestions :)