Ethereum Virtual Machine (EVM)

Wiki Powered byIconIQ
Ethereum Virtual Machine (EVM)

Official Website:
Social Profiles:

We've just announced IQ AI.

Check it out

Ethereum Virtual Machine (EVM)

Ethereum Virtual Machine(EVM) is a decentralized computation engine that executes on the network. EVM ensures that code within smart contracts runs exactly as intended by enforcing rules and maintaining consistency across the network. [1][2]

Overview

A virtual machine (VM), as the name indicates, is related to the virtualization of the actual computer. The EVM blockchain is designed to be the infrastructure for smart contracts based on . Initially, it was built to avoid the attacks that pose a threat to the crypto space. [3]

Ethereum Virtual Machine (EVM) was designed by during his work on . Written in C++ and using the LLVM Project compiler, EVM is a special state machine that operates continuously and whose immutable operations determine the state of each block in the Ethereum [1]

The Ethereum Virtual Machine (EVM) is a fundamental component of the network. EVM is the core feature that makes Ethereum more than a like . Forming the backbone of the Ethereum Blockchain, EVM provides developers with a run-time environment to create and in languages like Solidity, Vyper, Python, and Yul, among others.[1][4]

EVM has access to all in the network, handles smart contracts execution, and handles all transactions on the Ethereum blockchain without any major downtime reported.[1]

Elements of EVM

Opcodes

EVM opcodes assist EVM in executing specific tasks of or transactions. Aiming for efficiency, EVM converts its bytecode to opcode, where each opcode is assigned one byte in bytecode. Each opcode operation requires a certain amount of gas to be used by the EVM.[4]

Smart Contracts

Every time a gets executed, the EVM computes the new state of the Ethereum network, updating the account balances, data storage of smart contracts, and transactions on the account and contract levels. All these functions are what lives inside of the called state. EVM is the environment where these smart contracts could live and interact with each other, where EVM combines the resources of thousands of CPUs connected to the network. EVM cannot directly execute Solidity, so the code is compiled to machine instructions called opcodes, and gas is needed to use opcodes.[4][8]

Gas

The main objective of is to act as the fee for computing the operations of a smart contract done by each node in the Ethereum network. The computation fees prevent an attacker from deploying many complex contracts that will require long computation times to halt the network. These fees make this type of ) attack too expensive to be executed.

Gas also serves as compensation for responsible for guaranteeing that the information in the transactions is valid. When network activity is high, people will raise their gas limit to get their transactions executed and validated. This way, validators will choose from the mempool the transactions with higher gas limits.[4]

How EVM works

Virtual machines are essentially creating a level of abstraction between the executing code and the executing machine. This layer is needed to improve the portability of software, as well as to make sure applications are separated from each other, and separated from their host.

Smart contract languages like Solidity cannot be executed by the EVM directly. Instead, they are compiled into low-level machine instructions called opcodes. These opcodes allow the EVM to be Turing-complete. Because opcodes are 1 byte, there can only be a maximum of 256 (16²) opcodes.
1_wPF4wH9t5AVwB8ffj03nfg.webpTo efficiently store opcodes, they are encoded to bytecode. Every opcode is allocated a byte. During execution, the bytecode is split up into its bytes (1 byte equals 2 hexadecimal characters).
1_5Xu21kO2n6y7mSPoZ2sXTg.webpEVM uses a 256-bit register stack from which the most recent 16 items can be accessed or manipulated at once. In total, the stack can only hold 1024 items. Because of these limitations, complicated opcodes instead use contract memory to retrieve or pass data. However, memory is not persistent. When contract execution finishes, the memory contents will not be saved. Thus, while stack can be compared to function arguments, memory can be compared to declaring variables. In order to store data indefinitely and make it accessible for future contract executions, one can use storage.

Since all contract executions are run by everyone running an Ethereum , an attacker could try creating contracts including lots of computationally expensive operations to slow down the network. To prevent such attacks from happening, every opcode has its own base gas cost.

At the end of this bytecode, a Swarm hash of a metadata file created by Solidity gets appended. Swarm is a distributed storage platform and content distribution service, or, more simply stated: a decentralized file storage. The metadata file contains various information about the contract, such as the compiler version or the contract’s functions. This is an experimental feature, and not many contracts have publicly uploaded their metadata to the Swarm network.[1][3][5][6]

Use Cases

Smart Contracts

The EVM executes , enabling to run autonomously without intermediaries.[4][7]

Decentralized Finance (DeFi)

EVM powers applications, facilitating financial services like lending, borrowing, and trading without traditional banks.[4][7]

Tokenization

Creation and management of digital tokens, including tokens, which are widely used for various projects.[4]

Cross-Chain Compatibility

-compatible chains enable interoperability between different networks.[4][7]

DAOs

governs the EVM. A DAO is a community project without a central authority, giving the members total control of the project. Besides being autonomous, DAOs are transparent. Smart contracts stipulate the guidelines and implement policies based on the coded instructions. Since DAO activities are accessible, verifiable, and open to public audit, the participants can learn how the protocol runs. [7]

Virtual Machines for Other Blockchains

Other chains, aside from Ethereum, also offer their virtual machines. Some examples are the Virtual Machine (AVM), Virtual Machine (NeoVM), and Rootstock Virtual Machine (RSK), which are built on top of the network and allow developers to write code for on . [4]

Benefits and Drawbacks of EVM

Benefits

Developers can execute code without worrying about its impact on the rest of the network or the possibility of it playing truant with data or personal files hosted on any of the node computers. Additionally, they can run complex on different computing environments with distributed consensus. This ensures that the failure of a single node does not have any negative impact on the running of the or smart contract, since the EVM code remains the same across all nodes.

The sanctity of the outcome that EVM makes is well-suited to the sustainable expansion of the DApps and smart contract Ethereum ecosystem. Add to this the library of standard codes available for developers to choose from, an increasing number of EVM-compatible  blockchains, and a large number of potential EVM use cases, and it is easy to see why the EVM is the preferred platform for  development.[1]

Drawbacks

The most important of downside that needs to be considered is the high transaction fees or gas costs associated with running a on the Ethereum network. Paid in , these fees vary depending on the complexity of the contract and the network congestion at the time of execution, making it imperative for developers and entrepreneurs to price their services accordingly.

Additionally, since Solidity is the most preferred language for coding on the EVM, it does imply that developers need to have adequate experience with it and possess a modicum of technical expertise to create efficient smart contracts by using it. If developers choose to code using other languages, they need to be careful in resolving any inherent repetitions in the code since the EVM will proceed to compile them anyway. While upgrading smart contracts is possible at a later stage, it comes with security risks associated with creating an intermediary smart contract that references the address of the original smart contract.[1]

See something wrong?

Edited By

Profile picture of Anonymous uservzbrv

Edited On

October 28, 2024

REFERENCES

[1]

Cointelegraph - What is an Ethereum Virtual Machine (EVM) and how does it work?

May 15, 2024

[2]

Coinbase - What is the Ethereum Virtual Machine (EVM)?

May 15, 2024

[3]

Medium - Understanding the Ethereum Virtual Machine: A Comprehensive Guide with Diagrams

May 15, 2024

[4]

Medium - Crypto 101: Ethereum Virtual Machine (EVM)

May 15, 2024

[5]

Medium - The Ethereum Virtual Machine — How does it work?

May 15, 2024

[6]

Coinbase - What is the Ethereum Virtual Machine (EVM)?

May 15, 2024

[7]

Coingecko - What is the Ethereum Virtual Machine (EVM), and How it Works

May 15, 2024

[8]

Coinmarketcap - Ethereum Virtual Machine (EVM)

May 15, 2024