What is EVM (Ethereum Virtual Machine)?

QuickNode
2 Jun 202305:32

Summary

TLDRIn this informative video, Sahil from QuickNote introduces the Ethereum Virtual Machine (EVM), a distributed state machine that executes smart contracts and processes transactions on the Ethereum blockchain. He explains how EVM, being Turing complete, can handle complex operations and is not limited to Ethereum but is also utilized by other blockchain ecosystems like Polygon and Binance Smart Chain. The video covers the compilation of smart contracts into bytecode, the concept of gas for opcode execution, and the Merkel Patricia tree structure that maintains the state of the blockchain.

Takeaways

  • đŸ–„ïž A virtual machine is a simulated computer that can run various operating systems and applications.
  • 🔱 Programming languages like Python, JavaScript, and Go need to be compiled into machine code for execution by computers or virtual machines.
  • 🌐 EVM, or Ethereum Virtual Machine, is a virtual machine maintained by all node runners in a blockchain network, not just a single computer.
  • đŸ’Œ Ethereum is more complex than Bitcoin as it is a distributed state machine that processes financial transactions and smart contracts.
  • 📝 Smart contracts are written in Solidity for EVM-based environments, but EVM cannot understand Solidity code directly and requires compilation into bytecode.
  • đŸ› ïž Each function in the smart contract's bytecode has opcodes that are machine instructions telling the EVM which operation to perform.
  • 💰 Executing opcodes on EVM requires a fee, as it uses resources provided by node runners, and these fees are measured in a unit called gas.
  • 🌟 The complexity of smart contract functions determines the amount of gas required, with more complex functions consuming more gas.
  • 🌳 EVM is structured as a huge Merkle Patricia tree where accounts are linked with hashes and reducible to a root hash stored on the blockchain.
  • 🔄 Once a transaction is confirmed, the Merkle Patricia tree is updated, reflecting the updated state of the blockchain.
  • 🔄 EVM is a Turing complete machine, capable of producing an output given enough input, memory, and gas fee, allowing for the conversion of code from other languages to Solidity.
  • 🔗 The capabilities of EVM extend beyond Ethereum, as other blockchain ecosystems like Polygon, Avalanche, and Binance Smart Chain also use it as their state machine.

Q & A

  • What is a virtual machine?

    -A virtual machine is a software-based simulation of a computer that runs on remote servers, capable of running various operating systems and applications.

  • Why is a compiler required to run applications on a virtual machine?

    -A compiler is needed to convert high-level programming languages into machine-understandable language, consisting of zeros and ones, for execution on virtual machines.

  • What does EVM stand for?

    -EVM stands for Ethereum Virtual Machine, which is a virtual machine for the Ethereum blockchain network.

  • How does the Ethereum Virtual Machine differ from a traditional virtual machine?

    -Unlike traditional virtual machines that run on a single computer, the EVM is maintained by all node runners of the blockchain network and processes not only financial transactions but also smart contracts.

  • What is a smart contract and how is it related to the EVM?

    -A smart contract is a program that runs on the blockchain and executes automatically when certain conditions are met. The EVM is responsible for executing these smart contract transactions.

  • In which programming language are smart contracts typically written for the EVM?

    -Smart contracts are typically written in Solidity for an EVM-based environment or ecosystem.

  • Why can't the EVM understand Solidity code directly?

    -The EVM cannot understand Solidity code directly because it is a high-level language; it must be compiled into bytecode, which consists of opcodes that the EVM can execute.

  • What is the purpose of 'gas' in the context of the EVM?

    -Gas is a unit of measurement that represents the computational effort required to execute an operation on the EVM. It is paid as a fee for using the resources of the globally distributed computer that is the EVM.

  • What is the significance of the Merkel Patricia tree in the EVM?

    -The Merkel Patricia tree is a data structure used by the EVM to store and update the state of the blockchain, where each account is linked with hashes and reducible to a root hash stored on the blockchain.

  • What does it mean for the EVM to be a 'Turing complete' machine?

    -A Turing complete machine, like the EVM, can perform any computation given enough input, memory, and computational steps (gas fee), meaning it can execute a wide range of algorithms and processes.

  • Why can the EVM execute code written in other programming languages like Python or JavaScript?

    -The EVM can execute code written in other languages because the underlying logic of the code remains the same; it just needs to be converted into Solidity, which the EVM can understand and execute.

  • Besides Ethereum, which other blockchain ecosystems use the EVM?

    -Other blockchain ecosystems like Polygon, Avalanche, and Binance Smart Chain (now called PNB Chain or PNB Smart Chain) also use the EVM as their state machines.

Outlines

00:00

💡 Understanding the Ethereum Virtual Machine (EVM)

