The official wallet of Supra.

What is the Ethereum Virtual Machine?

June 23, 2022 - 7 min read

The EVM is the manifestation of the collective, decentralized computing power of Ethereum’s nodes which receive and execute smart contract requests, and transition the blockchain from one state to the next.

ethereum virtual machine evm

Introduction

The Ethereum Virtual Machine (EVM) is a sandbox-style runtime environment and deterministic computation engine in which smart contracts are deployed on Ethereum. The term virtual machine is used since the EVM is an emulation of a real computer, with the EVM consisting of the collective abstractions of computation and storage of all Ethereum’s nodes. From a bird’s eye view, the EVM running can be thought of as a decentralized, global computer which contains millions of executable objects, each with its own on-chain data store.

The EVM has no physical shape, and also operates in a more limited domain than other computers. It simply defines and enforces the rules for computing smart contract transactions, reads and records the canonical state of Ethereum’s blockchain, and processes the bytecode of incoming smart contract requests. Thus, the EVM is the foundation of Ethereum’s operational structure.

Ethereum Network as a ‘State Machine’

Ethereum isn’t simply a distributed ledger, as is the case with Bitcoin. It is a distributed state machine. That is, Ethereum’s blockchain state at any given moment is a large data structure holding all accounts and balances held within a modified Merkle Patricia Tree.

This means that users can develop and upload complex smart contracts that are automatically enforced when their defined criteria are met. Following the execution of the smart contracts, they are bundled into the next block with many other transactions, and Ethereum’s new state is updated.

ethereum mainnet state transitions
When transactions are executed, the previous state transitions into the current state, including a new block of transactions which must be validated by Ethereum’s nodes. New blocks are currently ‘mined,’ but will simply be validated by stakers once Ethereum’s upgrade is complete.

Each Ethereum node contributes to the EVM as they are responsible for executing smart contract bytecode. It is simplest to think of the EVM as enforcing the deterministic smart contracts, capturing snapshots of Ethereum’s state, and also performing the transition from one valid state to the next. 

As it’s a decentralized, consensus-based computational machine, the EVM is often characterized as a quasi-Turing-complete world computer. That is, the moniker ‘quasi’ is used since the EVM is able to halt execution after a predefined amount of gas has been spent. Without gas fees limiting the EVM’s computations, it is at risk of running into the halting problem, a state where the EVM executes a program that never stops, like with denial-of-service (DoS) attacks.

Ethereum’s Turing Completeness allows it the potential for backwards and forwards compatibility and the capability to implement any smart contract, even those that have not yet been developed. This holds incredible potential, but makes Ethereum less predictable than Bitcoin’s network, for example.

How Does Ethereum’s Virtual Machine Work?

For Ethereum smart contracts to be executed properly, it must be verified that prior conditions have been met. Every Ethereum node runs an EVM instance which allows them to all use the same standards for implementing smart contracts on the network so long as the bytecode is compatible with those standards. For example, ERC-20 is the standard for token compatibility while ERC-721 is the standard by which non-fungible tokens (NFTs) are implemented. 

Some smart contracts involve more complex conditionality, requiring inputs from external data sources, called hybrid smart contracts. Oracles fetch and validate external data for hybrid smart contracts, enabling a variety of novel use cases aside from transacting on Ethereum’s blockchain. Other smart contracts simply request transactions between two parties, while still more call upon or otherwise are determined by other smart contracts within Ethereum’s infrastructure.

So, the EVM tracks the current state of Ethereum’s blockchain and executes the smart contracts by reaching consensus amongst the nodes running it in order to add all of the new transactions and take a snapshot of each subsequent state of the blockchain. 

In practice, this means that when users enter into smart contracts with one another, the EVM is the engine that facilitates and records subsequent transfers of value in a totally decentralized manner. As smart contract conditions are met and their execution is complete, the EVM ensures that the new, current state is accurate through its nodes reaching consensus and producing the next block.

