I'm studying Ethereum smart contract. I deployed my greeter contract through Mist browser, and it worked well on Mist.
So I want to make simple Dapp using my deployed greeter contract.
My contract code in Solidity:
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;
}
function changeMsg(string msg) {
greeting = msg;
}
}
My Dapp code in Javascript:
_connect() {
/* ... */
contract = web3.eth.contract(CONTRACT_ABI);
instance = contract.at(CONTRACT_ADDRESS);
}
_greet() {
console.log(instance.greet());
}
_changeMsg(msg) {
console.log(instance.changeMsg(msg));
}
_greet() function works well, it returns my greeting message.
But _changeMsg() function returns some hexa string only. How can I change greet message through _changeMsg() function?