5

I am trying to update contract variable value and return value in the same function, It will return value if I deploy it on JavaScript VM but it returns null when I deploy contract on private network.

JavaScript VM:

JavaScript VM Private Network:

Private Network

Am I doing something wrong on my Private Network Setup ? What else could be the possible issue as everything else is entirely the same.

1 Answer 1

2

Only a constant function returns value to web3 (which is what is used by remixd) on a actual node not Javascript.
If called by another smart contract, though the return value is gotten by the smart contract.

Other Related questions:
https://ethereum.stackexchange.com/a/7060/1079
How to get return values when function with argument is called? Reading values from a contract: When do I need transactions?
With web3 how would I get transaction AND function result?
What is the difference between a transaction and a call?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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