EVM — Ethereum Virtual Machine — How it improved blockchain technology?

Web3 developers are mainly obligated to create and develop different kind of smart contacts, which are the core of all dapps, NFTs, etc.

EVM — Ethereum Virtual Machine — How it improved blockchain technology?

Web3 developers are mainly obligated to create and develop different kind of smart contacts, which are the core of all dapps, NFTs, etc.

When it comes to work on ethereum blockchain, there is a super useful feature — EVM.


Agenda:

  • Intro,
  • Definition,
  • How it works,
  • Example,
  • Smart contracts,
  • Conclusion.

Definition

Ethereum Virtual Machine is a virtual component which exists in every node of ethereum network. EVM is capable of executing smart contracts, by compiling programming language into EVM bytecode.

Actually, EVM creates something like a layer connecting high-level programming language with conversion of it to a low-level bytecode, which is readable for machines.

Ethereum protocol requires such EVM, to proceed basic operations.

If you want to know how ethereum network works, check my material about it:


How it works

The ethereum network is composed from computers — nodes, each node runs an ethereum software called EVM.

The main purpose of EVM is to run smart contracts.

EVM is a state machine, the input with old state is combined with transaction and in the result, is delivered a new state. It is all proceeded by EVM.

Easily said, state is a “mapping” of accounts with attached properties like balance, storage, smart contract, nonce, etc.

The EVM can be easily executed in two ways:

  • the read-only mode (eth_call)
  • - and write mode (eth_sendTransaction)

The read-only mode is proceeded by sending a request to any EVM node and getting the response from processed request.

The write mode is based on sending a transaction which is mined by the network. Each transaction is processed sequentially by the EVM in an order made by miners.

it is described on below image.


Example

Let’s assume that new transaction is made by one of the participants in the ethereum network. Transaction is added and combined with state to create new one. This process continues till each one transaction for this block will be finished.

Next, the winning miner announce new block to the network and it is added to a chain.


Smart contracts

This process is slightly different when smart contract is computed. Mainly, smart contracts are written in high level programming language, for example Solidity which is compiled by elementary instructions called Opcodes.

There are 140 different opcodes. When EVM executes smart contract it runs it to opcodes. These opcodes are put into the stack.

EVM can also access temporary memory for processing arrays, etc.

After compiling smart contract, EVM can successfully update the state of the blockchain.


Conclusion

EVM changes the approach for blockchain dramatically. Thanks to this tool, it is possible to compile smart contracts and create NFTs, dapps, etc.

It is the very efficient way of updating the state and attach it in blockchain.

If you like my web3 content, please follow my repo with all topics and soon, practical projects like “blockchain with typescript”.

GitHub - Kacper-Hernacki/100-days-of-web3-challenge-blockchain-free-materials: This is the repo…
This is the repo which consists 100 topics about blockchain/ decentralisation/ web3. There are links to my articles,…