Ethereum Virtual Machine

What is the Ethereum Virtual Machine

Perhaps the most interesting feature of the Ethereum blockchain is that it's more than just a crypto-currency. We can mint tokens in the form of coins and NFTs, but we can also use the Ethereum for things like smart contracts, Decentralized Applications, Decentralized Autonomous Organisations, Decentralized Finance and more.

But how can so many different things live on the ethereum blockchain, espically things like smart-contracts?

Ethereum Virtual Machine (EVM)

This is a virtual state machine, a runtime environment for transaction execution.

The smart contract code execution is isolated from the Ethereum network, only the transactions are recorded on the blockchain.

The EVM is a Turing complete system, meaning that it can use arbitrary algorithmic complexity to solve almost any computational problem thrown at it.

ethereum virtual machine

Gas fees

There are some interesting limitations around EVMs and especially smart contracts. We're essentially limited by something called a gas fee which is the cost of running the transaction. The complexity of a smart contract is directly related to the gas fees for runningthat contract. The more complex, the more expensive it is to run.

Gas fees have been likened to consumption of oil. In the real world, there is a cost to manufacture anything, the underlying cost of production for all real-world items is the cost of the energy needed to manufacture the component or the end-product. Gas fees are basically the same. The gas fee is a manufacturing cost.

Interestingly the limitation introduced by the gas fee means that the EVM is technically quasi-turing-complete.

The benefit of the gas fee is that it prevents a bad actor from writing a smart contract that includes an infinite loop in the hope of bringing down the ethereum network. The gas fee is a cost of running your smart contract and it can only run until your gas fee has been consumed, therefore, an infinite loop would either cost the attacker an immense sum of money or would stop as soon as the gas has been consumed.