2

web3.isConnected() has issue. When connecting to an IPC node


I think it is waiting for something because when i starting my nodejs program nothing happens,

I am running ethereum node and try to connect with my Dapp
But there is some problem with my rpc connection that is web3.isConnected() is not returning anything
It should return true or false

2 Answers 2

2

If you have MetaMask installed and using it, select custom RPC and put http://localhost:4000.

In case of MetaMask, call new Web3 instance, web3js(or anything else), as web3 is already defined.

if (typeof web3 !== 'undefined') 
{
    web3js = new Web3(web3.currentProvider);
}
else {
    web3js = new Web3(new Web3.providers.HttpProvider('http://localhost:4000'));
}
2

web3.isConnected() has issue. When connecting to an IPC node, it will always hang up if that IPC node is up and running but PORT is not OPEN

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.