EVM or Ethereum Virtual Machine is a sandboxed contaner which can run EVM bytecode. EVM is basically a fully isolated from networks, system files or any other things from the host computer.
How it works ??
On blockchain, smart contracts are built with the help of programming language like solidity, rust, python, etc . Then the code is converted to EVM bytecode to run the smart contract on all Ethereum(or EVM-based blockchain) nodes. Every node in the Ethereum network runs an EVM instance which allows them to agree on executing the same instructions. And to agree on any instruction(verifying a transaction), they uses some consensus mechanism like Proof of Stake, Proof of Work etc…
EVM also keep track of the Gas fee attached to the transaction and ot have two main advantages. Firstly, the person running the node will get rewarded even if the transaction fails. Secondly, if there is some problem in execution, the validator will run out of Gas. This does help the validators to not to execute a transaction infinitely for validation.
But why so much work ??
- Distributed State Machine — According to Official Ethereum docs, EVM not just holds the account but it also holds the complete state of machine. An excerpt from Ethereum docs — ‘Ethereum’s state is a large data structure which holds not only all accounts and balances, but a machine state, which can change from block to block according to a pre-defined set of rules, and which can execute arbitrary machine code. The specific rules of changing state from block to block are defined by the EVM.’
- Isolation — EVM runs in an isolated environment to maintain privacy of the validator and protect it from any malicious hack.
- Interportability — Many blockchian uses EVM to run code and this makes it easy to run Ethereum Smart Contract code on other blockchiains like Polygon, Avalance, Celo, BSC and more.
More from official docs here 👇
Follow BlockTrain for more:
- Roadmaps : blocktrain.info/roadmaps
- Dev related : blocktrain.info/developer
- Non dev related : blocktrain.info/non-developer
- Hindi stuff : blocktrain.info/hindi
- Chains : blocktrain.info/chains
- Concepts : blocktrain.info/concepts
- Defi : blocktrain.info/defi