The Ethereum Virtual Machine is a system that tracks changes on the Ethereum blockchain in a decentralized manner. It keeps track of the ‘State’ / the latest version of the blockchain. Users can run the Ethereum Virtual Machine on a computer and use it to create their own programs (smart contracts) and make them part of Ethereum.
The state of the blockchain is modified by transactions. Every transaction is a change in the blockchain and all participants of this blockchain must be aware of this. A change can arise from, for example, an event on a smart contract.
How EVM works
Ethereum is a distributed network and runs on countless machines around the world. To be able to get started with the code, the Ethereum Virtual Machine exists. You can see this as a CPU that runs in a computer by means of a program ‘Geth’. Everyone running Geth on a Windows, Unbuntu or Mac is connected.
The Ethereum Virtual Machine works the same as a normal CPU/computer. It executes written code according to instructions written using the Solidity programming language. The code (bytes) executed by the EVM are Ethereum smart contracts. EVM is a virtual CPU/computer aka software. It doesn’t exist in the world like you can buy a computer in the store. The EVM is ‘inside’ the Geth software.
Smart contracts, or applications, can be created on the EVM. Projects created on the Ethereum blockchain are created in the EVM. Being part of the Ethereum blockchain, the application is one that runs on its own. Transactions made on this application are distributed by means of all participants of the network and thus other parts of the big picture.
Geth is the software that contains the EVM. The moment you run Geth on your computer, you are actually part of the Ethereum network. You are therefore connected to everyone else who runs Geth. The Ethereum network is nothing but a bunch of computers all running Geth.
As soon as you create a smart contract, everyone with Geth will receive a copy of this code. The moment a smart contract is actually called, everyone within the Ethereum network will also execute the copy of the smart contract. This keeps every machine up-to-date with the latest change made by a smart contract.
You can imagine that quite a few smart contracts have been deployed by now. In total, there are currently 1.5 million smart contracts outstanding. Every small change made by a smart contract can cause a change in the state of the blockchain. After a change, everyone with Geth will receive a sign of this and will execute the same code so that every Node on the network (computer with Geth) always has the correct version.
The state is the last state of the blockchain. This contains the cash book of how much Ethereum everyone has, which wallets there are and which smart contracts have been made. Every small change made by a smart contract must be tracked by all computers running Geth.
Transactions are made on the Ethereum network and within smart contracts. These are the changes that are made on the blockchain. Every transaction must be paid and this is done on the basis of GAS. On the Ethereum network, the costs for this are expressed in Gwei. This is the smallest unit of Ethereum, like Satoshi is for Bitcoin.