Why does putting `view` on a contract function stop it from changing any saved data, and how does the EVM brain make sure of this?
Putting `view` on a contract function signals that the function will only read data from the blockchain's saved state but will not change it. This keyword is a promise by the developer that the function will not alter any stored variable, emit events, deploy new contracts, or send Ether. The Ethereum Virtual Machine (EVM), which is the runtime environment for smart contracts, ensures this promise is kept through a strict enforcement mechanism primarily by distinguishing between how function calls are executed: as a read-only local execution (a "call") or as a state-changing global update (a "transaction"). When an external entity, such as a user interface or another contract, ....
Community Answers
Sign in to open profiles and full community answers.
No community answers yet. Be the first to submit one.