Understanding the concept of Ethereum Virtual Machine

EVM is a software architecture that enables developers to create decentralized Ethereum applications. The EVM has also been used to develop projects similar to NFTs and the Metaverse.

Understanding the concept of Ethereum Virtual Machine

What is EVM?

Every Ethereum node includes the Ethereum Virtual Machine (EVM), a customized software virtual stack that executes contract bytecode. With the help of the EVM software architecture, programmers may design decentralized Ethereum apps (DApps). Understanding the EVM requires at least a basic knowledge of terms used often in computer science, such as bytes, memory, and a stack. Understanding cryptography and blockchain fundamentals like hash functions, proof-of-work, and the Merkle tree would also be beneficial.

Smart contracts and all Ethereum accounts are stored on this virtual machine. High-level programming languages like Solidity are frequently used to create contracts, which are ultimately translated into EVM bytecode. This indicates that the network, disc, and other features of the host computer are isolated from the machine code. Each node in the Ethereum network has an EVM instance running, which enables them to agree on a single set of instructions to be executed. Since the EVM is Turing complete, it can complete any computation's logical steps.

What are smart contracts?

On the Ethereum blockchain, smart contracts are algorithms. A contract is a group of information and program codes kept at an Ethereum address. It's a real cryptocurrency account. Like any other account, they may transmit transactions via the network, but instead of being controlled by a user, they are released to the network and run in accordance with their programming.

Turing Complete

The well-known computer scientist Alan Turing is credited with the invention "Turning machines". Turing machines sometimes referred to as automatic machines, are fictional devices that reflect Turing's concept of artificial intelligence. The cognitive process is guided by algorithms.

Purpose of an EVM

The EVM's purpose is to ascertain the general state of Ethereum for every blockchain block. Like all other blockchain-based networks, Ethereum utilizes a distributed ledger to record transactions and has its own native currency (ETH), with certain limitations on how users may interact with the network. On the other hand, Ethereum's smart contract features provide a further level of functionality.

A "distributed state machine" is what is referred to as the second layer. The state of Ethereum may be described as nothing but a huge database including all ETH accounts and balances. The state of Ethereum may run any type of machine code in accordance with a set of rules and can change with every new block. The regulations governing how the machine changes state with each new block are laid forth in the Ethereum Virtual Machine.

EVM Implementation

The Ethereum Yellowpaper's specifications must be followed in all EVM implementations. The EVM has undergone a number of updates throughout the duration of Ethereum's five-year history, and it has been implemented in a number of different programming languages. An EVM implementation is present in every Ethereum client.

EVM Instructions

The EVM runs as a stack machine with 1024 items of depth. Each item is a 256-bit word, which was chosen for 256-bit cryptography's simplicity of usage. The EVM keeps a temporary memory during execution that is not maintained between transactions. However, contracts also include a Merkle Patricia storage trie that is linked to the relevant account and a part of the global state.

The EVM opcodes that make up the compiled smart contract bytecode execute common stack operations like XOR, AND, ADD, SUB, and others. A variety of blockchain-specific stack operations, including ADDRESS, BALANCE, BLOCK HASH, etc., are also implemented by the EVM.

From Ledger to State Machine

When describing blockchains like Bitcoin, and Ethereum, which employ core cryptographic techniques to allow a decentralized currency, the analogy of a "distributed ledger" is frequently used. Because of the restrictions on what can and cannot be done to change the ledger, a cryptocurrency behaves like a regular currency. For example, a Bitcoin address is only permitted to spend the amount of Bitcoin it has already received. All transactions on the Bitcoin and many other blockchains are supported by these rules.

Although Ethereum includes a native cryptocurrency named Ether that operates according to nearly the same simple rules, it also offers a considerably more effective function called smart contracts. A more elaborate comparison is necessary for this more complicated feature.

Ethereum is a distributed state machine as opposed to a distributed ledger. The state of Ethereum is a sizable data structure that contains not only all accounts and balances but also a machine state that may run any machine code and can change from block to block in accordance with a predefined set of rules. The EVM specifies the particular guidelines for changing the state from one block to another.

Ethereum State Transition Function

When given an input, the EVM works like a mathematical function and generates a predictable outcome. Therefore, it is rather useful to more explicitly define Ethereum's state transition function as follows:

Y(S, T)= S'

The Ethereum state transition function Y(S, T) creates a new valid output state S' from an old valid state (S) and a fresh set of valid transactions (T).

The state of Ethereum is maintained through a massive data structure known as a modified Merkle Patricia Trie, which maintains all accounts connected via hashes and reducible to a single root hash recorded on the blockchain.

Transactions are instructions from accounts that have been cryptographically signed. Transactions fall into two categories: those that lead to message calls and those that lead to contract generation. A new contract account containing compiled smart contract bytecode is created as a result of contract creation. That contract's bytecode is executed each time a message call is made to it from another account.

Advantages and Disadvantages of EVM

  • Using the EVM, anyone may develop their own DApp. This kind of software has many uses and is not just for people who fit a certain profile or have access to wealth or connections.
  • There are a number of possible benefits of smart contracts. One recent example is non-fungible tokens (NFTs). Anyone may produce digital art using NFTs and sell it on a decentralized market. The art market is now more widely accessible online because of this.
  • There are certain centralized components in the EVM system. Most Ethereum nodes are located on centralized cloud computing platforms like Amazon Web Services. The nodes could be turned off, harming or even destroying the network, if the owners of these services decide they don't like Ethereum for any reason. This has occurred in the past, for example with various social networking applications.
  • The EVM requires some technical expertise. Only those who are unable to code are authorized to use the EVM. More user-friendly user interfaces are still being developed. Once again, there exist tools with graphical user interfaces (GUIs) that enable almost anybody to build NFTs and take advantage of associated markets.

EVM compatible blockchains

Since the code has previously through testing, auditing, and frequently even achieved product-market fit, it is simple to implement existing smart contracts on blockchains apart from Ethereum. It's crucial to remember that an EVM is not required to function on the Ethereum blockchain. These blockchains essentially install the identical code that was developed for Ethereum on their own blockchain. Chains compatible with EVM include:

  • Ethereum (ETH)
  • Ethereum Classic (ETC)
  • Avalanche (AVAX)
  • Cardano (ADA)
  • Polygon (MATIC)

Future of the EVM

Stablecoins, NFTs, decentralized finance apps, and metaverse projects have all been developed with the use of the EVM, which is at the core of Web3. In the upcoming years, it's expected that many more innovative projects will be produced utilizing the EVM due to the strong network that has been established around the EVM ecosystem.

Other Reads


Disclaimer: The information contained on this web page is for education purposes only. Readers are suggested to conduct their own research, review, analyze and verify the content before relying on them.

To publish press releases, project updates, and guest posts with us, please email at contact@etherworld.co.

Subscribe to EtherWorld YouTube channel for ELI5 content.

Share if you like the content. Support us at Gitcoin

You've something to share with the blockchain community, join us on Discord!

Follow us at Twitter, Facebook, LinkedIn, and Instagram

Share Tweet Send
You've successfully subscribed to EtherWorld.co
Great! Next, complete checkout for full access to EtherWorld.co
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.