Have you heard of Ethereum Virtual Machine (EVM)? It has been talked about alot in the crypto world these days. Let us take a closer look at what an EVM is and why it is essential for so many blockchains.
Read: What Is Ethereum? – A Simple Guide
What Is The Ethereum Virtual Machine (EVM)?
To completely understand EVM, 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 but 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.
This theoretical cloud computer 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 input and output devices like a monitor, 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 in short is basically just a computer specialized at processing smart contract transactions.
Read: Discover The 5 Forces Propelling Ethereum’s Continued Growth
Smart Contract Code
Smart contract code written by developers is what the EVM processes. 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.
Code can work in ways that we don’t expect it to and Solidity is not the code that the EVM reads and processes. The EVM reads something called a “bytecode” which is basically a binary of ones and zeroes.
When a developer writes a smart contract they must compile it — this is a term meaning they turned the Solidity language code into binaries so that the EVM can understand it and read it.
This is mostly because programmers are not really good at reading a bunch of ones and zeros so developers came up with Solidity for them to be able to read and write code much more effectively.
Opcodes
In between Solidity and the bytecode, there’s a middle theoretical language called “Opcodes.”
Opcodes are literally a language that shows operational code or instructions for the EVM must take to perform a smart contract transaction.
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 opcodes in a single smart contract and multiply each opcode by the cost of each opcode, you get the total amount of gas fees 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 work.
Read: Polygon ZkEVM Launches On Ethereum Amidst The Heating ZK Season
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 example you’re trying to send someone 1 ETH but you actually only have less than that, then the transaction is skipped.
Each time the EVM runs a transaction we say that the “state” of the EVM is updated since it is really just a collection of data of information.
Each transaction that the EVM processes simply changes that data on the EVM. We call this collection of data a “state” — if one thing changes in the EVM, then we say that the “state” of the EVM has changed.
Each transaction changes the state of the block and if you wanted, you could make a copy of the block 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 and after the transaction; and this list of transactions is what we call the “blockchain.”
Final Thoughts
Because of such capabilities of the EVM, its usage is not just limited to the Ethereum Chain for which it was created but other chain ecosystems like Polygon, Avalanche, Binance Smart Chain and Fantom as well.
The blockchain ecosystem continues to make progress and the EVM remains fundamental in transferring projects and DApps across compatible chains.
Frequently Asked Questions (FAQs)
The EVM is simply a collection of computers running the Ethereum network around the world to process smart contract transactions.
Developers and/or programmers code in smart contract programming languages like Solidity. The human-readable code is compiled through a compiler to be converted into ones and zeros that the EVM understands.
Opcodes are simply a list of instructions guiding the EVM in executing smart contract transactions. There are over a hundred plus different opcodes and each of them incurs a specific cost when executed.