EVM is an acronym for ‘Ethereum Virtual Machine.’ In this article, we’ll go into what the EVM is and discuss its importance. Due to the Ethereum project playing a prominent role in this topic, we will start by explained Ethereum in its context to the EVM.
The Ethereum blockchain is widely regarded as being the first blockchain system that has a team dedicated to its development and maintaining its well-being. According to its website, Ethereum is a decentralized platform that primarily deals with running smart contracts.
Founded by Vitalik Buterin, the Ethereum project was a blockchain initiative that brought what we know about Bitcoin to a new level. One of the main differences between the Ethereum Blockchain and Bitcoin’s is that it allows other projects to issue coins on top of Ethereum. These new coins, while stand-alone to some extent, arre also tied to Ether, Ethereum’s cryptocurrency.
But like with other blockchains, Ethereum uses a multiple node system that is distributed amongst hundreds of servers across the globe. They keep the software running on their computer to ensure security. Each node that is participating in the Ethereum protocol operates software on their own computer. This wide, decentralized network of computers is what is commonly referred to as the Ethereum Virtual Machine (EVM).
The EVM is considered a ‘quasi-Turing complete’ machine, with ‘Turing completeness’ deriving from a system of data manipulation rules named after Alan Turing, the creator of the Turing machine. Mycryptopedia writer, Bisade Asolo, explains Turing complete machines further, writing that:
“A Turing complete system can be mathematically proven to have the capability of performing any possible calculation or computer program. In other words, a Turing complete machine is mathematically able to solve any problem that you feed to it.”
The EVM is only quasi-Turing complete because calculations that are performed by the machine are bound by fees (or ‘gas’, which we will discuss later on), which limit the number of computations that can be done.
There are a variety of features that come with EVM. For starters, Ethereum Virtual Machine guarantees security for its users by preventing any Denial-of-Service (DoS) attacks, which are malicious actions that are meant to shut down a machine or even an entire network and make them completely inaccessible. Another function of EVM is that it deciphers and carries out Ethereum programming language and ensures that communication can be achieved without any situations of interference.
To dig a little deeper into the structure, EVM can just as easily be understood as a system that is designed to function as a runtime environment for smart contracts that are Ethereum-based. For those who might not be wholly familiar with smart contracts, they are typically defined as self-executing contracts that have the terms of the agreement between the buyer and the seller written directly into the line of code. They give people from different corners of the world the ability to interact and also exchange value without any type of centralized authority.
It is important to note that the Ethereum Virtual Machine operates in a ‘sandboxed’ setting. This is customarily described as being a software management strategy that isolates applications from critical system resources and any other related programs. It provides an extra layer of security that prevents malware or applications with malicious intent from negatively affecting the system.
When it comes to the EVM, it is essentially isolated from the primary Bitcoin network, and it works very well as a testing environment. As a result, pretty much anyone who wants to create a smart contract by utilizing EVM can do so without meddling with other blockchain operations, whether it be intentional or unintentional.
By now, you might be wondering what the reason as to why tests are executed in a sandboxed environment might be. Why is this necessary? Well, test runs in a sandboxed setting are, in fact, a crucial thing because any flawed code can be damaging to most – if not all – smart contracts. Moreover, an environment that is sandboxed provides an unlimited number of opportunities to learn, go over, develop, improve, and eventually build sturdy smart contracts.
From here, we can start to delve a little deeper into the parallel between the Ethereum Virtual Machine and smart contracts.
Machine & Contracts
The Ethereum blockchain has the ability to host and control three types of transactions:
- You are able to transfer Ether from one account to another account. These transactions are fairly similar to Bitcoin transfers, with an example being you can send 5 Ether from your account straight to your landlord’s account as payment for the rent. Here, the transaction records would consist of the following information: a timestamp of when the transaction took place, the sender’s Ether address as the source of the funds, the address of the recipient, and the amount that you sent out.
- There is the transfer of Ether from a user to no one. This particular type of transaction is meant to conceive smart contracts. Let’s assume, for example, that you have two smart individuals and they decide to create a smart contract within the rules and conditions of a specific bet. In this case, the transaction will contain only the sender’s account and timestamp.
- There is the act of transmitting Ether from an external account to a smart contract. For this particular instance, whenever there is an account with the intention to implement a smart contract, then the transactions are made to the smart contract and the guidelines that are related to the execution are put into the data field as a means to guide the contract on what it should do.
Every time any of the above-mentioned transactions occur, a node within the network will carry out the codes as specified in the smart contract by way of the EVM.
Price of Smart Contracts
In order for every smart contract to be put into action, some amount is paid out to the EVM for execution. The payment is made to a distinct node that was utilized as a tool to store, compute, carry out, and verify the smart contract.
The price of each smart contract is calculated based on the cost that is appointed to each statement and the fee is paid in Gas, which can just as easily be exchanged for Ether. To provide proper context, ‘Gas’ is – in regards to Ethereum – described as basically being the equivalent of a fee.
Every transaction that is carried out on the Ethereum network requires that a fee is attached to it, which is then paid in the form of Gas. The concept of the Gas in Ethereum can be divided into two things: Gas and Gas price.
“Gas – Serves as a tool by which we measure the fees that will be required for a particular computation to be executed.
Gas Price – This is the amount of Ether that an individual is willing to spend on every unit of gas. Gas price is often measured in ‘Wei’, and Wei is the smallest unit of Ether, where 10^18 Wei represents one Ether.”
With that in mind, to execute a smart contract in a suitable manner, you will have to specify the amount of Gas that you would like to spend. The overall execution process ceases upon either the completion of a transaction or whenever the Gas limit is obtained. This is admittedly a tedious procedure, but it goes a long way when it comes to protecting smart contracts from any case of infinite looping.
What it does
Whenever there is a transaction that occurs on the Ethereum blockchain, Ethereum Virtual Machine does the following checks:
- Validates if a transaction has the appropriate number of values, the legitimacy of the signature, and also whether or not the transaction nonce matches the nonce of that specific transaction account. If there turns out to be a mismatch, then the transaction will be returned as an error.
- Computes the transaction fee that is required and initializes the gas payment.
- Carries out the transfer of the required amount of digital assets straight to the designated address.
If the EVM were to ever discover that the sender did not put in enough Gas or Ether, the transaction will then be rolled back out. Here, the fee of the transaction will not be refunded, but instead, it will be paid to the miner.
That being said, should a transaction end up being unsuccessful due largely in part to an error on the address of the recipient, EVM will reimburse the amount sent along with the associated fee to the sender. It should be noted that no miner is paid in this case.
EVMs are a vital component in Ethereum blockchain technology and plays a very crucial role in storage, smart contract execution, and of course, verification. Hopefully, this article has shed some light on this underappreciated system.