Back to Course

3. Advanced Course

0% Complete
0/0 Steps
  1. 1. What is Taproot?
  2. 2. Blockchain bridges – what are they?
  3. 3. What is Ethereum Plasma?
  4. 4. What is Ethereum Casper?
  5. 5. What is Zk-SNARK and Zk-STARK? 
  6. 6. What is Selfish Mining? 
  7. 7. What is spoofing in the cryptocurrency market? 
  8. 8. Schnorr signatures - what are they? 
  9. 9. MimbleWimble - what is it? 
  10. 10. What is digital property rights in NFT?
  11. 11. What are ETFs and what role do they play in the cryptocurrency market? 
  12. 12. How to verify a cryptocurrency project – cryptocurrency tokenomics 
  13. 13. What is the 51% attack on blockchain?
  14. 14. What is DAO, and how does it work?
  15. 15. Zero-knowledge proof – a protocol that respects privacy 
  16. 16. What is EOSREX?
  17. 17. What is Proof of Elapsed Time (PoET)?
  18. 18. Mirror Protocol – what it is? 
  19. 19. What are synthetic assets? 
  20. 20. How to create your own NFT? 
  21. 21. Definition of DeFi, and what are its liquidations?
  22. 22. New identity system - Polygon ID
  23. 23. Ethereum Foundation and the Scroll protocol - what is it?
  24. 24. What is Byzantine fault tolerance in blockchain technology?
  25. 25. Scalability of blockchain technology - what is it?
  26. 26. Interchain Security - new Cosmos (ATOM) protocol
  27. 27. Coin Mixing vs. Coin Join - definition, opportunities, and threats
  28. 28. What is Ethereum Virtual Machine (EVM) and how does it work?
  29. 29. Soulbound Tokens - what are they, and how do they work?
  30. 30. Definition of LIDO - what is it?
  31. 31. What are Threshold Signatures, and how do they work?
  32. 32. Blockchain technology and cyberattacks.
  33. 33. Bitcoin script - what it is, and what you should know about it.
  34. 34. What is zkEVM, and what are its basic features?
  35. 35. Do confidential transactions on blockchain exist? What is a Confidential Transaction?
  36. 36. Algorithmic stablecoins - everything you should know about them.
  37. 37. Polygon Zk Rollups ZKP - what should you know about it?
  38. 38. What is Web3 Infura?
  39. 39. Mantle - Ethereum L2 scalability - how does it work?
  40. 40. What is the NEAR Rainbow Bridge?
  41. 41. Liquid Staking Ethereum and LSD tokens. What do you need to know about it?
  42. 42. Top 10 blockchain oracles. How do they work? How do they differ?
  43. 43. What are Web3.js and Ether.js? What are the main differences between them?
  44. 44. What is StarkWare, and recursive validity proofs
  45. 45. Quant Network: scalability of the future
  46. 46. Polygon zkEVM - everything you need to know
  47. 47. What is Optimism (OP), and how do its roll-ups work?
  48. 48. What are RPC nodes, and how do they work?
  49. 49. SEI Network: everything you need to know about the Tier 1 solution for DeFi
  50. 50. Types of Proof-of-Stake Consensus Mechanisms: DPoS, LPoS and BPoS
  51. 51. Bedrock: the epileptic curve that ensures security!
  52. 52. What is Tendermint, and how does it work?
  53. 53. Pantos: how to solve the problem of token transfer between blockchains?
  54. 54. What is asymmetric encryption?
  55. 55. Base-58 Function in Cryptocurrencies
  56. 56. What Is the Nostr Protocol and How Does It Work?
  57. 57. What Is the XDAI Bridge and How Does It Work?
  58. 58. Solidity vs. Rust: What Are the Differences Between These Programming Languages?
  59. 59. What Is a Real-Time Operating System (RTOS)?
  60. 60. What Is the Ethereum Rinkeby Testnet and How Does It Work?
  61. 61. What Is Probabilistic Encryption?
  62. 62. What is a Pinata in Web 3? We explain!
  63. 63. What Is EIP-4337? Will Ethereum Account Abstraction Change Web3 Forever?
  64. 64. What are smart contract audits? Which companies are involved?
  65. 65. How does the AirGapped wallet work?
  66. 66. What is proto-danksharding (EIP-4844) on Ethereum?
  67. 67. What is decentralised storage and how does it work?
  68. 68. How to Recover Cryptocurrencies Sent to the Wrong Address or Network: A Practical Guide
  69. 69. MPC Wallet and Multilateral Computing: Innovative Technology for Privacy and Security
  70. 70. Threshold signature in cryptography: an advanced signing technique!
  71. 71. Vanity address in cryptocurrencies: what is it and what are its characteristics?
  72. 72. Reentrancy Attack on smart contracts: a threat to blockchain security!
  73. 73. Slither: a static analyser for smart contracts!
  74. 74. Sandwich Attack at DeFi: explanation and risks!
  75. 75. Blockchain RPC for Web3: A key technology in the world of decentralized finance!
  76. 76. Re-staking: the benefits of re-posting in staking!
  77. 77. Base: Evolving cryptocurrency transactions with a tier-2 solution from Coinbase
  78. 78. IPFS: A new era of decentralized data storage
  79. 79. Typical vulnerabilities and bridge security in blockchain technology
  80. 80. JumpNet - Ethereum's new sidechain