This paragraph introduces the Ethereum Virtual Machine (EVM), explaining its role as a virtual machine within the blockchain ecosystem. It begins with a general definition of virtual machines, highlighting their ability to run various operating systems and applications. The EVM is distinguished as a unique type of virtual machine, maintained by all node runners of the blockchain network, and not limited to a single computer. The paragraph delves into the concept of smart contracts, which are written in Solidity and compiled into bytecode for execution by the EVM. It also touches on the importance of 'gas' as a measure of computational effort and the fee associated with executing opcodes on the EVM. The EVM's function as a Merkel Patricia tree is briefly mentioned, illustrating how it updates the state of the blockchain by processing transactions. The paragraph concludes by emphasizing the EVM's Turing completeness, its ability to execute complex operations, and its applicability beyond the Ethereum chain to other ecosystems like Polygon, Avalanche, and Binance Smart Chain.

05:01

📱 Engaging with the QuickNote Community

The second paragraph serves as a call to action for viewers to engage with the QuickNote YouTube channel. It invites viewers to leave comments suggesting topics they would like to see covered in future videos. Additionally, it encourages viewers to subscribe to the channel for more content related to blockchain technology and tutorials. This paragraph acts as a bridge between the informational content and the community-building aspect of the channel, fostering interaction and growth.

Mindmap

Keywords

💡EVM

EVM stands for Ethereum Virtual Machine, which is the core of the Ethereum blockchain. It is a decentralized virtual machine that executes smart contracts and transactions. In the video, EVM is described as a globally distributed computer that maintains a state machine, processing financial transactions and smart contracts, and is responsible for updating the blockchain's state.

💡Virtual Machine

A virtual machine is a software-based simulation of a physical computer that executes programs like a real computer. In the script, it is mentioned as a CPU which can run various operating systems and applications, and it's used to explain the concept of the Ethereum Virtual Machine, emphasizing its ability to run on remote servers and execute code in different programming languages.

💡Compiler

A compiler is a special program that translates code written in high-level programming languages into machine code that a computer can understand. In the context of the video, the compiler is necessary to convert Solidity code, which is used to write smart contracts for the EVM, into bytecode that the EVM can execute.

💡Smart Contracts

Smart contracts are self-executing contracts with the terms of the agreement directly written into code. They are a key feature of the Ethereum blockchain and are executed by the EVM. The script explains that smart contracts are written in Solidity and are responsible for automating processes on the blockchain.

💡Bytecode

Bytecode is a low-level programming language that is the output of a compiler translating high-level code. In the video, bytecode is the intermediate form of smart contract code that the EVM can understand and execute, with each function in the bytecode having specific opcodes that represent machine instructions.

💡Opcodes

Opcodes are operation codes that represent machine instructions in bytecode. They tell the EVM which operation to perform. The script provides an example where '60' is a push one opcode, indicating the start of a sequence of operations in the bytecode.

💡Gas

Gas is a measurement of computational effort required to execute a specific operation or contract on the Ethereum blockchain. It is used to pay for the computational resources used by the EVM. The script explains that different opcodes consume varying amounts of gas, and more complex smart contract functions require more gas.

💡Merkle Patricia Tree

A Merkel Patricia Tree is a type of data structure used in the Ethereum blockchain to efficiently store and verify the integrity of data. The script describes the EVM as a huge Merkel Patricia tree where each account is linked with hashes and is reducible to a root hash stored on the blockchain, illustrating how the EVM updates the state of the chain.

💡Turing Complete

A system is said to be Turing complete if it can simulate a Turing machine, meaning it can perform any computation given enough resources. The video explains that the EVM is Turing complete, indicating its capability to execute any algorithm as long as it has sufficient gas and memory.

💡Blockchain

Blockchain is a distributed ledger technology that records transactions across multiple computers so that the record cannot be altered retroactively. The script discusses how the EVM updates the state of the blockchain by executing and validating transactions, emphasizing the immutable nature of blockchain technology.

💡Distributed Ledger

A distributed ledger is a database that is consensually shared and synchronized across multiple sites, institutions, or geographies. The script contrasts Ethereum, which is a distributed state machine, with Bitcoin, which is described as a distributed ledger, highlighting the additional capabilities of Ethereum beyond simple transaction recording.

Highlights

EVM stands for Ethereum Virtual Machine, a fundamental component of the Ethereum blockchain.

A virtual machine is a simulation of a computer that can run various operating systems and applications.

Programming languages require a compiler to convert code into a machine-understandable format.

Ethereum is more complex than Bitcoin, functioning as a distributed state machine that processes financial transactions and smart contracts.

EVM is maintained by all node runners of the blockchain network, unlike traditional virtual machines.

Smart contracts are written in Solidity for execution on the EVM, but must be compiled into bytecode first.

Each function in a smart contract's bytecode contains opcodes, which are machine instructions for the EVM.

Executing opcodes on the EVM requires a fee, paid in gas, reflecting the use of the distributed computer's resources.

The unit of measurement for processing on the EVM is called 'gas', with different operations consuming varying amounts.

EVM is a huge Merkle Patricia tree where each account is linked with hashes, updating the blockchain's state upon transaction confirmation.

EVM validates transactions according to the chain's rules, updating the blockchain's state by adding approved transactions.

EVM is a Turing complete machine, capable of producing an output given enough input, memory, and gas fees.

Programming logic remains consistent across languages, allowing code in Python or JavaScript to be easily converted to Solidity.

