Ethereum Virtual Machine (EVM)

From CryptoWiki

(Redirected from EVM)

The Virtual Machine popularized by the Ethereum Blockchain, but implemented in many other blockchains since then. Some of the most well known are Binance Smart Chain, Polygon, Fantom and most of Polkadot's parachains like Moonbeam.

At the foundation of Ethereum is the Ethereum Virtual Machine (EVM), which is the executable and trustless environment for smart contracts: computer protocols that facilitate, verify, and enforce the negotiation and performance of some sort of digital agreement. The EVM executes a contract with whatever rules the developer initially programmed, such as sending money from Alice to Bob. The EVM executes these programs through a bytecode language. Ethereum developers are able to use Ethereum programming languages such as Solidity and others to write smart contracts and build decentralized applications."

Basics

  • From this blog (12-7-2021):

"Created in 2014, it is the first virtual machine for blockchains able to execute complex business logic on-chain. A lot has been built around and on top of EVM over the last seven years. Today EVM powers ~90% of blockchain transaction numbers and most of the transaction value."

"When thinking in DeFi years, Ethereum has already reached legacy status. It survived its first wave of “Ethereum killers”, followed by a surge in popularity of low cost chains (Polygon, BSC, Fantom) running the Ethereum Virtual Machine (EVM). And now, after launching with limited success, these same Ethereum killers are integrating the EVM and racing to enter the multichain world. Specifically, Polkadot has added Moonbeam, NearAurora, and soon (announced but not yet launched), Evmos will be on Cosmos and Neon on Solana.

When these chains were first launched (without EVM compatibility), they claimed to have superior designs, with features such as popular programming-language support and speed. As these chains begin to support EVM, it now seems they’re less bullish about the advantages of their own technology, and instead realize the need to support Ethereum’s. By doing so, these chains are backtracking on their original vision to build an alternative tech stack to Ethereum’s. Here, we’ll take a look at the different architectures and how emerging standards around EVM across blockchains will create more composability. Plus, we see the resulting chain-specific ecosystems becoming a hot-bed for product experimentation.

Think of EVM as a computer that calculates the results of operational outputs of smart contracts, given certain inputs. A copy of EVM runs on each node – it’s imperative to remember that it’s not located in one single place. EVM is also referred to as “a runtime” or “an environment”.

EVM takes in programs written in Solidity language, and to make the language more powerful, a number of “libraries” were created. Developer tools such as Truffle or Hardhat make the writing and testing of smart contracts much easier. Also, because we’re talking about networked environments, outside wallets connect to the EVM via API libraries such as Web3.js.

And among those tools more familiar to the average user, there’s the powerful blockchain explorer Etherscan. It knows how to look into thousands of transactions and present them in a human-readable way. Plus, there’s the MetaMask wallet, which connects users to EVM by broadcasting their commands over a network."

"This project focuses on preventing Denial-of-service attacks, which have become somewhat common in the cryptocurrency world. Moreover, the EVM ensures programs do not have access to each other’s state, ensuring communication can be established without any potential interference.

To put this into a language everyone can understand, the Ethereum Virtual Machine is designed to serve as a runtime environment for smart contracts based on Ethereum. As most cryptocurrency enthusiasts are well aware of, smart contracts are very popular these days. This technology can be used to automatically conduct transactions or perform specific actions on the Ethereum blockchain. Many people predict smart contracts will help revolutionise finance and other industries over the coming years.

It is also worth mentioning the Ethereum Virtual Machine has been hinted at in the Yellow Paper drafted by Dr. Gavin Wood several years ago. It is evident the Ethereum project was built with the prospect of introducing such a sandboxed environment to hone the smart contract technology in the future. A clever piece of design and coding, and one that will certainly help elevate Ethereum and smart contracts to the next level over the coming years.

Since the Ethereum Virtual Machine is completely isolated from the rest of the main network, it is a perfect testing environment. Any company looking to create a smart contract can do so using the EVM, without it affecting the main blockchain operations. Testing this technology is of the utmost importance, as flawed code can spell demise for even the most exciting of smart contracts. Moreover, one could look at the EVM as a “learning environment” to build bigger, better, and more robust smart contracts as well.

It is also worth mentioning every Ethereum node in the network runs their own EVM implementation and is capable of executing the same instructions. It is evident there is a bright future ahead for this project, as it will continue to receive some updates over time. It is a gateway to building proper smart contracts, both for novice and experienced coders looking to get a hands-on approach with the Solidity language. Additionally, the EVM have been implemented in Python, Ruby, C++, and a few other coding languages."

Tech

  • From this blog (12-7-2021):

"On the tooling side, this includes Solidity and Vyper smart contract programming language compilers, IDEs like Remix, development frameworks like Hardhat and Truffle, programming language integrations like Web3.js and Web3.py.

You can think of the Ethereum blockchain as a single computer with storage attached to it: RAM, disk drive, etc. EVM, specifically, has an infinite addressable state as 256-bit words (32 bytes). Every time you write something to this storage you consume it permanently: the EVM state has changed. Blocks are propagating these state changes with valid transactions. Each block contains multiple transactions that alter the EVM state sequentially. The EVM measures the cost of state change through SSTORE instructions, like any other EVM instruction, in gas.

There is also overhead on the to of plain key-value storage of the EVM state. The state is processed as a Merkle Patricia tree, to make it possible to sign the blocks and transactions. Any state change has more overhead than just the actual payload it writes. There are alternatives to Merkle Patricia trees, like Verkle trees and this is a potential future upgrade to remove some of the scalability bottlenecks.

zk-EVM

"The Zero-knowledge EVM (zkEVM) is a virtual machine that executes Ethereum smart contracts and uses zero-knowledge proofs to ensure its accuracy. It is a component of Ethereum's zero-knowledge rollups scaling solution, which enhances network throughput by off-chaining computation and storage. The zkEVM generates proofs to assure that bytecode access, read-write operations, and calculations are executed correctly. It is made up of three parts: an execution engine, proof production, and proof verification. The zkEVM is significant because it may provide privacy and security for Ethereum smart contracts by checking execution correctness with zero-knowledge proofs and safeguarding confidential information. This enables the creation of safe, privacy-focused decentralized applications (dApps) in fields such as De-Fi, healthcare, supply chain, and others."

Notable zk-EVMs are StarkNet's, zkSync Era, Polygon Hermez zk-EVM and Scroll

Pros and Cons

Pros

  1. "These EVMs will also connect the underlying blockchain’s tokens to the broader EVM ecosystem. For example, Polkadot’s token DOT is bridged to Moonriver via the official bridge and from there will travel further via widely-available EVM bridges like Synapse, Allbridge, etc. In general, it’s easier to build an EVM-EVM bridge than an EVM-different-consensus bridge.
  2. The EVM environment can become the onramp point for assets from EVM chains to these underlying chains. Users will choose whichever bridge is the most convenient and safest for them.
  3. The EVM environment could become the demo version of the underlying blockchain for new users. By using familiar tools, they would learn about the new ecosystem, its technology, native projects and assets."

Cons