Home  >  Article  >  What is the Ethereum Virtual Machine EVM and what is it used for?

What is the Ethereum Virtual Machine EVM and what is it used for?

DDD
DDDforward
2024-03-06 13:39:211078browse

Earlier Optimism has announced that it will be upgraded to be fully compatible with EVM. Developers can use Solidity smart contracts to directly deploy tools running on Ethereum on Layer 2, which means that the scalability of the Ethereum network is further increased.

So, what does the Ethereum Virtual Machine (EVM) mentioned here mean and what is its use? Let us find out today.

01
What is the Ethereum Virtual Machine?

Students majoring in computer science should be familiar with "virtual machine". "Virtual machine" refers to a complete computer with complete hardware system functions simulated by software and running in a completely isolated environment. system.

To put it simply, a virtual machine is a virtual machine that we simulate through software that is exactly the same as our personal computer. It has the same software and hardware resources as an actual physical computer.

After entering the virtual system, all our daily operations can be performed in this new and independent virtual system. We can independently install and run software, save data, etc.

In this way, we can play around in the virtual machine without fear of various viruses and attacks. At worst, reinstalling the virtual machine will not have any impact on the real system.

What is the Ethereum Virtual Machine EVM and what is it used for?

Just like the six-eared macaque in "Journey to the West" has the same appearance as Sun Wukong, and both have the ability to slay demons. abilities, but they are independent individuals. Even if the six-eared macaque is killed, it will not have any impact on Sun Wukong himself.

We know that the Bitcoin network is like a huge and real-time updated distributed ledger. Computers anywhere in the world can be connected to the Bitcoin system through the Internet. It is decentralized, non-tamperable and open. Transparent features.

There is no virtual machine in this network. The more important function of Bitcoin is to record and store transaction data at any time on the chain.

The Ethereum Virtual Machine, as the name suggests, is an abstract machine built on the Ethereum blockchain, which can isolate programs running on it from each other and from the main chain.

02
What is the use of the Ethereum Virtual Machine?

Compared with Bitcoin, which is regarded as a distributed ledger, Ethereum is committed to becoming a "next-generation smart contract and decentralized application platform" and can be regarded as a program that can run distributed computing platform.

Vitalik also envisions it as a decentralized “world computer.” As a computer, it needs to have functions such as calculation, storage, and execution.

Therefore, in addition to having the basic data storage function in the Bitcoin network, Ethereum also needs to run various codes for calculation, software or applications compiled and interpreted by the Ethereum Virtual Machine (EVM) It's a "smart contract".

When a transfer transaction occurs on the Ethereum chain, the Ethereum Virtual Machine (EVM) will perform the following series of tasks:

· Retrieve the value of the transfer, Analyze the contract's instructions.

· Calculate Gas consumption (handling fee) and ensure that the address sending the transfer has enough Gas fee.

· Execute the contract and transfer the money to the corresponding address.

From the workflow of the Ethereum Virtual Machine (EVM) above, we can get a glimpse of several functions of EVM for Ethereum:

· Easy for testing : In order to ensure the smooth execution of various "smart contracts", we need to create a safe operating environment for them. The Ethereum Virtual Machine is a code operating environment.

As we said above, various operations in the virtual machine will not affect the host. Any developer who wants to create smart contracts on the Ethereum Virtual Machine can test various applications on the virtual machine. It does not occupy main chain resources and is not affected by other blockchains.

· Increase security: Ethereum carries various applications with powerful functions, and their logic becomes more complex, making it easier for developers to develop various vulnerabilities. The Ethereum Virtual Machine is a completely independent sandbox, and the contract code can be completely isolated from the outside and run inside the EVM.

Not only can it prevent criminals or programmers’ programming errors from affecting the entire main chain, it can also prevent the physical equipment running smart contracts from being attacked.

· Guarantee stability: Since the Ethereum virtual machine is deployed on every node of the Ethereum network, the data of the entire Ethereum network is jointly maintained and maintained by many nodes. Update, this maintains the consistency of the entire blockchain data, which also makes Ethereum extremely fault-tolerant, ensuring zero downtime.

03
Summary

It can be seen that the Ethereum Virtual Machine plays an important role in the Ethereum blockchain and provides intelligent The implementation of the contract provides a technical foundation, which not only provides developers with an application testing environment as a whole, but also improves the security and stability of the Ethereum main chain to a certain extent.

However, it also has many flaws and has been criticized. For example, the Solidity language commonly used by EVM lacks a standard library, the contract code does not support upgrades and only supports deployment, and storage space fragmentation and maintenance.

The above is the detailed content of What is the Ethereum Virtual Machine EVM and what is it used for?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:zhihu.com. If there is any infringement, please contact admin@php.cn delete