The versatility of EVM extends its usage beyond Ethereum to other blockchain ecosystems like Polygon, Avalanche, and Binance Smart Chain.

EVM's capabilities make it a critical component in the execution and validation of smart contracts and transactions on the blockchain.

For further reading on EVM, a detailed guide is provided in the description of the video.

The video encourages viewers to engage by liking, commenting, and subscribing for more blockchain-based content.

Transcripts

play00:00

hi everyone sahil from quicknote here in

play00:02

this video we will talk about evm which

play00:04

is an acronym for ethereum virtual

play00:06

machine

play00:07

[Music]

play00:09

before understanding evm or ethereum

play00:12

virtual machine Let's understand what

play00:14

virtual machines are a virtual machine

play00:16

is a simulation of a computer usually

play00:19

running on remote servers a virtual

play00:22

machine is a CPU which can be used to

play00:25

run various operating systems and

play00:27

applications the applications of

play00:30

softwares which run or execute on these

play00:32

computers are usually written in

play00:35

programming languages like python

play00:37

JavaScript go Etc

play00:40

so these programming languages cannot be

play00:43

understood by computers directly it has

play00:47

to be converted in a machine

play00:50

understandable language of zeros and one

play00:53

so another piece of software called

play00:56

compiler is required to convert these

play00:59

high-level languages into low level

play01:02

languages with computers or in this case

play01:05

virtual machines can understand evm on a

play01:08

very high level is a virtual machine but

play01:12

it's not just limited to one computer

play01:14

but is maintained by all the node

play01:17

Runners of the blockchain network

play01:20

unlike Bitcoin which is a distributed

play01:23

Ledger ethereum is much more complex

play01:26

it is a distributed State machine

play01:30

since it not only processes Financial

play01:32

transactions but also has smart

play01:35

contracts and EPM is responsible for

play01:39

executing these smart contract

play01:41

transactions smart contracts are written

play01:44

in solidity for an evm based environment

play01:47

or ecosystem but evm being a virtual

play01:51

machine cannot understand this solidity

play01:54

code out of the box so it has to be

play01:58

compiled and converted into byte code

play02:00

each function of the smart contract in

play02:03

the byte code has of course opcodes are

play02:08

machine instructions that tell the evm

play02:11

which operation is to be performed for

play02:14

example in a byte code like this

play02:18

60 refers to push one op code and 0 0

play02:24

refers to start and so on and so forth

play02:28

each op code processing requires a fee

play02:31

to be paid since evm is a globally

play02:34

distributed computer and the resources

play02:37

of this computer is provided by the node

play02:40

Runners so whenever a opcode is executed

play02:44

a fee is to be paid because we are using

play02:47

the resources of This Global distributed

play02:50

computer called evm the unit of

play02:54

measurement of how much processing the

play02:56

ABM is doing is measured in a unit

play02:59

called gas up codes depending on their

play03:02

complexity consumes different amount of

play03:05

cash thus more complex the smart

play03:08

contract function is more gas it will

play03:11

require to execute the evm is a huge

play03:15

Merkel Patricia tree

play03:18

where each account is linked with hashes

play03:21

and is reducible to a root hash stored

play03:25

on the blockchain once the transaction

play03:27

is confirmed the tree is updated and

play03:30

thus the state of the chain is updated

play03:33

this is how evm updates the state of a

play03:37

chain or blockchain to conclude we can

play03:40

say that evm is a machine that executes

play03:43

operation and validates transactions for

play03:46

transaction rules on the Chain thus

play03:49

updating the state of the Chain by

play03:52

approving and adding those transactions

play03:55

evm is also a turing complete machine

play03:58

which means that given the input enough

play04:02

memory and enough gas fee it will

play04:05

produce an output it also means that a

play04:09

code written in python or JavaScript can

play04:11

easily be converted to solidity because

play04:15

the logic Remains the Same only the

play04:17

programming languages changes and evm

play04:21

will be able to execute that code

play04:24

because of such capabilities of evm its

play04:27

usage is not just limited to the

play04:30

ethereum chain for which it was created

play04:33

but other chain ecosystems like polygon

play04:37

Avalanche binance smart chain which is

play04:39

now called pnb chain or pnb smart chain

play04:43

also uses it as their state machines so

play04:47

this is all about evm if you want to

play04:50

read more on evm or if you want to read

play04:52

all the information which we covered in

play04:54

this video check out the linked guide in

play04:57

the description

play04:58

and if you found the information in this

play05:00

video helpful give it a thumbs up

play05:02

comment down in the comment section

play05:04

about what more topics you would like us

play05:07

to cover And subscribe to the quick note

play05:09

YouTube channel for more such videos on

play05:12

blockchain based topics and tutorials

play05:15

thank you everyone

Rate This
★
★
★
★
★

5.0 / 5 (0 votes)

Étiquettes Connexes
EthereumSmart ContractsBlockchainVirtual MachineEVMSolidityTransaction ValidationDistributed LedgerGas FeesTuring Complete
Besoin d'un résumé en anglais ?