6

I am relatively new to Blockchains and when I execute the following command I am getting an error.

contract mortal { 
    address owner; 

    function mortal() { 
        owner = msg.sender;
    }
    function kill() {
        if(msg.sender == owner) suicide(owner); 
    } 
}

contract greeter is mortal { 
    string greeting;

    function greeter(string _greeting) public { 
        greeting = _greeting;
    }
    function greet() constant returns (string) { 
        return greeting;
    }
}

web3.eth.compile.solidity(greeterSource)

Invalid JSON RPC response: undefined
at InvalidResponse (:-81076:-41)
at send (:-154580:-41)
at solidity (:-131712:-41)
at :1:1**

What is going wrong?

jrbedard
  • 524
  • 1
  • 6
  • 15
user5418
  • 61
  • 1
  • 1
    There is a step-by-step guide for deploying the Greeter at https://ethereum.stackexchange.com/questions/2751/deploying-the-greeter-contract-via-the-geth-cli-is-not-registering-in-my-private/2787#2787 – BokkyPooBah Dec 09 '16 at 17:04
  • If you are new to programming smart contracts I would recommend using a local test blockchain network such as a Ganache. – John DeBord Jul 08 '18 at 07:04

1 Answers1

1

This almost certainly means you do not have a geth node running. The RPC response is invalid because there wasn't one.

JohnAllen
  • 1,318
  • 1
  • 13
  • 29