Ethereum Virtual Machine (EVM)

EVM (Ethereum Virtual Machine) is the software environment that executes smart contracts and decentralized applications on compatible blockchains.

evm glossary banner image

What is the Ethereum Virtual Machine (EVM)?

Our article on Unspent Transaction Output (UTXO)Unspent Transaction Output (UTXO)UTXO (Unspent Transaction Output) is a blockchain transaction output that has not yet been spent and can be used as input in a future transaction.Keep learning closed by noting that EthereumEthereumEthereum is a decentralized blockchain platform that runs smart contracts and dApps, using its native cryptocurrency (ETH) for transactions and fees.Keep learning's account-based model exists specifically to support something BitcoinBitcoinBitcoin is a decentralized digital currency that enables secure peer-to-peer transactions without relying on a central authority.Keep learning's design never intended to handle: complex, stateful Smart ContractsSmart ContractsA smart contract is a self-executing computer program deployed on a blockchain. It contains rules and conditions written directly into code.Keep learning. This article picks that thread up directly and looks at the system actually responsible for running them; the Ethereum Virtual Machine, or EVM: the computational engine sitting at the heart of Ethereum, and arguably the single feature most responsible for the platform's role as the foundation of the broader dAppsdAppsdApps are decentralized applications that run on blockchains, using smart contracts to operate without central control or single points of failure.Keep learning ecosystem.

What a Virtual Machine Is, in General

Before getting into Ethereum specifically, it's worth grounding the term itself. A virtual machine, in computing generally, is software that simulates the behavior of a computer; executing code, managing memory, and producing predictable outputs; without that code needing to run directly on any one specific, real piece of physical hardware. This is a familiar concept well outside BlockchainBlockchainThink of blockchain as a public notebook that everyone owns a copy of. Whatever gets written in it is permanent and visible to all.Keep learning: it's the same basic idea behind running a Windows program inside a virtual machine on a Mac, or behind the Java Virtual Machine that lets the same Java program run identically across entirely different operating systems.

The EVM applies this same basic concept to a genuinely novel setting: rather than running on one computer, it needs to execute identically across every single one of Ethereum's thousands of independent Blockchain NodesBlockchain NodesA node is simply a computer that participates in a blockchain network. Each node stores a copy of the blockchain and helps verify transactions.Keep learning simultaneously, producing exactly the same result on every single one of them, every time; because, as established throughout this series, consensus depends entirely on every node agreeing on the resulting state of the Blockchain NetworkBlockchain NetworkA blockchain network is a system of computers connected to each other that follow the same set of rules to record, share, and validate transactions.Keep learning.

What the EVM Actually Does

At its core, the EVM is the component of Ethereum's software responsible for executing smart contracts; self-executing code, deployed directly onto the blockchain, that runs exactly as written, with no ability for anyone (including Ethereum's own developers) to alter its behavior after deployment without going through the same proposal and Blockchain consensus mechanismsBlockchain consensus mechanismsA consensus mechanism is a method for validating transactions and securing a blockchain without relying on a central authority.Keep learning described in our Blockchain ProtocolBlockchain ProtocolA blockchain protocol is the set of rules and standards that govern how a blockchain network operates, validates transactions, and reaches consensus.Keep learning article.

Every Ethereum node runs its own independent copy of the EVM. When a smart contract is executed; triggered by an incoming transaction; every node processes that exact same execution independently, and because the EVM is deterministic (the same input always produces the same output, a property that should feel familiar from our HashingHashingHashing is the process of converting data into a fixed-length code using a cryptographic function, ensuring data integrity and security.Keep learning article), every honest node arrives at the identical resulting state. This is precisely what allows the network to reach consensus not just on simple currency transfers, as Bitcoin's design handles, but on the outcome of arbitrarily complex, custom-written code.

From Solidity to Bytecode

Smart contracts aren't typically written directly in the low-level instructions the EVM actually executes. Developers most commonly write contracts in Solidity, a higher-level programming language specifically designed for Ethereum, with syntax deliberately similar to widely used languages like JavaScript, making it more approachable for developers already familiar with conventional software development.

This Solidity code is then compiled down into EVM bytecode; a long sequence of low-level instructions, drawn from a defined set of roughly 140 individual operations called opcodes, each performing one narrow, specific task: adding two numbers, storing a value in memory, comparing two values, sending currency, and so on. It's this compiled bytecode, not the original human-readable Solidity, that's actually deployed to the blockchain and executed by every node's EVM.

You can see this compilation process directly, without needing to install any software, using Remix IDE, Ethereum's official, browser-based development environment. Remix lets you write a simple Solidity contract, compile it instantly, inspect the resulting bytecode and opcodes directly, and even deploy and test it on a free, simulated test network; a genuinely excellent, hands-on way to see the entire process end to end, with no real funds or setup required.

