What is the Ethereum Virtual Machine? (EVM)
What is the Ethereum Virtual Machine? (EVM)
ETHEREUM VIRTUAL MACHINE ESSENTIALS
- The Ethereum Virtual Machine (EVM) is a runtime environment for smart contracts that is also used for developing and testing smart contracts.
- The EVM is quasi-Turing complete, meaning it can perform any calculation as long as the user initiating the calculation has enough ether to pay the fee required for that calculation.
- The EVM is a sandboxed and isolated environment, meaning that the code it runs has no access to the network, filesystem, or other processes.
- Additionally, the EVM cannot access real-world data, e.g. the current date, time or weather. To acquire such data, it relies on so-called oracles.
- The EVM is run by all full nodes of the Ethereum network.
Environment for developing smart contracts
The EVM is sandboxed and isolated from the real world. What this means is that the code running in the EVM has no access to a network, file-system, or any other processes. This makes the EVM perfect for developing and testing smart contracts without interfering with the operations of the blockchain.
You might be asking yourself why it is a good idea to test smart contracts in a sandboxed environment. The thing is that flawed code can be detrimental to any smart contract, so making sure that there are no flaws in the smart contract code is a must. What is more, a sandboxed environment such as the EVM provides infinite opportunities to learn, iterate, improve and eventually complete robust smart contracts that are ready for deployment to the blockchain.
Limitations of the EVM
The Ethereum Virtual Machine is described as Turing complete. Turing completeness refers to a computer’s capacity to perform any calculation it is presented with. This means that, in Ethereum, it is possible to write programs or decentralized apps that are capable of solving any reasonable computation.
But there is a limitation to the EVM, and it is there as a kind of safety precaution. Smart contracts can call other contracts, potentially allowing for infinite looping. The EVM accordingly demands a gas fee to be paid for each on-network transaction. This means that infinite computational loops are prevented by exhausting initiating transactors of their ether. On account of this safety measure, the EVM cannot be entirely Turing-complete. Rather, it is said to be quasi-Turing complete.
Another thing worth mentioning is that the EVM cannot access even the most basic of real-world data. For example, the EVM cannot know on its own what day it is or tell the current temperature. To acquire such data, which is often required for the proper execution of smart contracts, the EVM relies on real-world data providers known as oracles. An oracle can gather data from a website, an app or elsewhere, and feed it to the smart contract.
What does the EVM do?
Whenever a transaction is initiated on the Ethereum blockchain – and it does not matter whether it is a simple transfer of value or a smart contract deployment – the EVM must perform the following three checks:
- It confirms whether a transaction has the correct number of values, whether the signature is valid, and whether the transaction nonce matches the nonce of that particular transaction account. In case of a mismatch, the transaction prompts an error.
- It calculates the fee required for the transaction and initializes the gas payment.
- It executes the transfer of the ether or tokens to the assigned address.
Should the EVM detect that the sender did not allocate enough gas to the initiated transaction, the transaction will not be successful. In this case, the transaction fee is not refunded to the initiator of the transaction. Instead, it is paid to the miner. However, if a transaction is unsuccessful due to an error on the recipient’s address, the EVM will return the amount sent as well as the associated fee back to the sender.
EVM is where the magic of Ethereum happens, bringing added value to blockchain technology and the world of cryptocurrencies. On account of features such as the EVM, the Ethereum platform has enjoyed great popularity, with ether, its native crypto, remaining one of the largest cryptocurrencies by market cap.
This content by cryptomentor.info is in no way a solicitation or offer to sell cryptocurrencies, securities, shares, financial assets or investment advisory services. cryptomentor.info is not intended to be a source for professional advice. Our content is intended to be used and must be used for informational purposes only and this is not a place for giving or receiving financial advice, advice concerning investment decisions or tax or legal advice. It is very important to do your analysis before making any investment based on your circumstances. Readers should always seek the advice of a qualified professional before making any investment decisions.