1

While creating solidity contract on Browser solidity I am facing this error?

callback contain no result Error: Invalid JSON RPC response: ""

Can someone please help me resolve it?

pragma solidity ^0.4.2; 

contract SimpleStorage{ 

    uint storedData; 

    function set(uint x){ 
        storedData=x; 
    } 

    function get() constant returns(uint retVal) { 
        return storedData; 
    } 

}
Rob Hitchens
  • 55,151
  • 11
  • 89
  • 145
Neha
  • 11
  • 2
  • Can you post the contract source code? – Rob Hitchens Feb 09 '17 at 06:12
  • pragma solidity ^0.4.2;

    contract SimpleStorage{ uint storedData;

    function set(uint x){
        storedData=x;
    
    }
    
    function get()constant returns(uint retVal)
    {
        return storedData;
    }
    
    
    

    } This is the simple contract code. When I click on create in browser solidity, the above error is coming.

    – Neha Feb 09 '17 at 06:41
  • Thanks. Nothing wrong with the contract. It works. I would look to your chain setup. Either Browser Solidity isn't talking to it as expected, or the account it's trying to use for deploying the contract doesn't exist or isn't unlocked, so it can't pay the gas fee. Either way, it didn't get the response it was looking for. Unlock is an extra step if you're not using the default JavaScript VM. Am I correct to understand that you're using the Web3 Provider? – Rob Hitchens Feb 09 '17 at 06:56
  • Same question here with lots of details about what can go wrong: http://ethereum.stackexchange.com/questions/7796/invalid-json-rpc-response-in-browser-solidity – Rob Hitchens Feb 09 '17 at 07:04
  • @RobHitchens I am using the Web3 Provider. The account I am using to deploy the code is unlocked and has ethers in it. So I guess that's not the reason for the error. Need help in solving it. – Neha Feb 11 '17 at 08:09
  • TBH, I have managed to get Browser Solidity + private chain to work but I didn't find it ideal. I usually usually use Browser Solidity + Javascript VM as blank canvas to work out new contracts or debug them, then go to truffle + testrpc to make migrations, unit tests + user interface, then truffle + private chain for more realistic testing, then truffle + testnet to confirm unit tests/app work on a live chain and/or share with others. – Rob Hitchens Feb 12 '17 at 22:09

0 Answers0