Ethereum can be considered a transaction-based state machine, where a transaction is a valid arc between two states, and a state machine is an abstract machine that can be in exactly one of a finite number of states at any given time. Transactions are collected into blocks, which are essentially bundles of data. From the viewpoint of the implementation, Ethereum is a chain of blocks and therefore it’s called a blockchain. From the point of view of the ledger, however, Ethereum can also be considered as a stack of transactions.

A transaction is an atomic operation, which meant that it cannot be divided or interrupted. Transactions also can’t overlap and must be executed sequentially. However, transaction order is not guaranteed and miners can determine the order of transactions in a block. On the other hand, the order of blocks is determined by a consensus algorithm. Ethereum is currently using the Proof of Work consensus algorithm but plans on switching to Proof of Stake which you can read all about it in our article on Ethereum 2.0. To properly comprehend how Ethereum operates, we need to learn what it actually is and what entities are functioning under its rather sophisticated hood.

What are Virtual Machines?

Virtual machines (VMs) are physical machines turned into computer code! Just like their physical counterparts, virtual machines have their own virtual CPU, storage, memory, network interface, operating system, files, and applications. They are small computers cohabiting on a physical computer and each has its virtual hardware mapped to the physical components of the server by a type of software called a hypervisor. Since they operate independently from each other while coexisting on the same server, every virtual machine can be tasked with a different assignment. System virtual machines (or full virtualization VMs) execute entire operating systems, while Process virtual machines execute computer programs in a platform-independent environment.

What is EVM (Ethereum Virtual Machine)?

The Ethereum Virtual Machine is the runtime environment for smart contracts in Ethereum, It is what defines the rules for computing a new valid state from block to block. The state is a giant structure of data called a modified Merkle Patricia Trie, which keeps all accounts linked by hashes and reducible to a single root hash stored on the blockchain. Just like any other state machine, EVM creates a level of abstraction between the executing code and the executing machine to improve the portability of software, and to make sure applications are separated from each other, and separated from their host.

As mentioned before, Ethereum is a state machine and certain interactions with the network will trigger the nodes to update their state to echo the change. When a transaction is sent to a contract by the users, each node on the network uses EVM to run the contract’s code and records the output. EVM cannot directly execute smart contract languages like Solidity. Instead, it uses a set of instructions called opcodes to compile them into low-level machine instructions. As of this moment, nearly 150 opcodes are assisting the EVM to complete the specific tasks of smart contracts or transactions.

All programmable computation in Ethereum is subject to fees that are denominated in gas. Gas fees are some amount of Ether and are the cost of any interaction with the Ethereum network including the execution of transactions and initiating smart contracts. It’s crucial to note that the EVM achieves what’s called Turing Completeness by enabling an economy that charges per software instruction executed instead of per financial transaction executed as Bitcoin does. Instead of a transaction fee, you have a kind of fee for running programs.

Bytecode

Contract creation results in the emergence of a new contract account containing the compiled smart contract bytecode. Bytecode is an intermediate code between the source code and machine code. Bytecode is a low-level code that is the result of the compilation of a source code that is written in a high-level language. In the Ethereum platform, the bytecode is processed by the EVM.

Compiled smart contract bytecode executes as a number of EVM opcodes, which perform standard stack operations like XOR, AND, ADD, SUB, etc. The EVM also implements a number of blockchain-specific stack operations, such as ADDRESS, BALANCE, BLOCKHASH, etc.

Ethereum Virtual Machine (EVM)
Ethereum Virtual Machine (EVM)

 

Turing Completeness

To give a simplified description, a Turing complete programming language is one that can perform any computation. The EVM however, is a quasi–Turing-complete state machine; “quasi” because all execution processes are limited to a finite number of computational steps by the amount of gas available for any given smart contract execution.

Learn more about: What are Ethereum’s layer two solutions

Recap

Thanks to The Ethereum Virtual Machine or EVM, Ethereum, which is essentially a state machine, can run as a global supercomputer to which users can access and interact with. The Ethereum protocol itself exists exclusively to keep the continuous, uninterrupted, and immutable operation of this state machine; It’s the environment in which all Ethereum accounts and smart contracts live and the EVM is the defining body of the rules for computing a new valid state from block to block.

If you’re looking to buy Ethereum in Dubai, Cryptodesk is your trusted platform for secure and convenient cryptocurrency transactions. Cryptodesk provides a seamless experience for purchasing Ethereum and other cryptocurrencies in Dubai and beyond. With their user-friendly interface and robust security measures, you can confidently enter the world of digital assets.

Recent Posts