I decided to start a crusade to share gained web3 knowledge about various stuff, I thought I'll start with EVM!
The core component of Ethereum network.
What it is? How does it work?
All in one place ☝🏻 Enjoy!
What is EVM?
When You hear Ethereum Virtual Machine, You hear two things:
- Virtual Machine
I anticipate that You already know what Ethereum is, but if You’ve been living under a rock, here’s a quick definition:
“Ethereum is a decentralised, open-source blockchain with smart contract functionality” - wikipedia.
Plus the creator of Ethereum is said to be Vitalik Buterin. Of course not alone, but he’s said to be the Godfather of that project.
And what is a virtual machine?
You might think of it like a computer inside a computer.
It is an emulated Operating System that runs inside of a host (Another Operating System) and uses its resources. Of course as the resources of the host are finite, ex. 16 GB of RAM, the VM (Virtual Machine) can only take portion of that. Not all as the host also needs some of it to function: Ex. Host - 10 GB RAM VM - 6 GB RAM.
But coming back to EVM; You might now conclude that EVM is a kind of a virtual machine running on a different host. You’re correct! Kinda… ;)
As blockchains are distributed networks of Nodes (computers), EVM is not that simple as a VM using resources. It is a “distributed computer” or “world computer” as some might call it. Let that sink in for a moment while I tell You about the Ethereum client called GETH that makes this architecture function.
GETH is an Ethereum client that the EVM is living in. Diagram to save your sanity:
So remember, it’s ALL SOFTWARE BASED! The only hardware (CPU, RAM, Hard/SolidState Drives) are inside of the Computer. So GETH, EVM <- All Software. But that shows You even better what is Ethereum, it’s a bunch of machines that run GETH Ethereum Clients in which an EVM lives.
How does it work?
As You might have a programming background, or not. There’s one thing You have to understand: Computers don’t understand shit, from the english words written in many programming languages.
So if You pop into your computer:
Write-Output "Hello World"
The computer does not know what kind of gibberish is that… Then such code can be compiled for example, or “translated” in simpler terms into a machine understandable language: Byte Code.
Example for python “hello world”:
So as the main language for smart contracts (applications running on blockchains) is Solidity, it has the same procedure: After the code is written by the developer, it has to be translated into byte code (compiled); Then the flow continues and the smart contract is deployed to EVERY Ethereum Node that runs GETH.
What comes next is the byte code that was deployed, so the smart contract that the developer wrote is being executed by the EVM and it’s results that are affecting the state of the blockchain tracked. As users can also interact with the smart contracts via transactions. So its execution/tracking platform operating on every Node for the whole Ethereum Blockchain.
THAT’S IT! That’s what EVM is. I know that it might sound turbo complex, but give your brain a moment to grasp that concept.
Follow what happens step by step. I’m sure You’ll get that.
Thx and have a good day! ✌🏻