You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesi贸n a prueba de IA

Antes: $249

Currency
$209
Suscr铆bete

Termina en:

1 D铆as
9 Hrs
45 Min
54 Seg

Ethereum Virtual Machine

11/27
Resources

The entire functioning of blockchains such as Ethereum, or second layers of it such as Polygon, Arbitrum or Optimisms, among others, is due to the Ethereum Virtual Machine. The technical heart of Ethereum.

The Ethereum CPU

The Ethereum Virtual Machine is a complex work of software engineering capable of running the entire Ethereum protocol. We could make an analogy in its operation with a typical CPU of any computer. Its job is to process instructions, one by one.

Each node of the Ethereum network runs the EVM. It is thanks to this that communication between nodes, information exchange, contract execution, information storage, and other functionalities are possible.

How the EVM works

The EVM is a simple machine with stack architecture. It stores 256-bit elements in the stack, and interacts with a volatile memory and a permanent storage. The instructions it processes are done cyclically, delivered in "bytecode" format.

As developers, we program the logic of our smart contracts in languages such as Solidity. Any language you compile for EVM is an abstraction layer of a much more complex hexadecimal language for humans to understand called bytecode.

How bytecode works

Bytecode is a code that results from compiling source code written in Solidity, or other languages. It was created especially for the EVM and only works for it.

An example of bytecode can be seen as follows: 0x60808060404052.... A long string of hexadecimal numbers that the EVM knows how to translate into operations and parameters.

The instructions are traversed one by one thanks to a fundamental part of the EVM called "program counter". Returning to the previous example, 0x608080604052..., the counter takes the operator 60 and the parameter 80, evaluates and executes the instruction. Then it takes the 60 and the 40, and again evaluates and executes. So, until the end of the whole bytecode.

We can understand the execution of instructions by the program counter with the following graph.

Arquitectura EVM

The counter takes the operations from the bytecode and this, in turn, can take from the stack in memory or from the storage any type of data that it needs to do its work. Parameters, variables, etc.

This is a simple way to understand how EVM works. You will find, here at Platzi, the Ethereum Virtual Machine Management Course where you will learn in depth about the functioning of the Ethereum virtual machine.

Conclusion

The EVM is an abstract machine, distributed across hundreds of nodes on a blockchain, capable of executing instructions. Solidity is just one of the languages capable of being compiled for this purpose. You will realize that not just any programming language is ready for this.

Do you know of any other language compatible with EVM?


Contributed by: Kevin Fiorentino (Platzi Contributor).

Contributions 5

Questions 0

Sort by:

Want to see more contributions, questions and answers from the community?

Un resumen de lo aprendido, por el momento.

Me resulta muy interesante entender como la EVM interpreta las instrucciones. Excelente clase introductoria, ya me agendo el curso de EVM 馃憦

La EVM es una gran obra de ingenier铆a de software.
Otros lenguajes que compila para la EVM son Vyper y hace poco conoc铆 Cairo.

Hace poco supe que existe un lenguaje llamado **Cairo **que permite escribir smart contracts creo que en la blockchain de StarckNet, creo que **Rust **tambien permite escribir smart contracts

Es genial comprender toda la arquitectura que esta detr谩s de lo que es Ethereum, que va desde su blockchain hasta elementos que lo diferencian como la Evm, su funcionamiento en forma de Stack interactuando con memory y storage, el Bytecode con el Program Counter y l贸gicamente los Smarts Contracts, cool!. Dentro de los lenguajes tenemos Rust, Cairo, Vyper y por supuesto Solidity.