Lesson 28 of 80
In Progress

28. What is Ethereum Virtual Machine (EVM) and how does it work?

Ethereum, it’s a network blockchain who first introduced the concept of programmability smart contracts. How the network works and what it basically is all about Ethereum, you will find in our previous lesson.

The network ecosystem provides the basis for creating, compiling, and executing thousands of smart contracts. How? Thanks, Ethereum Virtual Machine (EVM). In today’s lesson, we will discuss this concept in more detail.

Ethereum Virtual Machine – definition

EVM is software whose task is to create and compile smart contracts into a readable format called Bytecode. Simultaneously, EVM calculates the state of the Ethereum network after adding each new one block to the chain.

Ethereum Virtual Machine, it sits on top of the hardware and network layers of Ethereum. What else is interested in EVM? Smart contracts deployed on other z-compatible chains EVM (e.g. Polygon or Avalanche) are recognizable by nodes in Ethereum. As a result, developers can move theirs relatively easily dApp’s the tokens from Ethereum to other chains, compatible with Ethereum Virtual Machine, programmed in the language Solidity.

In the crypto industry, EVM is often referred to as “the heart of Ethereum”that drives the entire network ecosystem.

How does the Ethereum Virtual Machine work?

The operation of EVM can be divided into two separate sections – creating tokens and smart contracts. Let’s take a closer look at this topic.

Ethereum Virtual Machine facilitates the process of creating new tokens on Blockchain Ethereum. As we mentioned earlier, EVM is a program that facilitates the creation of scripts used to implement operations on Blockchain Ethereum. A script is a set of instructions or an algorithm that tells the “computer” what to do to make something work properly. In its action, EVM requires developers to have access to any network chain to be able to execute the desired commands and create a new one token already blockchain without any difficulty.

Now that you know how new ones are made tokens using EVM Now let’s look at smart contracts. On the Web Ethereum there are plenty of them. They have a defined code that makes it easy to replace cryptocurrencies and information. Such agreements (codes) are defined by the creator smart contract and provide a certain result.

Ethereum Virtual Machine provides developers and creators with a smart contracts environment Turing Complete where they can create scripts and contracts. This means that anything we implement with a computer, we will run with EVM.

EVM plays an essential role in the ecosystem of Ethereum. Creates an environment for decentralized applications (dApps)which we build at the top of the chain. If you forgot what decentralized dApps are, take a look here.

The Ethereum Virtual Machine assures us that all transactions and intelligent contracts on the blockchain Ethereum are executed in the correct way, according to the predetermined code of the intelligent contract.

Simply put, EVM is a platform that makes it much easier for developers to create dApps and implementations on blockchain.

EVM – construction

Ethereum Virtual Machine is made of two parts. The first one runs the source code Solidity. EVM is written in C++ and uses LLVM as its compiler. EVM supports many programming languages, security, and runtime environment for codes. It also allows developers to write custom EVM bytecode.

The second part is called uncles. So, little pieces of smart contracts or data stored on blockchain. It allows you to store metadata. Which ones?

  1. Information about the basic operations that we can perform on assets stored in memory (not on the blockchain!).
  2. What is the balance of Ethereum that someone has at the moment.
  3. Storage of all activities and transactions related to Ethereum.
  4. Information about the hash of a given block.
  5. Information about the so-called block number, which is a number indicating which block a particular block hash belongs to
  6. Code executed using EVM. It determines what action will be taken when a given input occurs (e.g. transfer of money).
  7. Actual code size in bytes.
  8. Part information EVM, which allows users to determine how much gas they are willing to spend to get something done.

Someone said –gas? Now, we may ask – but what does it actually have to do with EVM performance? Oh well, gas is a measure of computing power. Simply put, it defines the time it takes to execute the transaction’s contract. Because there is so much code in the entire ecosystem, a certain amount of gas is used to run it “upfront”. The default limit is set to 250,000 units. Remember that the more complicated it is a transaction, the more gas is needed to make it.

Advantages of EVM

  • Reduces the risk of untrusted code execution, without compromising confidential data.EVM guarantees developers that their calculations won’t interfere with others (system or what’s going on in personal files).
  • Allows you to run complex smart contracts. Thanks to Ethereum Virtual Machine we can run complex smart contracts without worrying about how they will affect each other. You can write them once, but run them on many platforms. This allows you to create one smart contract that runs on multiple platforms.
  • Deterministic processing. Smart contracts written using EVM have access to all networks in Ethereum at the moment. As a result, it allows processing in a deterministic manner and gives a much greater guarantee for their correctness.
  • Dispersed consensus. Ecosystem Ethereum allows most users to run the same program on their computers.
  • Ease of writing stateful contracts. EVM is intended for writing smart contracts and creating dApps. To sum up – programs running in distributed networks, while ensuring that everyone sees the same version.EVM, it also makes typing easier stateful contracts that have access to non-volatile memory.

