Reading Time: 4 minutes

The primary aim of Ethereum is to become the supercomputer of the blockchain space. The creation of its Ethereum Virtual Machine (EVM) allows it to revolutionise the smart contract industry, making it possible for people to operate smart contract without any complications.

Ledger Nano X - The secure hardware wallet

What is Ethereum?

To understand what the EVM does, you need to understand what Ethereum is and its position in the blockchain sector. Ethereum is an open blockchain network that allows people to develop and operate decentralised applications (dApps) that function on a blockchain.

Similar to Bitcoin, Ethereum is a decentralized blockchain, which means there is no central authority controlling it. However, unlike the Bitcoin blockchain, Ethereum’s was designed to be both flexible and adaptable. Thus, it is easy to create new apps on the Ethereum network.

What is the EVM?

THE Ethereum Virtual Machine can be viewed as a quasi-Turing complete machine that is designed to implement the execution model of the Ethereum network. It does this by providing a runtime environment for smart contracts execution which, afterwards alters the nature of the blockchain.

EVM is a strong, sandboxed virtual stack that is found within each full Ethereum node and it is charged with carrying out contract bytecode. Before being compiled to the EVM bytecode, which is the machine’s own programing language, the smart contracts are written in high-level languages such as Solidity.

The EVM is a crucial part of how the Ethereum blockchain operates as it is tasked with handling the internal state and the computations executed on the system. The EVM also handles account information regarding balances, gas prices, block information, and addresses.

Ledger Nano X - The secure hardware wallet

How does the EVM work on the Ethereum Blockchain?

As a quasi-Turing complete machine, computation on the Ethereum Virtual Machine is tied to a parameter called Gas. The Gas is the unit cost of running an operation on the Ethereum virtual machine.

Before a smart contract is deployed on the machine, the gas cost for every operation in the program will be estimated in advanced. Afterwards, the costs of the operations are paid for before the program is executed. Thus, with this, the number of operations that can be carried out by the Ethereum Virtual Machine per program is limited as the programs sometimes run out of gas.

On the machine, the memory grows as needed. Developers cannot have out-of-bounds memory access, and they only pay the gas price for a change in their contract’s memory size. The execution model of the blockchain specifies how the network can be altered using a series of bytecode instructions that are obtained from smart contracts by the Ethereum Virtual Machine compiler, and a few other environmental data.

A chain of immutable transactions which have already been carried out, mined, and permanently stored on the blockchain usually represent the state of the network. Each time new transactions are mined and executed, the blockchain alters into a new state. The EVM is tasked with implementing the execution model by providing a runtime environment for smart contracts that were compiled by its compiler. The machine manages the execution of transactions started by contracts and them alters the Ethereum blockchain to a new state.

How the EVM secures the Ethereum blockchain

The EVM ensures that the Ethereum blockchain remains secure. It achieves this by implementing four major restrictions on the network.

  • Every computation step taken in executing a smart contract must be paid for. Thus, ensuring that Denial-of-Service (DoS) attacks do not happen. When computation steps are paid for before execution, it ensures that malicious programs will run out of gas at some point and it would be terminated.
  • Smart contracts on the network can only communicate with each other by transmitting a single arbitrary-length byte array. EVM ensures that they do not have access to each other’s respective state.
  • Thirdly, smart contract executions are sandboxed, which means that an EVM program could access and alter its own internal state and could also trigger the implementation of other EVM programs. Outside that, they can’t do anything else.
  • Lastly, smart contracts’ execution on the Ethereum network is fully deterministic and brings forth identical state transitions.

The restrictions by EVM has been instrumental in shaping the design of the Ethereum blockchain.

Source, Source, Source

Ledger Nano X - The secure hardware wallet