I'm using these instructions from etherchain. Here's a similar question(seems like duplicate, but it's not). The solution provided there doesn't work for me, because I don't have a local ethereum client to connect to. I want to use one provided by Etherchain.

const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider("http://rpc.ethapi.org:8545"));
web3.eth.getBlock("latest", (error, result) => {
  console.log('error:', error);
  console.log('results', result);


Error: Invalid JSON RPC response: ""
   at Object.InvalidResponse (/home/manid/Рабочий стол/Pogovorim/NODE_SERVER/node_modules/web3/lib/web3/errors.js:35:16)
    at XMLHttpRequest.request.onreadystatechange (/home/manid/Рабочий стол/Pogovorim/NODE_SERVER/node_modules/web3/lib/web3/httpprovider.js:116:32)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/manid/Рабочий стол/Pogovorim/NODE_SERVER/node_modules/xhr2/lib/xhr2.js:64:18)
    at XMLHttpRequest._setReadyState (/home/manid/Рабочий стол/Pogovorim/NODE_SERVER/node_modules/xhr2/lib/xhr2.js:354:12)
    at XMLHttpRequest._onHttpRequestError (/home/manid/Рабочий стол/Pogovorim/NODE_SERVER/node_modules/xhr2/lib/xhr2.js:544:12)
    at ClientRequest.<anonymous> (/home/manid/Рабочий стол/Pogovorim/NODE_SERVER/node_modules/xhr2/lib/xhr2.js:414:24)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:309:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1281:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

What am I missing?

  • 1
    Your solution is probably in here. ethereum.stackexchange.com/questions/2080/…
    – tayvano
    Commented Jan 10, 2017 at 11:45
  • @tayvano, thank you! That solution doesn't work for me, because I'm connecting to a remote host and the solution provided there is for connection to geth node running on local machine.
    – manidos
    Commented Jan 10, 2017 at 12:10

1 Answer 1


I've replaced

const web3 = new Web3(new Web3.providers.HttpProvider("http://rpc.ethapi.org:8545"));


const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/TOKEN"));

and everything works.

This https://ropsten.infura.io/TOKEN was given to me after registration on infura.io

  • 1
    Seems like rpc.ethapi.org is down: isup.me/rpc.ethapi.org Commented Jan 10, 2017 at 14:05
  • I have tried what you suggested to connect to ropsten but i get an error Error: Invalid JSON RPC response: "" at Object.module.exports.InvalidResponse (/Blockchain/node_modules/web3/lib/web3/errors.js:35:16) at HttpProvider.send (/Blockchain/node_modules/web3/lib/web3/httpprovider.js:91:22) at RequestManager.send (/Blockchain/node_modules/web3/lib/web3/requestmanager.js:58:32) at Eth.send [as sendTransaction] (/Blockchain/node_modules/web3/lib/web3/method.js:145:58) at SolidityFunction.sendTransaction (/Blockchain/node_modules/web3/lib/web3/function.js:148:26) at SolidityFunction.execute (/Blo Commented Jun 15, 2017 at 14:20
  • i think u mean ropsten.infura.io/[API_KEY]? to avoid the confusion to token smart contract....
    – Richard Fu
    Commented Jun 21, 2018 at 0:53

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