Instantiate web3 to work with the real Ethereum network

Sophia: 5 weeks ago

I know how to instantiate web3 to work with a local test network:

var web3Instance =  new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

How do I change this code to connect to the real network?

Elijah: 5 weeks ago

That is how you connect to a real network, with web3.

The difference, however, is that instead of connecting to a testrpc (or Parity or Geth) node running a local, private network exposing an RPC interface, that instead you connect to a client connected to one of the test networks (or mainnet).

In the case of using HttpProvider, just start your client with the necessary JSON RPC ( interfaces exposed.

The documentation on the Ethereum wiki ( gives you examples for a number of different clients.