Introduction to the Ethereum Virtual Machine (EVM): the engine running every smart contract

Introduction to the Ethereum Virtual Machine (EVM): the engine running every smart contract

I remember the first time gas fees ate half my transaction. It was 2021, I was trying to mint something on OpenSea, and the network wanted $87 just to process it. At that moment I realized I had no real understanding of what was happening under the hood. Why did it cost that much? Where did the money go? What was actually executing my transaction? The answer to all three questions was the same thing: the Ethereum Virtual Machine.

Most crypto people have heard "EVM" thrown around. Way fewer can tell you what it does. That matters, because the EVM shapes just about everything on Ethereum and on the 390+ chains that borrowed its design. Over $190 billion in DeFi value sits on EVM networks right now. If you have ever used MetaMask, swapped tokens, or clicked a button on a dapp (decentralized applications, or dapps for short), the EVM was doing the work behind the screen. Nodes execute smart contracts on all of those chains, and the EVM is what makes every one of those calls actually run.

So let's actually unpack it. Not the textbook version, the real one.

What is the Ethereum Virtual Machine and why is it important

Okay, simplest version first. You know calculator apps? Type 2 + 2, get 4. Boring. Now picture that calculator running on 10,000 phones simultaneously. Every phone gets the same answer. If one phone tries to claim "2 + 2 = 5," the other 9,999 reject it instantly. Nobody controls the calculator, nobody can shut it off, and nobody can rig it. That's basically what the EVM does, except instead of math homework, it runs smart contracts that move real money around.

Computer folks call this a state machine. Ethereum keeps track of a big pile of data: who owns what coins, which smart contracts exist, how much ether sits in each address, what info each contract stores. All of that is the "state." You send a transaction. The EVM crunches it against the current state. A new state pops out. Old state plus transaction equals new state. Formula on paper: Y(S, T) = S'. Done.

The wild thing is redundancy. Your transaction does not land on one server in Virginia. It hits thousands of nodes all over the Ethereum network. Each one runs the math on its own. They compare answers. Match? Cool, new state goes on the blockchain. Mismatch? The bad version gets thrown out. I always picture thousands of accountants all filling out the same tax return. One of them writes a different number, everyone stops and finds the mistake.

And here is the thing that makes it different from normal software. Nobody runs the EVM. No company behind it. No support desk. No admin who can quietly roll back a deal at 2 AM. The code is open source, runs the same on every node, and trust comes from that sheer volume of agreement rather than from some authority figure saying "trust me."

evm

How does the EVM work: from Solidity to execution

Let me walk through the lifecycle of a smart contract, because once you see the full chain of events, the EVM makes way more sense.

Step one: you write code. Solidity is the programming language roughly 90% of EVM developers choose. It borrows syntax from JavaScript: curly braces, functions, variables, the usual. Vyper exists too (closer to Python, intentionally simpler), but Solidity runs the show. Here's the catch that trips up newcomers: every single line of code costs real money to run. There's no sandbox. No take-backs. You deploy a contract with a bug in it, and that bug is permanent unless you built an upgrade mechanism ahead of time. I learned this the hard way watching a developer friend lose sleep over a misplaced decimal.

Step two: your Solidity gets compiled into bytecode. Think of bytecode as the machine language of the EVM. You write code a human can read. The compiler turns it into hex soup that the EVM actually understands. Inside that hex are opcodes, roughly 150 of them. ADD does addition. SSTORE saves data for good. CALL lets one contract talk to another. One opcode, one tiny job. Your contract strings thousands of these jobs together.

Step three is where it gets interesting. Someone calls your contract. Every node on the network grabs the transaction, loads your bytecode, and begins processing opcodes sequentially. The processor is stack-based: think of a stack of plates where you can only touch the top one. Push a number. Push another number. Execute ADD. Both numbers get pulled off the top, summed, result goes back on. 1024 items max depth, each one 256 bits wide.

Every node does this on its own. Same bytecode, same inputs, same starting state. Same answer every time. That predictability is why blockchain consensus works at all. If the EVM could spit out different results on different machines, the whole house of cards collapses.

EVM architecture: stack, memory, and storage

The EVM handles data in three layers. This part matters because it directly affects how much your transactions cost.

The stack is the workhorse. All computation happens here. Push, pop, operate, repeat. It's fast, cheap (around 3 gas per operation), and it vanishes when execution finishes. Most opcodes work directly with the stack.

