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

var coinbase = web3.eth.coinbase;

However, I'm getting a provider not set or valid error. Who exactly is the provider here. Briefly, how do I bind my web3.js to my running geth client?

1 Answer 1


Where did your web3 object come from? It needs to be constructed with a Provider that tells it how to connect to an Ethereum node, like this:

var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));

  • How do i fifure out which ethereum node? Sorry, I'm new at this!
    – pd176
    Feb 10, 2016 at 5:04
  • you can use the test net. if you buy ether you can use production. Or you can download geth and run it. if you are impatient like me you can patch and build geth to quickly mine transactions for test purposes
    – Paul S
    Feb 10, 2016 at 5:20
  • I have a geth node running on testnet. What parameter do I pass as the Provider?
    – pd176
    Feb 10, 2016 at 5:25
  • 1
    By default Geth will use port 8545, so for provider use: http://localhost:8545
    – eth
    Feb 10, 2016 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.