Gas: Paying for Computation

Here's where the EVM introduces a concept genuinely unique to this series so far: Gas FeesGas FeesGas fees are transaction costs paid to network validators to process and secure operations on a blockchain, varying with demand and complexity.Keep learning.

Because EVM execution consumes real computational resources across every single node on the network simultaneously, Ethereum needs a mechanism to prevent abuse; without some kind of cost attached, nothing would stop a malicious or simply careless piece of code from looping indefinitely, consuming network resources forever and grinding the entire network to a halt. Gas is Ethereum's solution: every single opcode has a defined gas cost, reflecting roughly how computationally expensive that specific operation is to execute, and every transaction must specify how much gas the sender is willing to pay for, along with a price they're willing to pay per unit of gas.

If a transaction runs out of allotted gas partway through execution; say, because a smart contract contains an unexpectedly long loop; execution simply halts at that point, and (since the Byzantium upgrade) any state changes made up to that point are reverted entirely, as though the transaction never happened. The gas already consumed up to the point of failure is not refunded, which is itself a deliberate design choice: it ensures that even a failed transaction still pays the network for the computational work it actually consumed, rather than allowing failed transactions to become a free, repeatable way to waste network resources.

The total fee for a transaction is calculated, in simplified terms, as the gas actually used, multiplied by the gas price the sender agreed to pay. Gas prices fluctuate based on overall network demand at any given moment; during periods of high network congestion, users compete by offering higher gas prices to have their transactions prioritized and included in the next block sooner, a dynamic not unlike surge pricing in other contexts. You can track current, real-time gas prices using Etherscan's Gas Tracker, which displays live recommended gas prices for transactions of differing urgency, alongside historical trends showing how dramatically gas prices can swing during periods of network congestion.

State: What the EVM Actually Maintains

The EVM doesn't just execute code in isolation; it maintains and continuously updates Ethereum's overall state: the complete, current snapshot of every account balance, every deployed smart contract's stored data, and every contract's current code, all at once, across the entire network.

This state is organized and verified using a structure closely related to the Merkle trees introduced in our hashing article, called a Merkle Patricia Trie; a more sophisticated variant specifically designed to efficiently store, update, and verify large amounts of frequently changing key-value data (such as account balances, which change with nearly every block) far more efficiently than a simple Merkle tree alone would allow. Every Ethereum block header includes a CryptographyCryptographyCryptography is the science of securing information using mathematical techniques to protect data, ensure privacy, and verify authenticity.Keep learning root hash representing this entire state trie at that point in time, allowing any node to verify the complete state of the network using the same fundamental hashing principles covered throughout this series, just applied to a considerably more complex and frequently updated dataset than Bitcoin's relatively simple UTXO set.

Smart Contracts in Practice

It's worth grounding all of this with a sense of what smart contracts actually enable in practice, since the EVM's real significance lies less in the technical execution model itself, and more in what that execution model has made possible. DEXs (Decentralized Exchanges)DEXs (Decentralized Exchanges)DEXs are decentralized exchanges that let users trade cryptocurrencies directly from their wallets using smart contracts, without a central authority.Keep learning, allowing direct Crypto TokensCrypto TokensCrypto tokens are digital assets built on existing blockchains that represent value, access, or utility within a specific project or ecosystem.Keep learning Crypto TradingCrypto TradingCrypto trading is the buying and selling of cryptocurrencies to profit from price movements in the market.Keep learning without a centralized intermediary; Lending and Borrowing ProtocolsLending and Borrowing ProtocolsLending and borrowing protocols are DeFi platforms where users supply crypto to earn interest or borrow assets by providing collateral.Keep learning, allowing users to borrow and lend CryptocurrencyCryptocurrencyCryptocurrency, often called “crypto,” is a form of digital currency that uses cryptography (advanced math and code) to keep it secure.Keep learning through entirely automated, code-enforced terms; and the token standards behind both fungible tokens (ERC-20) and NFTsNFTsAn NFT is a unique digital asset stored on a blockchain that proves ownership of something.Keep learning (ERC-721) referenced in our hashing article, are all, fundamentally, smart contracts executing on the EVM, following exactly the deterministic, gas-metered execution model described above.

You can explore real, deployed smart contracts directly using Etherscan, referenced in earlier articles; searching any contract address there typically displays its verified source code (when the developer has chosen to publish it), its complete transaction history, and a live record of every interaction the contract has processed, offering a genuinely transparent window into code that, once deployed, cannot be secretly altered by anyone.

EVM Compatibility: Beyond Ethereum Itself

