1

Return values from functions which create transactions, can only be true or false, at least when you check them post transaction (e.g., with web3 through receipt). However, when functions call each other on the EVM, even through external function calls, multiple non-boolean return values can be passed on from function to function. Why is that?

1

Transaction receipts only have a status field which can be 0 or 1. There is simply no field for a return value.

To navigate around this, you can:

  • Thanks, I've deployed events to get around this limitation. The second option involves the call method which fetches data from the client without sending a transaction. It's strange to me that this method will provide return values, but a send won't. It's just a single extra–yet highly valuable–field. Just because there is no field doesn't mean mean there shouldn't be:) – GViz Oct 4 '18 at 17:43
  • Yes. It‘s quite limiting. There is also no possibility to return an error code on revert. Which is really painful. However, there are plans to extend this. – ivicaa Oct 4 '18 at 17:48
  • It looks like require and revert allow passing of error messages that bubble up: solidity.readthedocs.io/en/v0.4.25/… Do you mean catching exceptions is not yet possible? – GViz Oct 5 '18 at 22:51
  • 1
    See this one: ethereum.stackexchange.com/questions/40993/… – ivicaa Oct 6 '18 at 4:51

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.