From the EOS-js readme, I've followed the instructions approximately. My understand is I do not need a signature for calls for data as I am not transacting. Fine, but what I do not understand is the new JsonRPC instance. It returns a net::ERR_CONNECTION_REFUSED error.

Is the localhost string in this instance just filler text? Or is the eosjs library that I am importing actually spinning up a local instance of or node connecting to the EOS chain and from that local server I am supposed to retrieve data?

import { JsSignatureProvider } from 'eosjs/dist/eosjs-jssig';  // development only
const defaultPrivateKey = "5JtUScZK2XEp3g9gh7F8bwtPTRAkASmNrrftmx4AxDKD5K4zDnr"; // bob
const fetch = require('node-fetch'); 

const signatureProvider = new JsSignatureProvider([defaultPrivateKey]);
const rpc = new JsonRpc('', { fetch });
const api = new Api({ rpc, signatureProvider }); //required to submit transactions

(async () => { 
  await console.log(rpc.get_block(1)); //get the first block


1 Answer 1


You need to put this line in ~/.local/share/eosio/nodeos/config/config.ini file

http-server-address =

And restart nodeos pkill nodeos and start again.

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.