One of the more significant downstream effects of the EVM's design has been its widespread adoption well beyond Ethereum's own network. Because the EVM's execution model and opcode set are openly documented and well understood, numerous other blockchain networks; Polygon, Arbitrum and Optimism (the Layer 2 BlockchainLayer 2 BlockchainLayer 2 blockchain is a secondary protocol built on top of a Layer 1 chain to improve scalability, reduce fees, and speed up transactions.Keep learning referenced in our blockchain networks article), BNB Smart Chain, Avalanche's C-Chain, and many others; have built EVM-compatible environments of their own, capable of running the exact same Solidity smart contracts, often with little to no modification required.

This compatibility has become a genuinely significant factor in the broader blockchain ecosystem's development, since it allows developers to write a smart contract once and deploy it across numerous different networks with minimal additional engineering effort, and allows wallets, developer tools, and infrastructure built for Ethereum to be reused across this entire family of compatible networks with only modest adaptation. It's a clear, practical illustration of how a well-designed, openly specified technical standard can end up shaping an entire industry's direction well beyond the single network it was originally built for.

Limitations and Ongoing Evolution

The EVM is not without its own constraints, several of which connect directly back to the The Blockchain TrilemmaThe Blockchain TrilemmaThe blockchain trilemma is the challenge of balancing decentralization, security, and scalability in blockchain systems, where improving one impacts the others.Keep learning discussed earlier in this series. Its deliberately deterministic, sequential, single-threaded execution model; necessary for every node to reliably reach the same result; places a real, structural ceiling on transaction throughput, directly contributing to the ScalabilityScalabilityScalability is the ability of a blockchain or system to handle increasing numbers of transactions or users efficiently without performance loss.Keep learning pressures that motivated the Layer 2 solutions and sharding research discussed in that article. Gas costs, while serving a genuinely important anti-abuse function, also impose real, sometimes substantial expenses on users during periods of high network demand, a long-standing and frequently discussed point of friction for everyday usage.

Ongoing research and development; including newer execution environments built specifically to improve on certain aspects of the original EVM design, while retaining broad compatibility with the existing ecosystem of contracts and tooling built around it; continues to evolve this space, reflecting the same broader pattern of incremental, carefully coordinated improvement described in our blockchain protocol article's discussion of BIPs and EIPs.

Bringing It Together

The EVM is, in many respects, the technical innovation that transformed blockchain technology from a system purpose-built for moving currency into a genuinely general-purpose, decentralized computing platform. To summarize:

  • The EVM is a deterministic virtual machine, run identically by every Ethereum node, responsible for executing smart contracts and maintaining the network's overall state
  • Developers typically write contracts in Solidity, which compiles down into low-level bytecode built from a defined set of opcodes
  • Gas meters and prices computational work, preventing abuse while ensuring the network is compensated even for failed or reverted transactions
  • The EVM maintains Ethereum's complete state using a Merkle Patricia Trie, building directly on the hashing principles covered earlier in this series
  • EVM compatibility has been widely adopted across numerous other networks, allowing the same smart contracts and tooling to function across a broad, interconnected ecosystem
  • The EVM's execution model carries genuine scalability trade-offs, directly connected to the Blockchain Trilemma discussed earlier in this series

Combined with the rest of this series, the EVM represents the point where blockchain technology stops being solely a ledger for tracking ownership, as Bitcoin's UTXO model was originally designed to do, and becomes something considerably broader: a shared, trustless, globally verifiable computer, capable of running arbitrary code exactly as written, with no central operator able to change the rules midway through.

Tag System

The tags found in our glossary are there to help you better understand presented definitions. They showcase how certain concepts integrate and interact within the ecosystem.

Rectangular tags signal a concept related to BlockchainBlockchainThink of blockchain as a public notebook that everyone owns a copy of. Whatever gets written in it is permanent and visible to all.Keep learning as a technology. Whereas rounded tags represent CryptocurrencyCryptocurrencyCryptocurrency, often called “crypto,” is a form of digital currency that uses cryptography (advanced math and code) to keep it secure.Keep learning in more of a financial aspect. You’ll also see rectangular dashed tags for Web3Web3Web3 is the idea of a decentralized internet powered by blockchain.Keep learning and  rounded dashed tags for DeFiDeFiDeFi stands for Decentralized Finance. It refers to a collection of applications and platforms built on blockchain that allow people to transact without banks.Keep learning specifically.

Learn more about the relationship between all the tags and their respective concept with our Free Interactive Courses.

More Blockchain fundamentals

proof of work glossary cover image

Proof of Work

Proof of Work (PoW) is a consensus mechanism where miners use computing power to validate transactions and secure the blockchain.

Keep learning
tokenomics glossary cover image

Tokenomics

Tokenomics refers to a cryptocurrency’s economic design, including supply, distribution, utility, and incentives that influence its value and behavior.

Keep learning
blockchain glossary cover image

Blockchain

Think of blockchain as a public notebook that everyone owns a copy of. Whatever gets written in it is permanent and visible to all.

Keep learning