1
const Web3 = require('web3')



//var web3 = new Web3('http://127.0.0.1:8585');
var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));
//  https://rinkeby.infura.io/v3/a4ba0f8e6dbf4ef78e2a0ab377767ebb

const besucheck = async () => {
    //console.log('account ',await web3.eth.getAccounts());
    let blockcount = await web3.eth.getBlockNumber();
    let count = 0;
    //let blockcount = 10721114;
    //for (let x = blockcount; x > blockcount-5; x--) {
        console.log("hii");
        console.log(blockcount);
        


};

besucheck();

that was my code and my consortium block chain network is runing absolutly fine. Irrespective to whether the network running or not I am receiving this error

UnhandledPromiseRejectionWarning: Error: Invalid JSON RPC response: ""
    at Object.InvalidResponse (D:\UQEducation\Networking\besutest\node_modules\web3-core-helpers\src\errors.js:42:16)
    at XMLHttpRequest.request.onreadystatechange (D:\UQEducation\Networking\besutest\node_modules\web3-providers-http\src\index.js:98:32)
    at XMLHttpRequestEventTarget.dispatchEvent (D:\UQEducation\Networking\besutest\node_modules\xhr2-cookies\dist\xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (D:\UQEducation\Networking\besutest\node_modules\xhr2-cookies\dist\xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpRequestError (D:\UQEducation\Networking\besutest\node_modules\xhr2-cookies\dist\xml-http-request.js:349:14)
    at ClientRequest.<anonymous> (D:\UQEducation\Networking\besutest\node_modules\xhr2-cookies\dist\xml-http-request.js:252:61)
    at ClientRequest.emit (events.js:198:13)
    at Socket.socketErrorListener (_http_client.js:392:9)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:11480) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11480) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2
  • 1
    What command line did you use to launch besu? Did you enable RPC interface? Is the RPC port correct?
    – Ismael
    Aug 25 '20 at 4:11
  • Yaa That I did. I am sure
    – Bharadwaj
    Sep 8 '20 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.