Understanding Ethereum Virtual Machine

Narender Charan
3 min readMar 22, 2022

Introduction

After the boom of Bitcoin, more and more crypto enthusiasts have joined the DeFi space. With the introduction of Ethereum, the aftershocks were tremendous. With the invention of smart contracts, the use cases of blockchain technology seemed infinite.

In this blog, we shall discuss the basics and working principles of EVM (Ethereum Virtual Machine), the backbone of the entire Ethereum blockchain.

What is a Virtual Machine?

Virtual Machines allow users to run a completely different OS on top of a pre-existing OS without the need for any separate physical hardware. The technology using which a user can host any number of virtual computers on top of a physical computer is called a hypervisor.

Hypervisor uses the hardware resources of the host computer to build a virtual RAM, virtual CPU, and virtual storage for each virtual machine.

As each virtual machine is independent of the other virtual machines and also of the host machine, any damage in the VMs cannot affect the host OS in any way.

What is EVM and how does it work?

Simply put, EVM (Ethereum Virtual Machine) is a virtual engine that helps users not only make simple monetary transactions but also create and deploy smart contracts (hence helps develop dApps) on the Ethereum blockchain in a decentralized manner.

EVM carries out specific tasks using instructions called opcodes. Each opcode is 1 byte in size and encrypted into bytecode. When a user executes a specific task, it again gets split into the constituent bytes.

Being Turing-complete, EVM should be able to do any computational problem. Furthermore, since the code in the EVM is completely isolated and has no access to the network, file system, or any other processes; EVM is very secure.

Developers typically write codes in high-level languages like Solidity which then get compiled into bytecode for the EVM to understand and execute. For anyone wanting to become a node in the Ethereum network, they need to run Geth (Go Ethereum) on their computers and hence run a version of the EVM.

The state of a blockchain can be considered a snapshot of how the blockchain looks at a particular point in time. Each time a transaction is made, the state of the blockchain changes. Each node has an updated copy of the state at all times.

Suppose a developer writes a code in Solidity, compiles them into bytecode, and deploys a smart contract on the blockchain. Note that each node on the blockchain now has a copy of this. Now, when a transaction interacts with the smart contract it changes the state of the blockchain and the new state is updated on all the nodes of the network. Each node on the network uses EVM to achieve consensus across the blockchain.

This eliminates the need to rely on any intermediate third parties and hence enables users to carry out transactions in a trustless and transparent manner. The risk of any node trying to intentionally slow down the network by deploying complex smart contracts is mitigated by the use of gas fees. It puts a limit on the amount of work required to do by an operation.

Conclusion

The EVM can thus be considered as a global, decentralized, master computer that carries out various types of tasks on the Ethereum blockchain. In this blog, we have just scratched the surface of EVM and how it works. We shall take an even deeper dive into this in our future blogs.

--

--

Narender Charan

I’ve read this script and the costume fits, so I’ll play my part