Buy giftcards with crypto

The Ethereum Virtual Machine (EVM) Explained

profile pic
5 min read
The Ethereum Virtual Machine (EVM) Explained

Uncovering the mystery of the Ethereum Virtual Machine (EVM) to help you better understand its inner workings.


One of the most notable blockchain projects globally, Ethereum plays a massive role in cryptocurrency. Still, few realize what exactly makes it possible for it to do all the incredible things it does. It’s time to investigate the Ethereum Virtual Machine and find out how it enables smart contracts to be such powerful tools.

What is the Ethereum Virtual Machine?

The Ethereum Virtual Machine is commonly referred to by the abbreviation EVM and provides part of the foundation to allow Ethereum to do many of the things it does. The EVM enables Ethereum to support smart contracts that provide the foundation for the growing number of decentralized applications (dApps) active on the network today.

Operating as a decentralized computer of sorts, the EVM enables advanced transactions and events to occur in a repeatable and secure manner. Every Ethereum node runs a copy of the EVM, ensuring that the network is decentralized and results are reliable and repeatable.

As smart contracts are executed, state changes occur, and part of the role of the EVM is to manage these state changes that make smart contracts possible, which is partially why you’ll sometimes hear the EVM being described as a state machine.

What does the Ethereum Virtual Machine do?

The EVM adds a range of extra functionality to the Ethereum blockchain that isn’t supported by something like Bitcoin. While excellent, Bitcoin has different priorities and strongly focuses on being a distributed ledger.

You can think of the EVM as a computer that operates over the top of a blockchain to enable more advanced tasks to be performed. Using it allows anyone to execute code on a decentralized blockchain where the outcome is guaranteed based on the code provided to it via smart contracts.

While the EVM operates on Ethereum nodes, it does not have access to other parts of the system such as the network or filesystem; everything running in the EVM is completely isolated from the outside world, which helps it to be deterministic and produce consistent, repeatable results which are essential for many of the types of smart contracts we use today.

What are Opcodes?

Opcodes are an abbreviation of the term operation codes. Opcodes in the context of the EVM can be looked at as specific commands that the EVM understands. While smart contracts are coded in higher-level programming languages like Solidity, it is later converted into opcodes that the EVM can interpret, enabling it to perform specific tasks it understands with the data provided to it.

To store opcodes, they are encoded to bytecode, where each opcode is assigned one byte, and this is done to ensure that they can be stored more efficiently, something that is important with a growing blockchain. The EVM can use around 150 opcodes that cover a range of operations that include things like logging, comparisons, mathematical calculations, duplications, and much more.

What does EVM Compatible Mean?

A growing number of blockchains are boasting about being EVM compatible. Being EVM compatible means that a blockchain provides an environment that can support the execution of code similarly to Ethereum.

Like many things in the modern world, it can be helpful to avoid reinventing the wheel, and this is why EVM compatibility is becoming more common even among much newer and younger blockchain projects. Another benefit is that providing an EVM compatible blockchain ensures that developers already familiar with developing smart contracts on Ethereum will be able to adjust to another EVM compatible blockchain rapidly.

Some examples of EVM compatible blockchains are BNB Smart Chain, xDAI Chain, Tron, and Avalanche, but a growing number of others also provide EVM compatibility.

How Gas Affects the EVM

If you’ve ever used Ethereum, you’ll already be familiar with the concept of gas. At the very least, you’ll likely have noticed the term when performing a transaction in reference to the associated cost of completing a transaction. To put it simply, gas acts as a fee for performing computational tasks on the Ethereum network, be that a simple transaction from one wallet to another or interacting with an advanced smart contract that handles many different jobs.

If there were no fee to use the network, there would be no way to prevent computationally expensive tasks from flooding the network and dragging it to a crawl, which is why gas is a sometimes annoying but essential part of using Ethereum and leveraging the power of the EVM. Gas incentives drive the Ethereum network and enable network participants of all kinds to exist and benefit each other. Those securing the network are rewarded, while those using the network can pay for the privilege. While it has its complexities at its core, it’s a give-and-take relationship that has shown itself to work very well with blockchains.

While every transaction starts with a minimum gas requirement of 21,000, it can require much more to complete successfully, depending on what is involved. Any gas not used to complete a transaction successfully is refunded, but any gas used before that point will still be taken even if a transaction fails. If a gas limit below what is ultimately required to complete the transaction is set, the transaction will use all the allocated gas before failing, and the gas will still be given to the validators.

Each opcode requires a specific amount of gas units to be completed, and this is why certain types of transactions can require a lot more gas. If you’ve ever noticed that a transaction has cost a lot more than another while the current gas price was roughly the same, it was very likely that it was simply a more computationally heavy task to complete the transaction. Having varying gas requirements for transactions is just a practical way to ensure that more complex tasks that require more resources are more costly to discourage abuse of the network and other inefficiencies.


The Ethereum network provides an incredible tool for performing decentralized tasks at scale. It has evolved into a thriving ecosystem of exploring new concepts and ideas, and a lot of this is thanks to the Ethereum Virtual Machine. So the next time you’re checking out the latest decentralized application that catches your eye, spare a thought for the EVM and how it makes it possible for that application to exist.

If you are interested in learning more, consider checking out our introduction to Ethereum or explore the world of smart contracts.

Get freshly mined articles straight to your inbox!
No spam, pinky promise!