My question is related to this one:

Can a contract function both change the state and return a value when it's called externally

Question: How to read event/log content?

I have a contract like:

contract  Aa {

 uint state;
 event CheckVal(bool value);
 function test() returns (bool ){

 bool temp=true;
 state= 5;
 return temp; 

I want to both change the state and get the returned value: "temp". I'm following the guide from here (the 1st usecase).

The problem is that when in my geth console, I put

  exampleEvent.watch(function(err, result) {
 if (err) {

only three dots will appear(i.e. ...), so I cannot get the value I want and I cannot send a transaction to the private chain and see the returned value:


I'm wondering how I can get the return value in geth console.

  • throw in some semicolons after console.log arguments and give it another try. for me , the ... usually means somethings not closed (a parentheses, function, etc) – thefett Sep 25 '17 at 3:01
  • @thefett thanks, I've followed your suggestion and the problem has been solved. But I still don't know how to get the result value, if I call console.log(); only "undefined" would pop up, but I want to see the value of "temp". – Ay. Sep 25 '17 at 9:30
  • So it will be undefined until it mines. I think this post may help: ethereum.stackexchange.com/questions/3285/… – thefett Sep 25 '17 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.