I have a private ethereum system with a couple of nodes. I'm trying to deploy a contract on one of them. To begin with, I am trying to just deploy a sample contract from the net. This is what I'm using:
pragma solidity ^0.4.24;
contract sample {
string public name = "ZeonLab";
function set(string _name) {
name = _name;
}
function get() constant returns (string) {
return name;
}
}
I compile this with the solc compiler and get the ABI and bytecode by running solc --abi and solc --bin respectively. I then try to deploy the contract on geth as follows: geth console
> var test = eth.contract('abi text above')
It however gives me an undefined error. in fact, instead of the ABI text from above, if I just do: var test = eth.contract('test')
, I still see an error.
I read somewhere that we need to do: var testTxt = JSON.parse('abi text above')
However, that did not work either.
From the error, it looks like there may be an issue with recognizing eth.contract itself. When I type eth on the console, I see that contract is one of the options.
Any suggestions on what could b wrong.
thx - anand