Memory is like a scratch pad. You can read and write to any position in it, which makes it more flexible than the stack for things like strings or large arrays. But memory also disappears after the transaction. Cost-wise, it sits in the middle: more expensive than the stack, way cheaper than storage. It grows as needed, and the gas cost increases quadratically the more memory you allocate.

Then there's storage. This is the expensive one, and for good reason. Storage is permanent. When your smart contract records that Alice owns 500 tokens, that data gets written to the Ethereum state trie and stays there. Every node on the network stores it. Forever. A fresh write to storage costs 20,000 gas. An update costs 5,000 gas. For context, a simple ether transfer costs 21,000 gas total. So one storage write is almost as expensive as an entire basic transaction.

Data layer How long it lasts Gas cost What it's for
Stack Gone after execution ~3 gas per op Math, logic, comparisons
Memory Gone after transaction 3 gas + expansion cost Temp data, function arguments
Storage Permanent 5,000-20,000 gas per write Token balances, ownership records, settings

If you've ever wondered why deploying a smart contract costs so much, this is why. Deployment writes all the contract's bytecode and initial data to storage. That's a lot of 20,000-gas operations stacked up.

If this sounds familiar, it should. Regular computers work the same way. CPU registers are fast but tiny, like the stack. RAM is bigger and slower, like memory. Hard drives store everything but cost the most time per write, like storage. Ethereum's builders set it up this way on purpose. They want you to feel the financial pain of putting stuff on-chain forever, so you only store what truly needs to be there.

Gas fees on the EVM: how Ethereum prices computation

I need to talk about gas, because it's both the cleverest and most frustrating part of the EVM.

The EVM is Turing-complete. Plain English: it can run any computation you throw at it. Including infinite loops. Picture someone deploying a contract with while(true) and no cost to run it. Every node gets stuck. The blockchain freezes. Game over.

Gas stops that from happening. Every opcode has a price tag. ADD costs 3 gas. SSTORE costs 5,000 or 20,000 gas. When you send a transaction, you set a gas budget. Computation finishes under budget? You get a refund for what you did not use. Hit the limit? Everything rolls back, but you still pay for the gas you burned. Infinite loops eat through the budget and die.

What comes out of your wallet is gas used times gas price. Gas used depends on what your transaction actually does. Gas price floats with how busy the network is, measured in gwei (one billionth of an ether). Lots of people trading? Gas goes up. Quiet Sunday? Gas drops.

And here's where the story gets interesting. Remember my $87 mint from 2021? Gas was regularly 100-200 gwei back then. DeFi summer and the NFT craze had the network running at full capacity. Fast forward to early 2026, and the average gas price sits around 3 gwei. A basic ETH transfer costs roughly $0.30 to $0.67. That's a 96% drop from 2021.

Year Avg. transaction fee Gas price range What caused it
2021 ~$24 100-200 gwei NFT mania, DeFi yield farming
2022 $5-15 30-80 gwei Market crash, lower activity
2023 $2-8 15-40 gwei Bear market settling
2024 $0.50-2 5-15 gwei Dencun upgrade, EIP-4844
Q1 2026 $0.30-0.67 ~3 gwei L2 migration, blob transactions

What changed? Two things. First, the Dencun upgrade in March 2024 introduced EIP-4844, which created "blob" storage for rollups. Before blobs, Layer 2 networks had to post their data as calldata on Ethereum's mainnet, which was expensive. Blobs are temporary and much cheaper, cutting L2 posting costs by around 95%. Second, most activity simply moved to Layer 2 networks. When your Uniswap swap runs on Arbitrum instead of mainnet, the base layer stays uncrowded.

On those Layer 2 networks, a swap can cost less than a penny. Arbitrum, Base, and Optimism all run the EVM, so your Solidity code works the same way. You just pay a fraction of the gas.

evm

EVM compatibility: why 390+ blockchains copied Ethereum's blueprint

This is where the EVM story goes from interesting to genuinely significant for the entire industry.

When BNB Chain launched, Binance didn't invent a new virtual machine. They took the EVM and tweaked it. Polygon did the same. Avalanche, Fantom, Cronos, Harmony, Gnosis Chain: same story. Even purpose-built Layer 2 rollups like Arbitrum and Optimism run the EVM natively. The result is an ecosystem of over 390 EVM-compatible chains, though only about 40-50 have meaningful daily activity.

Why copy Ethereum instead of building fresh? Three reasons, all of them practical.