Disadvantages of EVM

  • Very high cost of data storage. In short – gas. That is, what we use when paying the launch fee smart contract.
  • High cost of data storage blockchain. It can take over 3TB.
  • High technical knowledge required. Writing smart contracts and simultaneous use of EVM requires quite a bit of technical knowledge. We’re talking about the environment Turing Complete which allows programmers to write in any programming language. For some it is wonderful, for others (with less knowledge and sophistication) it can be even

Blockchains compatible with EVM

Interoperability between Ethereum blockchains turned out to be a significant problem for developers. High gas charges and slow transactions forced Ethereum developers to create Dapps and smart contracts on the other blockchains. Thus, they could offer faster transactions and lower fees. Unfortunately, it could not be so easy and beautiful. Many of these blockchains have severe limitations and lack interoperability with other blockchains.

EVM compatible chains solve this problem perfectly. Developers don’t have to start from scratch and create an environment like Ethereum Virtual Machine. They copy certain elements of Ethereum network and create dApps’y, allowing users to quickly and easily transfer assets between any network’s EVM.

Thanks to such interoperability of the most used, network blockchains follow the most compatible EVM.

Examples of blockchains working with EVM:

  • Binance Smart Chain
  • Avalanche
  • Phantom
  • Cardano
  • Polygon
  • Tron

Sidechain of the above-mentioned ecosystems are compatible with EVM. They offer benefits and reach Ethereum Blockchain, with significantly higher speed, capacity and lower transaction fees.

EVM use cases

Now that you know what EVM is and how it works. Let’s take a look at how everything connects and supports the EVM ecosystem and other Ethereum-based projects.

ERC-20 tokens

ERC-20 tokens act as a motivator for users dApp and Ethereum projects. They are specifically designed to be easily moved between networks and retain their value. ERC-20 tokens are created by smart contracts, based on specific data structures.

AMM and DEX 

DEX, enable the exchange of ERC-20 tokens, thanks to smart contracts. In turn, just these smart contracts enable exchange users to use the liquidity pool, without the need for third-party integration. Thus, they are given the title AMM – automated market makers. This group includes, among others: SushiSwap, Uniswap, or several other popular exchanges.

ERC-271 tokens

Another type of token that is used in the EVM ecosystem, the token ERC-271. Very often, this type of token is used to mint non-fungible tokens (NFT).

Just a few years ago, when cryptocurrencies just saw the light of day, it would be unthinkable that a piece of code would have the ability to democratize virtual access to art markets. God Unchained, Axie Infinity, Decentraland are just a few examples of the games they use ERC-271 in the game as collectibles.

DeFi

Cardano and its decentralized exchange AMM AdaSwap. Thanks to cooperation with Milkomeda and Layer 2 sidechain solutions, Milkomeda gives blockchain such as EVM compatibility. Thanks to this solution, basically sidechain, users can transfer assets and run Cardano dApps already Ethereum and vice versa.

DAO

It’s worth knowing that EVM is managed by the DAO, which is a decentralized autonomous organization. DAOs are fully autonomous and transparent. In smart contracts, they set the rules by making decisions based on instructions written in code. However, this does not prevent system users from voting and submitting consensus proposals. Fun fact: even the code itself can be based on a public audit. Thanks to this, every member of the DAO community understands how the protocol works at each stage.

If you want to remind yourself what it was and what are the most important features of DAO, we refer you to our lesson.

How does EVM work?

And now something for fans of mathematics and computer science. Ethereum Virtual Machine works very much like most maths functions. Why? Because it can generate a deterministic output for any input.

EVM, it mainly refers to status and transactions. Where the state of the EVM is described as a data structure, and transactions are instructions for action from different accounts, cryptographically signed.

The state, or rather the data structure, is known as the modified Merkle Patricia Tree. It keeps a record of all accounts linked together by various kinds of hash. Interestingly, “state” in functions EVM may refer to a specific hash on Blockchain Ethereum.

Transactions. It’s worth knowing that Ethereum Virtual Machine supports up to two transaction variants. However, only one of them triggers the message and the other creates it contracts. Creating a contract leads to the creation of a new account containing smart contract bytecode.

Opcodes 

If you have studied our lessons carefully, this term has come up many times before. Especially when we discussed the network itself, Ethereum or related topics. Why are we mentioning them now? Opcodes are an integral part of each EVM implementation.

Opcodes supported by Ethereum Virtual Machine help him to carry out specific tasks related to smart contracts and the EVM cryptocurrency transactions, but not only! They also have other uses – they record data and arithmetic tasks, or retrieve information about a block.

Fun fact: opcodes don’t have a direct script in EVM. As a result, they can help developers create and interact with smart contracts effortlessly.

Summary

If you’ve ever interacted with an ecosystem of Ethereum, you must have heard about Ethereum Virtual Machine. A virtual machine without any physical limitations. It does not require any high-end equipment for its operation. EVM is also a great environment for easy development and deployment of smart contracts.