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 Answers1

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?

Adibas03
  • 388
  • 2
  • 7