First, developers. There are 20,000+ Solidity devs in the world. Launch an EVM chain and every one of them can ship code on day one without learning a new language. Solana uses Rust. Aptos and Sui use Move. Those chains had to grow their dev pools from scratch. An EVM chain skips that problem entirely.

Second, free tools. MetaMask, Hardhat, Foundry, Ethers.js, OpenZeppelin, Etherscan. The whole Ethereum toolkit works on any EVM chain with zero changes. Same wallet. Same test framework. Same block explorer. That saves years of work.

Third, DeFi moves with the EVM. Uniswap, Aave, Curve, SushiSwap. All of them are live on five or more EVM chains. The contracts copy-paste from Ethereum to Polygon to Arbitrum to BNB Chain. Same code, same audit, same security model. Bridges connect the liquidity. The EVM is the glue.

But copying the EVM means you also copy its problems. One transaction at a time. 256-bit words on 64-bit processors, which adds overhead. A gas system that works but adds complexity newer VMs skip. Solana's SVM runs transactions in parallel. MoveVM has a resource model that kills entire bug categories. FuelVM borrows ideas from modern CPU design.

Has any of them caught the EVM in adoption? Nope. Not even close. Better tech on paper does not beat network effects in the real world. The EVM has the most developers, the most live protocols, the most audited code patterns, and the most scars from getting hacked and surviving. In crypto, where one bug can drain nine figures, scars count for more than benchmarks.

Ethereum state and how the EVM maintains consensus

This part gets more technical, but it matters. It tells you why Ethereum nodes need real hardware and why saving data on-chain costs a small fortune.

Ethereum keeps a massive lookup table. Give it any address and it spits back the ether balance, the nonce (transaction count), and for contract addresses, the full bytecode plus all stored data. Millions of addresses. Hundreds of gigs. That is the Ethereum state.

All of it lives in a Merkle Patricia trie. Quick version: it is a tree where every branch gets its own hash, and all the hashes roll up into one root hash at the top. That root hash sits in each block header. Move 0.001 ETH between two wallets and the root hash changes completely. Validators check blocks by running every transaction, computing the resulting root hash, and comparing. Same hash? Block is good. Different hash? Block gets rejected.

Running a node means keeping this entire tree updated with every single block. That is actually the biggest scaling problem Ethereum has. The VM itself is fast enough. The state just keeps growing. Every SSTORE adds a new leaf to the trie. Every new contract piles more data on. Verkle trees might fix this. The Ethereum team has been building them for a couple years. They would let nodes check blocks without storing the full state. If Verkle ships, running a node gets way cheaper, and more people can join the validator set.

EVM implementation: one spec, many clients

Most people do not realize this: "the EVM" is a spec, not a program. It is a document that says "given these inputs, produce these outputs." Anyone can build their own version in whatever language they want, as long as it follows the spec.