Clearly, the EVM operates at a higher level of abstraction than typical operating systems. In fact, the EVM can be run using a number of varying implementations, with many of them having been written in different languages. For instance, the most popular implementation of the EVM is called Geth, written in the Go language. Some other notable examples are Parity written in Rust, Aleth in C++, Trinity in Python, EthereumJS in Javascript, and Hyperledger Besu written in Java, just to name a few.

EVM-computing-flowchart-1
Virtual machines approximate the computing power of physical machines using virtual architecture. They can run on many different types of OS’s and hardware, making them the perfect engine for a decentralized ecosystem.

Through a VM, developers and network participants can build, process, and execute smart contracts however they want without permission from the network. They simply need to upload code which is compatible with the EVM’s standards. Thus, the EVM acts as a global processor for the Ethereum blockchain, with all of its accumulated computing power at the disposal of developers. 

This is attractive for developers and users alike since the network is so powerful, yet permissionless to use. Never before have so many open-source computer software experimentations been conducted, and so we may expect never-seen-before outcomes with regards to innovation.

EVM Nurtures Composability as Neutral Computational Infrastructure

Unsurprisingly, many Web3 protocols have sought to join forces with Ethereum to leverage the EVM’s infrastructure, developer tools, and its broader network effects. For instance, Layer 2 scaling solutions like Arbitrum, Optimism, and Polygon have all benefited from the EVM’s permissionless compatibility. 

Some have even argued that Polygon has become its own Layer 1 more recently thanks to the attention it got as an Ethereum L2. Some L1 blockchains with EVM-compatibility include Fantom’s Opera, Kusama’s Moon River, Avalanche’s C-Chain, Near Protocol’s Aurora, Cosmos’s Evmos, and Binance’s Smart Chain, just to name a few.

The EVM is an ecosystem which has given rise to a decentralized economy taking on a life of its own. Through gas incentives and permissionless P2P smart contract functionality, it sure seems it is living up to its moniker as “world computer.” Though its scalability is still in question, made obvious by outrageous gas fees, the protocol’s gas system nevertheless guarantees that fees are paid before making a request of its Mainnet, thus protecting the integrity of the system and adequately rewarding its honest participants.

By simply understanding the EVM, readers are already well on their way to more effectively taking part in Ethereum’s ecosystem as a consumer, miner, node validator, investor, developer, entrepreneur, or creator. Developers can use their creativity by writing code in a number of programming languages, and building dApps that fulfill use cases for enterprises and retail users alike. 

The key to the EVM’s success is the low barrier for entry, massive network of developers and users, and its composability. That is, developers and users can build decentralized versions of any business model in which it would increase the security or user experience, and share it with the world. The opportunities for greatness are out there, and now it’s time for innovative developers and organizations to reach out and take them.

References

  1. Antonopoulos, A. M., & Wood, G. (2018). Mastering Ethereum: Building smart contracts and dApps. O’Reilly Media. 
  2. Kasireddy, P. (2017, 27 Sep.). How does Ethereum work, anyway? Medium.
  3. Lipton, A., & Treccani, A. (2021). Blockchain and distributed ledgers: Mathematics, technology, and economics. World Scientific. 
  4. Szabo, N. (1997). Formalizing and securing relationships on public networks. First Monday, 2(9).
  5. Ward, C. (2020, 11 Jun.). Patricia tree. Ethereum Wiki.

Related Articles

Learn More

twitterlinkedinfacebookmail

RECENT POSTS

Recibe noticias, información y más.

Suscríbete al boletín de Supra para recibir noticias, actualizaciones, análisis de la industria y más.

PrivacidadCondiciones de usoUso de datos del sitio web y cookiesRevelación de bugs (errores)Política de privacidad de la información biométrica

©2024 Supra | Entropy Foundation (Suiza: CHE.383.364.961). Todos los derechos reservados