This page is for information purposes only. Certain services and features may not be available in your jurisdiction.
Article

What is the Ethereum Virtual Machine (EVM)?

When Vitalik Buterin built Ethereum, he wanted to push the boundaries of blockchain technology. Bitcoin inspired him, but he felt the tech should do more than just process transactions. As a result, he built the Ethereum blockchain network. Ethereum has all the features of Bitcoin. It can process peer-to-peer transactions and store them in an immutable and decentralized way. It can also do certain things that Bitcoin can’t. For example, it can run smart contracts.

So how does a blockchain run a smart contract? In Ethereum's case, the answer is the Ethereum Virtual Machine (EVM). The EVM forms the backbone of how the Ethereum network operates. In this article, we discuss what EVM is, how it works, its benefits, and use cases. But before we dive deep, let's have a quick recap about smart contracts.

TL;DR

  • Vitalik Buterin created Ethereum to pioneer the introduction of smart contracts. These self-executing contracts run on the Ethereum Virtual Machine (EVM).

  • EVM is a software that allows smart contracts to be run and be deployed on the Ethereum network.

  • EVM processes transactions in two states: world state (account balances and smart contracts) and machine state (executing transaction steps).

  • Smart contracts are written in Solidity and compiled into bytecode. The EVM executes them. Gas fees help to provide security and limit resource abuse.

  • The EVM’s impact is seen in cases like ERC-20 tokens, decentralized exchanges, NFTs, DeFi lending, and DAOs.

What are smart contracts?

Smart contracts are computer programs or applications that run autonomously on a blockchain network. They consist of data codes developers deploy to carry out specific instructions. Users don’t control smart contracts as they run as programmed.

The Ethereum network is the first blockchain to implement smart contracts. As a result, millions of smart contracts are coded and deployed on the Ethereum blockchain today. The EVM played a vital role in achieving that feat.

What is the Ethereum Virtual Machine (EVM)?

The EVM is built into the heart of its protocol. As its name suggests, the EVM is a virtual machine or digital software that powers the Ethereum network. Virtual machine software can execute programs, store data, connect to networks, and perform other computational tasks. It’s also responsible for the code execution and deployment of smart contracts.

How it works

Since Ethereum processes more than just peer-to-peer value transactions, it requires an intricate computation system. So, instead of calling the network a distributed ledger, Ethereum developers refer to it as an "unbounded state machine". And that's a basic description of how the EVM works. The Ethereum network therefore comprises two states: a world state and a machine state.

EVM

World state

The world state is where Ethereum stores its account balances and smart contracts. Similar to the Bitcoin ledger, it’s decentralized, immutable, and accessible to everyone online. The EVM updates this layer every time it completes a transaction. That means everyone with a block explorer can view the Ethereum blockchain and see the same data in real-time.

Machine state

The machine state is where the EVM carries out the step-by-step processing of transactions. It’s also popularly referred to as Ethereum's sandbox for developers. The Ethereum network processes two types of transactions. The first type is the "message call" — when one account transfers ETH tokens to another. In this scenario, the EVM moves the ETH tokens from one wallet address into another. Which then updates the transaction on the world state. The sender is charged gas fees for the computations completed in sending the transaction.

The second type of transaction is called ¨contract creation¨. It refers to when a developer wants to execute a smart contract onto Ethereum. In this scenario, the sender supplies gas fees and inputs a ¨Smart Contract bytecode¨.

Solidity programming language

The most widely used computer language for creating Ethereum smart contracts is Solidity. Like Javascript, it’s a high-level language suitable for humans, but machines don’t understand it. Therefore, once developers write a smart contract in Solidity, they must translate it into machine language or bytecodes using an Ethereum Virtual Machine compiler, like solc.

Smart contract execution

As the EVM executes the code, the gas supply reduces according to the gas cost of the computations executed. If at any point the gas supply is reduced to zero before the transaction is complete, the EVM immediately halts. It abandons the transaction and doesn’t change the world state. The network is unaffected, but the sender's ETH balance goes down to pay for the computations used to execute the code to the halting point. However, if the execution completes successfully, the EVM updates the world state to match the machine state version.

Ethereum gas fees

As we can see from the above, gas fees play a crucial role in processing transactions on the Ethereum blockchain. When Ethereum used the Proof of Work (PoW) consensus mechanism, processing a transaction required hardware and electricity, and miners required incentives to carry out their tasks. In the case of processing ETH token transfers, gas fees vary depending on the congestion of the pool.

When executing smart contracts, gas fees take on a different role. At the point of execution, Smart Contract bytecodes are broken down into smaller pieces called ¨opcodes¨. Opcodes are short for Operational Codes and are the instructions the EVM uses to perform computations. Each opcode is assigned a gas fee — the more complex the opcode, the higher the cost. This step is essential in keeping the Ethereum blockchain secure from malicious attacks. For example, if a user deploys a DDos attack, the EVM will continue executing the smart contract in the machine state. It’ll charge gas fees for every computation, and when the sender runs out of gas, it’ll abandon the transaction.

What are the benefits of EVM?

As described above, the EVM prevents malicious activities from attacking the network. Therefore, it enables the execution of smart contracts and other automated services in a secure and trustworthy platform.

The Ethereum network is the largest crypto ecosystem at the time of writing. What's more, it's considered the gold standard for decentralized application (DApp) creation and smart contract deployment. Many other blockchains have created side chains that allow Ethereum developers to transfer their applications without changing the code.