Geth is the big one. Written in Go. Runs on most Ethereum nodes. But there are others: Nethermind (C#), Besu (Java, made for enterprise), Erigon (Go, optimized for disk), and Reth (Rust, built by Paradigm). The core devs actually want this diversity. Why? If 95% of nodes run Geth and Geth ships a critical bug, the whole network is in trouble. Spread across five clients and a bug only hits 20% of nodes. The rest keep humming.

Layer 2 networks add their own twist. Arbitrum made a modified version called the Arbitrum VM. Optimism aims for "EVM equivalence," byte-for-byte identical behavior. zkSync Era goes further. It compiles EVM bytecode into a format that works with zero-knowledge proofs. Totally different execution path under the hood. But to a Solidity dev? It still looks the same. The fact that radically different architectures all present the same face to developers is honestly one of the most underrated things about the EVM.

As a developer, you mostly don't care which client processes your contract. You write Solidity, compile to bytecode, deploy. The spec guarantees the same result everywhere.

Smart contract development on the EVM: what developers actually deal with

Web developers who try building for the EVM get a rude wake-up call. Bugs cost real money. You cannot patch production. Ship a broken contract and it stays broken unless you planned ahead.

Solidity powers over 90% of EVM contracts. The tooling has gotten good. Hardhat gives you JavaScript/TypeScript with plugins. Foundry uses Rust, runs faster, and lets you write tests in Solidity itself. Both spin up a local EVM so you can test without paying gas. I would go with Foundry for any new project. Once your test suite grows past a hundred tests, the speed gap becomes obvious.

Token standards keep the ecosystem organized. ERC-20 covers fungible tokens like USDT, LINK, UNI. ERC-721 is for NFTs. ERC-1155 handles multi-token contracts. ERC-4626 does yield vaults. All of them work the same on every EVM chain. Write your contract once, deploy it on Ethereum, Arbitrum, Base, Polygon. Same code, same behavior.

Security? Rough. Reentrancy attacks have drained hundreds of millions over the years. The DAO hack in 2016 split Ethereum in two because of a reentrancy bug that let an attacker loop withdrawals and drain $60 million. Integer overflows were a plague until Solidity 0.8 added default checks in 2021. Access control mistakes still pop up in audited code from pro teams. Tools like Slither, Mythril, and Certora catch some bugs, but nothing replaces a proper audit. And even audits miss things. That is just how it is.

Deploying today: a basic ERC-20 token costs $5-20 on mainnet. A full DeFi protocol? Maybe a few hundred bucks. On L2 networks? Pennies. No wonder 65% of new contracts in 2025 went up on Layer 2.

The EVM ecosystem in 2026: Layer 2 dominance and what comes next

Three years ago, Layer 2 networks held $4 billion in TVL. Now it is over $50 billion. Arbitrum alone has $16.6 billion. Base sits at $10 billion. Optimism at $6 billion. This shift happened because L2 fees dropped to almost nothing. Sub-penny swaps on most rollups. Even mainnet fees fell below a dollar. People used to say Ethereum cost too much and everyone should use Solana. That line does not land the way it used to.

Account abstraction (ERC-4337) has quietly changed the game in 2025 and 2026. Smart wallets let users pay gas in stablecoins, bundle several actions into one transaction, and recover accounts without seed phrases. If you have ever watched a friend rage-quit crypto because MetaMask made them approve two pop-ups for one swap, you understand why this matters. The gap between a crypto wallet and a normal bank app is shrinking.

What is next? I am watching a few things. EOF (EVM Object Format) cleans up bytecode so validation is cheaper and tools work better. Parallel execution research could let the EVM handle independent transactions at the same time instead of one by one. Still early, but if it works, throughput jumps without changing anything for developers. And Verkle trees keep getting closer to shipping.

Competition is real, though. Solana's SVM pushes higher throughput. MoveVM introduced patterns that prevent whole categories of bugs. But look at the numbers. The EVM ecosystem holds $190+ billion in DeFi TVL. Monthly DEX volume tops $400 billion. Over 20,000 developers build on it. Nearly 11 years of battle testing. Newer VMs win benchmarks. The EVM wins at everything that actually matters when real money is on the line.

Any questions?

Ethereum went live in July 2015 at about $0.30 per ETH. A thousand dollars would`ve gotten you roughly 3,333 ETH. At $1,800 per ETH in early 2026, you`d be sitting on around $6 million. Of course, that`s the best-case scenario; you`d also have needed the nerve to hold through multiple 80%+ crashes. Past crypto returns are notoriously poor predictors of future ones.

No. ERC-20 is a set of rules that tells fungible tokens (USDT, LINK, UNI) how to behave. The EVM is the machine that runs those rules. When you send USDT or swap LINK on a DEX, the EVM is the thing reading the ERC-20 contract code and making the transfer actually happen.

Nope, two different things. ETH is the coin you buy and sell. The EVM is the engine that runs smart contracts. If Ethereum were a car, ETH would be the gasoline and the EVM would be what is under the hood. You burn ETH to pay gas, and that gas keeps the EVM running. But ETH and the EVM are not the same thing at all.

Yes. Ethereum invented the EVM, so calling it "compatible" is like asking if English is compatible with the English dictionary. When people talk about EVM compatibility, they mean other chains like BNB Chain, Polygon, or Avalanche that copied Ethereum`s VM so devs could move their Solidity code over without rewriting a single line.

You write code in Solidity. A compiler turns it into bytecode, which is what the EVM actually reads. Nodes across the Ethereum blockchain pick up that bytecode and run it one instruction at a time. Each node does the work on its own with the same inputs, so they all get the same answer. Gas fees put a price on every step. That way infinite loops can not freeze the network, and validators get paid for doing the heavy lifting.

Think of it as the engine under Ethereum`s hood. Every computer on the network runs a copy. They all crunch the same transaction and get the same answer. No single machine is in charge. Nobody can tamper with it. Thousands of nodes all agreeing at once is the only thing keeping it honest.

Ready to Get Started?

Create an account and start accepting payments – no contracts or KYC required. Or, contact us to design a custom package for your business.

Make first step

Always know what you pay

Integrated per-transaction pricing with no hidden fees

Start your integration

Set up Plisio swiftly in just 10 minutes.