Everyone in the crypto world knows Ethereum. Most people have also heard of Ethereum Virtual Machine (EVM), but what exactly is it? Today you're in luck, because that's exactly what we're going to tell you about.
✔️ The Ethereum Virtual Machine is a single entity maintained by thousands of computers running an Ethereum client.
✔️ The Ethereum protocol has its own currency, Ether (ETH), which follows almost the same rules as Bitcoin, but also enables powerful features such as smart contracts.
✔️ All implementations of the EVM must adhere to the specifications outlined in the Ethereum Yellow Paper, and implementation clients are available for JavaScript, C++ and Python.
The Ethereum Virtual Machine is a single entity maintained by thousands of connected computers running an Ethereum client. Anyone can maintain this network by becoming a node. You download some software to run on your PC and voila. Then you are not yet a validator, so it only benefits the Ethereum network, you get no transaction fees and are not allowed to create new blocks with a node.
The sole purpose of the Ethereum protocol is to preserve the continuous, uninterrupted and immutable operation of this "special state machine". In it, all Ethereum accounts and smart contracts "live". Each block in the blockchain has only one canonical state and the EVM defines what the rules are for calculating a new valid state from block to block.
The analogy of a distributed ledger is often used to describe blockchains like Bitcoin. It allows a decentralised currency to use fundamental tools for cryptography. The ledger keeps track of what someone can and cannot do to change it, for example prohibiting you from spending more than you got.
Ethereum has its own currency, Ether or also called ETH, which follows almost exactly the same rules, but also enables a much more powerful feature: smart contracts. With Ethereum, you can use the analogy of the distributed machine state. Ethereum's state is a large data structure that contains not only all accounts and balances, but also a machine state that can change from block to block according to a predetermined set of rules and execute random machine code. The specific rules to change the state from block to block are defined by the EVM.
The EVM behaves like a mathematical function: given a certain input, it generates a deterministic output. Ethereum has a "state transition function". If you have an old valid state of the network and a new set of valid transactions, the state transition function causes a new valid output state to be generated from the Ethereum network.
With their "modified Merkle Patricia Trie", Ethereum ensures strong efficiency in their database.
The EVM executes a "stack machine" with a depth of 1024 entries. Each of these items is a 256-bit word chosen to work with. Standard words can be seen in the drawing below, such as storage and gas.
EVM "opcodes" such as AND, OR, ADD and the like are used here to open standard mathematical possibilities. Furthermore, words specific to the Ethereum blockchain are used, such as ADDRESS or BALANCE.
All implementations of the Ethereum Virtual Machine must obey the specifications described by the Ethereum Yellow paper. Ethereum execution clients are available for JavaScript, C++ and Python.
Smart contracts for the EVM are generally written in Solidity or Vyper.