Ethereum Virtual Machine (EVM): Everything you need to know
When Vitalik Buterin built Ethereum, he wanted to push the boundaries of blockchain technology. Bitcoin inspired him, but he felt the tech should do more than just process transactions. As a result, he built the Ethereum blockchain network. Ethereum has all the features of Bitcoin. It can process peer-to-peer transactions and store them in an immutable and decentralized way. It can also do certain things that Bitcoin cannot. For instance, it can run smart contracts.
So how does a blockchain run a smart contract? In Ethereum's case, the answer is the Ethereum Virtual Machine (EVM). The EVM forms the backbone of how the Ethereum network operates. In this article, we discuss what EVM is, how it works, its benefits, and use cases. But before we dive deep, let's have a quick recap about smart contracts.
What are smart contracts?
Smart contracts are computer programs or applications that run autonomously on a blockchain network. They consist of data codes developers deploy to carry out specific instructions. Users do not control smart contracts as they run as programmed.
The Ethereum network is the first blockchain to implement smart contracts. As a result, millions of smart contracts are coded and deployed on the Ethereum blockchain today. The EVM played a vital role in achieving that feat.
What is the Ethereum Virtual Machine (EVM)?
The EVM is built into the heart of its protocol. As its name suggests, the EVM is a virtual machine or digital software that powers the Ethereum network. Virtual machine software can execute programs, store data, connect to networks, and perform other computational tasks. It is also responsible for the code execution and deployment of smart contracts.
How it works
Since Ethereum processes more than just peer-to-peer value transactions, it requires an intricate computation system. So, instead of calling the network a distributed ledger, Ethereum developers refer to it as an ¨unbounded state machine¨. And that is a basic description of how the EVM works. The Ethereum network thus comprises two states: a world state and a machine state.
The world state is where Ethereum stores its account balances and smart contracts. Similarly to the Bitcoin ledger, it is decentralized, immutable, and accessible to everyone online. The EVM updates this layer every time it completes a transaction. That means everyone with a block explorer can view the Ethereum blockchain and see the same data in real time.
The machine state is where the EVM carries out the step-by-step processing of transactions. It is also popularly referred to as Ethereum's sandbox for developers. The Ethereum network processes two types of transactions. The first type is the ¨message call¨ — when one account transfers ETH tokens to another. In this scenario, the EVM moves the ETH tokens from one wallet address into another. Which then updates the transaction on the world state. The sender is charged gas fees for the computations completed in sending the transaction.
The second type of transaction is called ¨contract creation¨. It refers to when a developer wants to execute a smart contract onto Ethereum. In this scenario, the sender supplies gas fees and inputs a ¨Smart Contract bytecode¨.
Solidity programming language
Smart contract execution
As the EVM executes the code, the gas supply reduces according to the gas cost of the computations executed. If, at any point, the gas supply is reduced to zero before the transaction is complete, the EVM immediately halts. It abandons the transaction and makes no changes to the world state. The network is unaffected, but the sender's ETH balance goes down to pay for the computations used to execute the code to the halting point. However, if the execution completes successfully, the EVM updates the world state to match the machine state version.
Ethereum gas fees
As we can see from the above, gas fees play a crucial role in processing transactions on the Ethereum blockchain. When Ethereum used the Proof of Work (PoW) consensus mechanism, processing a transaction required hardware and electricity, and miners required incentives to carry out their tasks. In the case of processing ETH token transfers, gas fees vary depending on the congestion of the pool.
When executing smart contracts, gas fees take on a different role. At the point of execution, Smart Contract bytecodes are broken down into smaller pieces called ¨opcodes¨. Opcodes are short for Operational Codes and are the instructions the EVM uses to perform computations. Each opcode is assigned a gas fee — the more complex the opcode, the higher the cost. This step is essential in keeping the Ethereum blockchain secure from malicious attacks. For example, if a user deploys a DDos attack, the EVM will continue executing the smart contract in the machine state. It will charge gas fees for every computation, and when the sender runs out of gas, it will abandon the transaction.
What are the benefits of EVM?
As described above, the EVM prevents malicious activities from attacking the network. Therefore it enables the execution of smart contracts and other automated services in a secure and trustworthy platform.
The Ethereum network has the largest crypto ecosystem. It is the gold standard for Dapp creation and smart contract deployment. Many other blockchains have created side chains that allow Ethereum developers to transfer their applications without changing the code.
EVM is also decentralized, meaning anyone can create a smart contract on Ethereum without permission. It also enables developers to build and deploy decentralized services and applications, recently gaining massive popularity.
EVM use cases
With the Ethereum Virtual Machine executing smart contracts, many new inventions have hit the blockchain space. Here are the top five EVM use cases:
ERC-20 tokens are generated by smart contracts using predefined data structures. The data structure is responsible for giving the token a name, distributing it, and keeping track of it. In 2017, when initial coin offerings (ICOs) were popular, many new cryptocurrencies were launched using the ERC-20 tokens. Today, the best use of ERC-20 tokens is for stablecoins, like USDT.
Decentralized Exchanges (DEXs)
Decentralized exchanges (DEXs) allow users to buy, sell or trade crypto by deploying smart contracts. Exchanges such as Uniswap and ShushiSwap also use automated market makers (AMMs) applications, allowing users to tap into the liquidity pools of tokens without third-party interference.
Non-fungible tokens (NFTs) are digital artwork stored on the blockchain. They authenticate ownership and cannot be copied. Blockchain enthusiasts use smart contracts to create and mint NFT collections. Some of the most expensive NFT collections include the Bored Ape Yacht Club (BAYC) and Cryptopunks. Owners can transfer or trade their NFTs on marketplaces such as OpenSea.
Decentralized finance (DeFi) Lending refers to platforms that allow users to lend or borrow cryptocurrencies without using a third party. Smart contracts govern the borrowing and lending protocols. Loans are issued immediately to borrowers, and lenders sometimes receive interest daily.
Decentralized Autonomous Organizations
A decentralized autonomous organization (DAO) is a communal entity that lacks a central authority. In DAOs, individual members collectively make governing decisions regarding the project. The rules of a DAO are established by core community members and implemented through smart contracts.
The EVM has two significant limitations. Firstly, it requires users to have foreknowledge of Solidity and coding skills. Many people need help coding, making it difficult for new users to create and interact with smart contracts.
Its second limitation is that gas fees can become very expensive when creating a smart contract or deploying an Ethereum network application.
Which cryptos are EVM compatible?
EVM-compatible blockchains are a simple solution to solving the expensive gas fee problem. Developers have borrowed certain parts of the Ethereum network and created DApps that enable users to quickly and easily move assets between any EVM networks. Many of the most popular blockchains in use today follow this EVM-compatible approach, mainly:
- Binance Smart Chain
The future of EVM
Building upon the basic foundation of Bitcoin, Vitalik Buterin's vision is to create a decentralized supercomputer that is accessible to all virtually. The Ethereum Virtual Machine has had a huge role in making that vision a reality. Since its conception, the EVM has had several upgrades and continues to evolve and improve. Given that smart contract applications drove the last major trends, it is amazing to imagine what this technology will unlock.
What is an EVM in crypto?
EVM stands for Ethereum Virtual Machine. It is digital software that enables the Ethereum network to execute and deploy smart contracts.
Which cryptos use EVM?
Many of the most popular blockchains in use today follow this EVM-compatible approach, mainly:
- Binance Smart Chain
Is Solana EVM based?
No. Solana is not compatible with EVM. It uses its own unique infrastructure, developer tool sets, and token standards.
What are the benefits of EVM?
- The EVM is a secure environment that allows developers to create and deploy smart contracts, immune from hackers.
- The EVM is interoperable, meaning developers can easily and quickly transfer their applications onto different blockchains without changing a line of code.
- The EVM is also decentralized. It allows anyone to create and interact with smart contracts without needing permission.