1

I just installed Parity (1.8.2) and made sure that it is fully synced, and am running into a couple of weird issues. (I installed Parity on a MacBook via Homebrew, config is all at default values)

  1. I can connect to my local node using MetaMask via http://localhost:8545, but cannot connect to it using MEW (downloaded/offline version). I keep getting this error:

Could not connect to the node. Refresh your page, try a different node (upper right corner), check your firewall settings. If custom node, check your configs.

I notice that I've a similar issue as described here: https://github.com/kvhnuke/etherwallet/issues/922, I don't see a Request Payload.

  1. When using Parity's Javascript console, commands like web3.eth.blockNumber, web3.eth.syncing all work and return values. However, when I install web3.js via npm, and then run the following:

var Web3 = require('web3'); var web3 = new Web3(); web3.setProvider(new web3.providers.HttpProvider('http://127.0.0.1:8545'));

Commands like web3.eth.blockNumber all return undefined. However, web3.eth.getBlockNumber().then(console.log); returns a value.

Thanks for the help!

Update: I've also tried all of the below commands (or combination of them):

parity --jsonrpc-cors '*' --jsonrpc-hosts all --jsonrpc-interface all

parity --jsonrpc-cors '*' --jsonrpc-hosts all --jsonrpc-interface all --rpccorsdomain 127.0.0.1

None of them work. MEW is throwing this error (in Console):

index.html:1 Failed to load http://127.0.0.1:8545/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

1

In the end, parity --jsonrpc-cors null did the trick. It disables CORS though AFAIK, but now my local MEW is able to connect to my local parity.

However, when using web3.js, I am still getting undefined, e.g.

var Web3 = require('web3'); var web3 = new Web3(); web3.setProvider(new web3.providers.HttpProvider('http://127.0.0.1:8545')); console.log(web3.eth.blockNumber);

The output of the last line returns undefined.

-1

+1 @shuxy ,I had the same problem when I was using --rpccorsdomain "*", but --jsonrpc-cors null solved the problem.

Your Answer

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

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