12

I'd like to connect private geth node from browser-solidity, however it returned the error Invalid JSON RPC response: "". Please check the following picture for details.

Could you tell me how to solve the problem? enter image description here

BokkyPooBah
  • 40,274
  • 14
  • 123
  • 193
Toshi
  • 2,357
  • 8
  • 23
  • 34

5 Answers5

6

I got the same error. My problem is that in Chrome browser HTTPS Everywhere was turned on, which turns

http://ethereum.github.io/browser-solidity/#version=soljson-v0.4.7+commit.822622cf.js 

into

https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.7+commit.822622cf.js. 

Turning off HTTPS Everywhere fixed the issue.

q9f
  • 32,913
  • 47
  • 156
  • 395
Yanming Cao
  • 61
  • 1
  • 1
5

I've found the reason. It seems that because I use https, it cannot connect my local node. When I try by http, I can connect.

If this page is served via https and you access your node via http, it might not work. In this case, try cloning the repository and serving it via http
Toshi
  • 2,357
  • 8
  • 23
  • 34
4

To avoid the Error

Invalid JSON RPC response: undefined error 

in the Solidity browser just run geth with the option --rpccorsdomain *

q9f
  • 32,913
  • 47
  • 156
  • 395
Badr Bellaj
  • 18,780
  • 4
  • 58
  • 75
3

Related question from OP: Cannot access geth by JSON-RPC. It returns {"jsonrpc":"2.0","error":{"code":-32600,"message":"EOF"}} .

The following worked for me.

user@Kumquat:~$ cd /tmp
user@Kumquat:/tmp$ geth --dev --datadir mydir account new
Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase: 
Repeat passphrase: 
Address: {7f059ae83a49c1478245b2277b06d44acd2ab664}
user@Kumquat:/tmp$ geth --dev --datadir mydir --rpc --rpcaddr "localhost" --rpcport "8545" --rpccorsdomain "*" --mine --minerthreads 1 --unlock 0 console
...
Unlocking account 0 | Attempt 1/3
Passphrase: 
// ENTER PASSWORD ABOVE

And in Browser-Solidity: enter image description here

BokkyPooBah
  • 40,274
  • 14
  • 123
  • 193
  • Thx, but it can't solve the problem yet. – Toshi Aug 06 '16 at 07:05
  • What browser are you using? Turn on the developer console and watch the messages when the error occurs. What do you see? And can you post the exact command line you are using for starting your geth instance. – BokkyPooBah Aug 06 '16 at 07:05
  • 1
    It seems that I cannot connect, because I use https not http. Thank you for your help:) – Toshi Aug 06 '16 at 07:07
0

When I used Parity, I had to do two things to get it to work with Remix:

  1. appending this command line argument: --jsonrpc-cors="all"
  2. allowing unauthenticated scripts to be loaded as per the photo below

enter image description here

Note: The above settings are somewhat open/insecure, so please consider using them only for deploying to a testnet, or for toy examples.

It would perhaps be safest to host and run your own Remix instance locally (taking all the necessary precautions in acquiring the code, etc).

Travis Jacobs
  • 1,535
  • 1
  • 13
  • 25