The Ethereum blockchain could be described as a blockchain with a built-in programming language. Alternatively, it could be defined as a consensus-based globally executed virtual machine. The part of the Ethereum protocol in charge of all the computing is known as the Ethereum Virtual Machine (EVM).
The Ethereum blockchain could be described as a blockchain with a built-in programming language. Alternatively, it could be defined as a consensus-based globally executed virtual machine. The part of the Ethereum protocol in charge of all the computing is known as the Ethereum Virtual Machine (EVM).
The EVM is key in Ethereum being able to run smart contracts. Smart contracts enable Ethereum to harness the power of decentralized applications (dapps). Additionally, smart contracts enable companies to hold so-called ICOs, or initial coin offerings, on the Ethereum blockchain in order to launch their own tokens.
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.