What is the EVM? Ethereum Virtual Machine – Explained

Introduction:

You’ve probably heard the term evm everywhere now in fact way more projects use it other than just ethereum even though it was built for ethereum Avalanche polygon binance smart chain Phantom and tons of other chains use this highly specialized blockchain technology.

 

What is EVM ?

In this blog we’re going to be explaining what the evm is how it works and why so many blockchains are utilizing it before we get too far into what an evm is if you’re interested in learning how to be a web 3 developer.

Moving forward what is the evm well I’m just going to jump right into it and say that evm is an acronym him for the ethereum virtual machine. To completely understand this we have to understand what a virtual machine is technically the evm is a cloud computer that is operated by all the nodes that contribute. To it this means that it’s not a single computer somewhere it’s the accumulation of thousands of computers around the world in reality these computers are made up and operated by people like you and me. Each computer on the ethereum network runs a piece of software that is basically just Computing the output of smart contract transactions. Now this theoretical Cloud computer evm has many similar parts to a real computer such as memory storage and a part specialized for computing numbers it is different though from a real computer because it doesn’t need a monitor or a keyboard or a mouse but it does need a few unique pieces like a part to be able to understand and read smart contract code the evm though is basically just a computer specialized at processing smart contract transactions. Now moving forward smart contract code written by developers is what the evm process successes truthfully there are a few different evm languages that developers write in however the most common one is solidity solidity is a programming language that allows developers to write code that they can understand and make predictions on how the code will work. In reality code can work in ways that we don’t expect it to solidity is not the code that the evm reads and processes though the evm reads something called bytecode which is basically just a bunch of ones and zeros you probably already knew that computers do math in binary or ones and zeros though when a developer writes a smart contract they must compile it this is a term meaning they turn the solidity language code which is human readable and understandable into byte code so that the evm can understand it and read it and this is mostly because humans aren’t really good at reading a bunch of ones and zeros. So we came up with solidity for us to be able to read and write code much more effectively essentially this compiling process is just a way to translate human code to machine code as I mentioned earlier this translation process s does leave us open to vulnerabilities.

Hypothetically in between solidity and bytecode there’s a middle theoretical language called opcode opcode is quite literally a language that shows operational code or rather instructions the instructions that the evm must take to perform a smart contract transaction you might recognize or be able to predict what some of these op codes do for example push M store is zero and call but you should know that there’s over a hundred different op codes I call this a theoretical middle language because most people don’t write opcode. The evm doesn’t read opcodes each of these codes though does cost a certain amount of money to be run on the evm and if you add up all the op codes in a single smart contract and multiply each opcode by the cost of each op code you get the total amount of gas or money that it takes to deploy or use a Smart contract the more complex that a smart contract is the more it costs to use it and this is because you’re making the evm do more more work. So each smart contract can be broken down into a list of operations which can be named by their op code names also some op codes are more expensive than others and some op codes are more common than others one really interesting.  Thing about blockchains that use the evm is that it’s really easy to move your projects and applications from one chain to another if they both use the evm this means if you have an application on polygon it’s very easy to move it over to Phantom or Avalanche or ethereum you can move your project around where your customers are most likely to be. Now this is unlike cardano or Solana which use rust developers are highly incentivized to program things using solidity due to the massive Market that they could reach just by migrating their app from one chain to another.

EVM Processes Transection:

The next thing I want to talk about is how the evm processes transactions. The evm processes transactions sequentially one by one this means it doesn’t do a whole bunch of things all at once and if a process doesn’t work for whatever reason maybe for example say you’re trying to send someone one if but you actually only have three quarters of an eighth in your account then the transaction is Skip each time the evm runs a transaction we say that the state of the evm is updated. Since the evm is really just a collection of data of information each transaction that the evm processes simply changes that data that is on the evm we call this collection of data a state if one thing changes in the evm if just one number changes. Then we say that the state of the evm has changed each transaction changes the state of the blockchain and if you wanted you could make a copy of the blockchain and roll it back to any state in the past that you wanted to in short what this means is that each time the evm changes or processes a transaction there’s always a complete record of what the evm consisted of before the transaction and after the transaction and this list of transactions is what we call the blockchain.

Overall EVM Review:

So as a review the evm is a virtual computer that’s a collection of thousands of individual computers all out there running the same smart contract transaction actions this virtual computer has rules and can only understand binary code which consists of ones and zeros.

To be able to add transactions to the evm developers create secondary languages such as solidity which allows humans to write code in the English language. So that they can have the evm perform what they want it to do without needing to understand the binary code the cost of a smart contract is simply determined by what work the evm performs whether it’s reading data writing data or both. And also how much data it reads or writes we can actually know specifically how much a smart contract will cost to run by looking into the op code of a transaction which is literally the operational code or the instructions of a transaction. Where each operation costs a certain amount of money to perform for instance adding two numbers might be one one thousandth of a dollar add up all of these op codes and their costs and you get the total cost to perform a smart contract transaction. Also when transactions are submitted to be processed by the evm they are ran sequentially one by one and each transaction changes the state or the collection of data that the evm holds this data could be token balances or maybe amounts of a loan to repay or even a simple chat message.

Overall the evm is made out to be a really sophisticated idea but essentially it’s just a specialized computer that’s designed to process D5 transactions finally as we in this video if you actually learned something about the evm. Upcoming web 3 bootcamp I’m only opening the doors for a week next week and if you want in you’ll have to join the waitlist below technically I’ve had a very small group of 30 people go through it already and they loved it we created tons of different apps with the goal of being able to create any dap idea that you can think of or score a high-paying solidity job by using these dapps as your portfolio if you’re interested in web 3 at all and want to build something for the next Bull Run.

Leave a Comment