EVM is also decentralized, meaning anyone can create a smart contract on Ethereum without permission. It also enables developers to build and deploy decentralized services and applications, recently gaining massive popularity.

EVM use cases

With the Ethereum Virtual Machine executing smart contracts, many new inventions have hit the blockchain space. Here are the top five EVM use cases:

ERC-20 tokens

ERC-20 tokens are generated by smart contracts using predefined data structures. The data structure is responsible for giving the token a name, distributing it, and keeping track of it. In 2017, when initial coin offerings (ICOs) were popular, many new cryptocurrencies were launched using the ERC-20 tokens. Today, the best use of ERC-20 tokens is for stablecoins, like USDT.

Decentralized Exchanges (DEXs)

Decentralized exchanges (DEXs) allow users to buy, sell or trade crypto by deploying smart contracts. Exchanges such as Uniswap and ShushiSwap also use automated market makers (AMMs) applications, allowing users to tap into the liquidity pools of tokens without third-party interference.

NFTs

Non-fungible tokens (NFTs) are digital artifacts stored on the blockchain. They authenticate ownership and can’t be copied. Blockchain enthusiasts use smart contracts to create and mint NFT collections. Some of the most expensive NFT collections include the Bored Ape Yacht Club (BAYC) and Cryptopunks. Owners can transfer or trade their NFTs on marketplaces such as OpenSea.

DeFi lending

Decentralized finance (DeFi) Lending refers to platforms that allow users to lend or borrow cryptocurrencies without using a third party. Smart contracts govern the borrowing and lending protocols. Loans are issued immediately to borrowers, and lenders sometimes receive interest daily.

Decentralized Autonomous Organizations

A decentralized autonomous organization (DAO) is a communal entity that lacks a central authority. In DAOs, individual members collectively make governing decisions regarding the project. The rules of a DAO are established by core community members and implemented through smart contracts.

EVM limitations

The EVM has two significant limitations. Firstly, it requires users to have foreknowledge of Solidity and coding skills. Many people need help coding, making it difficult for new users to create and interact with smart contracts.

Its second limitation is that gas fees can become very expensive when creating a smart contract or deploying an Ethereum network application.

Which cryptocurrencies are EVM compatible?

EVM-compatible blockchains are a simple solution to solving the expensive gas fee problem. Developers have borrowed certain parts of the Ethereum network and created DApps that enable users to quickly and easily move assets between any EVM network. Many of the most popular blockchains in use today follow this EVM-compatible approach, mainly:

  • Binance Smart Chain

  • Avalanche

  • Fantom

  • Cardano

  • Polygon

  • Tron

The future of EVM

Building upon the basic foundation of Bitcoin, Vitalik Buterin's vision is to create a decentralized supercomputer that's accessible to all virtually. The Ethereum Virtual Machine has had a huge role in making that vision a reality. Since its conception, the EVM has had several upgrades and continues to evolve and improve.

The Dencun upgrade introduced EIP-4844, which brought proto-danksharding to Ethereum. This significantly reduces gas fees by allowing the network to process Layer-2 transaction data more efficiently. Proto-danksharding is underpinned by a new data type called blobs, which are removed from the blockchain rather than being permanently stored. Meanwhile, EIP-4788 — also part of the Dencun upgrade — helped to enhance interoperability by enabling EVM to access the state of the Beacon Chain directly. This is essential for protocols such as liquid staking and cross-chain interactions. The Dencun upgrade was completed in March 2024.

Looking ahead, Ethereum's roadmap emphasizes scalability through rollups, with zero-knowledge EVMs (zkEVMs) playing a crucial role. zkEVMs enable efficient off-chain transaction processing while maintaining compatibility with Ethereum, improving scalability.

The final word

The Ethereum Virtual Machine is part of the Ethereum network's foundational infrastructure. It's essential to allowing smart contracts to run on the blockchain, with the software responsible for performing multiple computational tasks. Beyond its operational importance, the EVM protects the network by helping prevent attacks, supporting a secure, resilient, and decentralized platform for developers to build upon.

Curios to learn more about the evolving Ethereum network? Check out our guide to the Blast Layer-2 that offers native yield, and read up on Curve Finance, the stablecoin decentralized exchange built on Ethereum.

FAQs

What is the Ethereum Virtual Machine (EVM) and why is it important?

The Ethereum Virtual Machine (EVM) is a virtual software platform that powers the Ethereum blockchain, enabling it to execute and deploy smart contracts.

It’s important because it lets Ethereum do more complicated transactions than simple peer-to-peer value transfers. This makes it a useful platform for decentralized applications (DApps) and other automated services.

How does the EVM process transactions on the Ethereum network?

The EVM processes transactions through two states: the world state and the machine state. The world state records account balances and smart contracts, while the machine state handles the step-by-step execution of transactions.

The EVM may move tokens between accounts or run smart contract bytecodes, depending on the type of transaction. Gas fees determine the cost and completion of these calculations.

What are the primary use cases of the EVM in the blockchain ecosystem?

The EVM's key areas include creating ERC-20 tokens, decentralized exchanges like Uniswap, minting and trading NFTs, DeFi lending platforms, and community-governed Decentralized Autonomous Organizations (DAOs).

What are the limitations of the Ethereum Virtual Machine?

The EVM has two main limitations: complexity and high gas fees. Project owners creating smart contracts need to understand Solidity, the Ethereum programming language. Gas fees can also be very expensive, especially during network congestion or when deploying complex applications.

Related articles
View more
View more