paint-brush
Why Is the EVM So Important to the Web3 Ecosystem?by@shekarramaswamy
125 reads

Why Is the EVM So Important to the Web3 Ecosystem?

by Shekar RamaswamyJanuary 30th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The EVM defines a protocol for how programs, called smart contracts, run on blockchains. Smart contracts are important because they provide a layer of customizability to the blockchain. They are the tools that developers use to create products directly on the blockchain, from games to new ways to power the economy.
featured image - Why Is the EVM So Important to the Web3 Ecosystem?
Shekar Ramaswamy HackerNoon profile picture



Before the EVM, blockchains could only transfer cryptocurrency from one account to another. This was good for one-off payments, but not much else.


However, the creators of the EVM saw a future where the blockchain could run programs that executed complex logic and stored relevant data. Think of going from a single-stream soda dispenser, to mixing to your heart’s content on the CocaCola Freestyle: a complete game changer.


The EVM defines a protocol for how programs, called smart contracts, run on blockchains. Smart contracts are important because they provide a layer of customizability to the blockchain. They are the tools that developers use to create products directly on the blockchain, from games to new ways to power the economy.


… the EVM will become as well-known as other key internet protocols like HTTPS and SSL.


Many popular blockchains already use the EVM, including Polygon, Avalanche, Optimism, and of course Ethereum. In fact, I think the EVM will become as well-known as other key internet protocols like HTTPS and SSL.


In order to truly appreciate the EVM, we first need to cover a few basics.


Basics 1: Building a Blockchain

transaction specifies a change to be made from one state to another.

A single transaction to update state

Transactions are grouped into blocks. Blocks are then chained together, forming a blockchain.


A slice of the blockchain and its corresponding states


Blocks depend on the previous state, which is determined by the previous block, and so on. Therefore, the blockchain is a sequential list of changes (blocks) made to an implicit state. In order to calculate the current state of a blockchain, you need to consider every block starting with the genesis (first) block. A more technical guide to how this works is here.

Basics 2: Creating Trust

One of web3’s founding principles is to increase trust in the systems we use.

First, consider a centralized system. In this case, a single entity has complete control over the state of the system. If someone were to ask this entity what the state was, the entity could respond with anything it wanted. This comes with downsides:



Every institution that distributes power, money or status eventually falls to bias and corruption. Centralized internet platforms are no exception. It's fundamentally self-interested human behavior playing out at scale: a feature, not a bug.



In a decentralized system, the state of the system is determined by a collection of nodes that come to a consensus over the correct state of the blockchain. If someone asks for the state, the response is whatever the majority of nodes believe to be correct.

In a decentralized system, the majority keeps malicious nodes in check

A decentralized system shifts power away from a single entity and ensures a few bad actors can’t compromise the integrity of an entire system. This increases the trust that users have in the system.


The EVM

I mentioned earlier that smart contracts are powerful because they enable developers to create complex applications on the blockchain:


Smart contract applications include financial purposes, gaming, healthcare, and real estate; and they can even be used to configure entire corporate structures.


However, we haven’t covered how a smart contract actually runs on the blockchain.


Enter the EVM.


The Ethereum Virtual Machine is the runtime environment for smart contracts in Ethereum.


In plain language, smart contracts are called by a transaction. The EVM helps nodes determine the output of a smart contract. This output represents a state change, and the EVM “tells” the node this output so that the node can update its state.


Here’s a step-by-step breakdown of this all works:


  1. A user sends a transaction to a node, telling the node which smart contract they want to use
  2. The node calls the EVM with the details of the smart contract to be run
  3. The EVM runs the smart contract code, determining the changes to be made
  4. The EVM updates the state on the node based on determined changes
  5. The node places the current transaction into a block and broadcasts the block to the other nodes
  6. If a majority of the nodes agree (they use the EVM to check!), then the block is added to every node’s copy of the blockchain
  7. All nodes now have the same state as the original node


If you’re math-inclined, the specification for how the EVM works is defined in the Ethereum Yellow Paper. However, at this point, the implementation details of the EVM don’t really matter.

What matters is that nodes are running an EVM that is compatible with everybody else’s EVM. Two nodes running the same smart contract at the same time should get the same output. The deterministic nature of the EVM is what makes the underlying consensus work!

EVM Compatibility

It’s difficult to make a one-size-fits-all solution for any problem. Blockchains are no different, and many are built with specific use cases in mind. However, it would be a waste of time for developers to constantly rewrite their smart contracts for every new blockchain that was introduced. To fix this, many blockchains are designed to be EVM Compatible.


A blockchain protocol is EVM Compatible if its smart contracts can run on the Ethereum Virtual Machine.


The EVM enables developers to write blockchain-agnostic smart contracts, which ultimately increases the productivity of the entire web3 ecosystem.


For example, Polygon is a popular blockchain that launched as an alternative to Ethereum. Compared to Ethereum, Polygon can handle ~1000x more transactions per second at a fraction of the cost. These stats make using Polygon and Ethereum feel very different. Nevertheless, there is one key similarity: both are EVM compatible.




One of the main reasons for Polygon’s meteoric rise is its EVM compatibility. Paired with minuscule transaction fees, Polygon is an attractive alternative to Ethereum as it takes minimal effort for developers to port over their smart contracts.

Recap

In today’s article, we covered:

  • Blockchain fundamentals: transactions and decentralized systems

  • How the EVM helps with running transactions

  • Why EVM compatibility standardizes the developer experience across blockchains


Thanks for reading! I’d love to hear what you think and the future topics you’d like to see. Simply comment below or reach out on Twitter.



Also published here.