Ethereum Virtual Machine (EVM) is a decentralised runtime environment that executes smart contracts, processes transactions, updates account balances and has memory to save information thus maintaining the state of the Ethereum blockchain.
The software runs across the thousands of nodes that make up the Ethereum network, meaning the EVM doesn’t have a central computer or unit.
EVM is the reason why Ethereum is not just a distributed ledger but stands as the largest dApp and smart contract-enabling blockchain.
Understanding How EVM Work
Let’s Start by Understanding What a Virtual Machine (VM) is:
A virtual machine is a software-based emulation of a physical computer, equipped with a CPU, memory, configuration settings, and software, capable of connecting to the internet. Operating as an independent computer system, it can execute application programs just like a physical computer.
A virtual machine has its own operating system (OS), enabling users to run multiple operating systems and applications on a single physical machine, known as the host machine.
One use of virtual machines is to run application programs that may not be compatible with your operating system. For example, if you own a computer using a Linux operating system and you want to install an application program that runs on Windows.
You can install a virtual machine with a Windows operating system and then proceed to install the application program.
EVM the Decentralised Virtual Machine
Decentralised Virtual Machines (DVMs) operate independently of any single computer, instead relying on a network of participating devices or nodes to provide the computing power and resources necessary to execute their operations and code.
DVMs, such as the Ethereum Virtual Machine (EVM), are specifically designed to facilitate the execution of smart contracts within blockchain technologies.
The distributed and decentralised nature of DVMs like EVM makes them resistant to censorship and tampering. This resilience arises from the absence of a single point of failure and the lack of central authority, a direct result of decentralisation. Every Ethereum node operates on the EVM to maintain consensus across the blockchain.
The Language of the Ethereum Virtual Machine
The most popular programming language developers use on Ethereum to write their smart contract codes and decentralised applications is Solidity, followed by another programming language called Vyper.
However, since EVM cannot understand English like humans, the network must translate the code before deploying it.
This is where compilers come into play, compilers are software that acts as a translator between the machine and the developer’s programming language.
Compilers convert human-readable Solidity code to the machine-readable version: In EVM’s case, this code is translated to “bytecode” so that the EVM can read the instructions.
EVM has pre-defined sets of instructions known as “opcode” or ‘operational code”. Bytecode sequences correspond to and trigger these opcodes. Then EVM executes all of the requests represented by the opcode.
EVM opcodes assist the EVM in completing the specific tasks of a smart contract or transaction. Currently, there are around 158 Opcodes available on the EVM. They cover a range of operations including arithmetic, stopping, logging, duplication, push, memory, comparison, exchange, etc.
In essence, developers use programming languages like Solidity to write smart contract code on the Ethereum blockchain, which is then compiled into bytecode, enabling the execution of up to 158 predefined EVM operations known as opcodes.
Gas Fee – The Fuel of EVM
The EVM runs code depending on the executed smart contract (ie. depending on how many and which Opcodes will need to be used for the request), there will be an associated gas fee for the execution of the smart contract
Gas is a unit of measurement used to assign a cost to each operation executed on the EVM.
The cost of gas for any operation depends on how many Opcodes will be needed to be used for the request. The amount of computational effort required to execute operations on a blockchain network.
In theory, when you are paying gas fees, you are paying for the opcodes to be executed by the EVM. The more opcodes there are, the higher your gas fees will be. Every EVM computation requires gas fees otherwise, the transaction will not be processed.
The gas mechanism acts as a deterrent against spamming and denial-of-service (DoS) attacks on the Ethereum blockchain by requiring users to cover the gas costs associated with their transactions. Potential attackers are dissuaded by the significant expense involved in executing such attacks, as they must pay for the gas consumed by each transaction. Consequently, these attacks become financially impractical and less profitable.
Other Key Features of the Ethereum Virtual Machine
Turing-Complete Virtual Machine
Turing completeness denotes a machine’s capability to solve any problem provided it has adequate resources. While the Ethereum Virtual Machine (EVM) is Turing complete, its operation is subject to the availability of gas, introducing a limiting factor.
In essence, although the EVM possesses the theoretical ability to address any computational problem, its practical execution is constrained by the amount of gas allocated to a given task.
This reliance on gas imposes limitations on the complexity and scale of computations that can be performed within the Ethereum ecosystem.
EVM Space Capacity
The Ethereum Virtual Machine (EVM) employs three primary space components:
Stack: This functions as temporary storage with a maximum capacity of 1024 items, where all operations are executed.
Memory: Serving as temporary storage accessible solely during smart contract execution, its contents are discarded once the contract execution concludes.
Storage: This component represents permanent memory, where data is stored on the Ethereum blockchain. Unlike stack and memory, the utilization of storage memory incurs higher gas fees.
Benefits of the Ethereum Virtual Machine (EVM)
- The Ethereum Virtual Machine (EVM) facilitates complex and deterministic computations on the blockchain and oversees the execution of smart contracts. Irrespective of the where or who is executing a smart contract, the output remains consistent for a given input.
- Operating within a sandboxed environment distinct from the rest of the blockchain, the EVM guarantees that executing code within the Ethereum network cannot compromise the integrity of the blockchain. Designed to function independently from the broader computer system, the EVM ensures isolation and security during smart contract execution.
Closing Thoughts
At the time of writing, data from Defillama shows that the Total Value Locked (TVL) in the Ethereum blockchain is $64.2 billion. Following Ethereum is Tron, with a TVL of $9 billion, making it the second most valuable smart contract supporting blockchain.
This dominance in the dApp and DeFi space has positioned Ethereum as the most valuable smart contracts public blockchain network globally.
The meteoric growth of Ethereum has established the Ethereum Virtual Machine (EVM) as an industry standard. So much so that rival blockchain networks are designing their systems to be compatible with it.
Numerous blockchain networks are specifically designed to be EVM-compatible. This compatibility allows these blockchains to execute Ethereum smart contracts, facilitating developers in deploying their smart contracts across Ethereum and multiple EVM-compatible chains seamlessly.
Some examples of EVM-Compatible chains include Ethereum, BNB Chain, Polygon, PoS Avalanche, Optimism, and Arbitrium.
Wallet addresses on these blockchains begin with “0x” followed by 40 characters of alphanumeric code. They all adhere to the same wallet addressing scheme. As a result, users can use the same wallet address across all EVM-compatible blockchains from one wallet, merely needing to switch networks.
[Author’s Note: This article does not represent financial advice, everything written here is strictly for educational and informational purposes. Please do your own research before investing.]
Author: Godwin Okhaifo