Ask Sawal

Discussion Forum
Notification Icon1
Write Answer Icon
Add Question Icon

What is evm network?

4 Answer(s) Available
Answer # 1 #

The EVM’s physical instantiation can’t be described in the same way that one might point to a cloud or an ocean wave, but it does exist as one single entity maintained by thousands of connected computers running an Ethereum client.

The Ethereum protocol itself exists solely for the purpose of keeping the continuous, uninterrupted, and immutable operation of this special state machine. It's the environment in which all Ethereum accounts and smart contracts live. At any given block in the chain, Ethereum has one and only one 'canonical' state, and the EVM is what defines the rules for computing a new valid state from block to block.

Some basic familiarity with common terminology in computer science such as bytes(opens in a new tab)↗, memory(opens in a new tab)↗, and a stack(opens in a new tab)↗ are necessary to understand the EVM. It would also be helpful to be comfortable with cryptography/blockchain concepts like hash functions(opens in a new tab)↗ and the Merkle tree(opens in a new tab)↗.

The analogy of a 'distributed ledger' is often used to describe blockchains like Bitcoin, which enable a decentralized currency using fundamental tools of cryptography. The ledger maintains a record of activity which must adhere to a set of rules that govern what someone can and cannot do to modify the ledger. For example, a Bitcoin address cannot spend more Bitcoin than it has previously received. These rules underpin all transactions on Bitcoin and many other blockchains.

While Ethereum has its own native cryptocurrency (Ether) that follows almost exactly the same intuitive rules, it also enables a much more powerful function: smart contracts. For this more complex feature, a more sophisticated analogy is required. Instead of a distributed ledger, Ethereum is a distributed state machine(opens in a new tab)↗. 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.

(opens in a new tab)↗ Diagram adapted from Ethereum EVM illustrated(opens in a new tab)↗

The EVM behaves as a mathematical function would: Given an input, it produces a deterministic output. It therefore is quite helpful to more formally describe Ethereum as having a state transition function:

Given an old valid state (S) and a new set of valid transactions (T), the Ethereum state transition function Y(S, T) produces a new valid output state S'

In the context of Ethereum, the state is an enormous data structure called a modified Merkle Patricia Trie, which keeps all accounts linked by hashes and reducible to a single root hash stored on the blockchain.

Transactions are cryptographically signed instructions from accounts. There are two types of transactions: those which result in message calls and those which result in contract creation.

Contract creation results in the creation of a new contract account containing compiled smart contract bytecode. Whenever another account makes a message call to that contract, it executes its bytecode.

The EVM executes as a stack machine(opens in a new tab)↗ with a depth of 1024 items. Each item is a 256-bit word, which was chosen for the ease of use with 256-bit cryptography (such as Keccak-256 hashes or secp256k1 signatures).

During execution, the EVM maintains a transient memory (as a word-addressed byte array), which does not persist between transactions.

Contracts, however, do contain a Merkle Patricia storage trie (as a word-addressable word array), associated with the account in question and part of the global state.

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.

(opens in a new tab)↗ Diagrams adapted from Ethereum EVM illustrated(opens in a new tab)↗

All implementations of the EVM must adhere to the specification described in the Ethereum Yellowpaper.

Over Ethereum's nine year history, the EVM has undergone several revisions, and there are several implementations of the EVM in various programming languages.

Ethereum execution clients include an EVM implementation. Additionally, there are multiple standalone implementations, including:

[5]
Edit
Query
Report
Terri Yuuki
Forensic Scientist
Answer # 2 #

Advantages:

Disadvantages:

Advantages:

Disadvantages:

Advantages:

Disadvantages:

Advantages:

Disadvantages:

Advantages:

Disadvantages:

[5]
Edit
Query
Report
Kenjiro Ford.
Aesthetic Nursing
Answer # 3 #

5 min read

The Ethereum Virtual Machine (EVM) is a core piece of Ethereum that helps power the blockchain and smart contracts. It is vital in assisting Ethereum to achieve user adoption and decentralization. In this guide, we will take a detailed look at the EVM to learn what the EVM is and how it operates. Then, we will cover some key points to solidify our understanding.

The Ethereum Virtual Machine (EVM) is the computation engine for Ethereum that manages the state of the blockchain and enables smart contract functionality. The EVM is contained within the client software (e.g., Geth, Nethermind, and more) that you need in order to run a node on Ethereum. Nodes on Ethereum keep copies of transaction data, which the EVM processes to update the distributed ledger. Generally speaking, nodes on Ethereum natively support the EVM as the client software implements this functionality.

Next, let us cover some of the tasks that the EVM performs.

The EVM participates in block creation and transaction execution. In block creation, the EVM sets standards for managing the state from block to block. These states are stored in a Merkle Patricia Trie and hold the ground truth state for Ethereum.

In transaction execution, the EVM executes tasks (e.g., function calls to a smart contract) by interpreting the instructions in Opcodes (machine instructions at a low level); however, the data is formatted in bytecode. To get the data into bytecode, you can use a programming language such as Solidity (i.e., the native programming language for smart contracts) to compile and deploy the smart contract using bytecode.

Note that when the EVM executes tasks, it is limited to the amount of gas provided by the transaction and the overall limitations of the EVM. Gas is a unit of measure for computing power on Ethereum.

To learn more about transactions, check out our guide on What are Ethereum Transactions?

Next, let us take a look at the architecture of the EVM.

The EVM operates off of a stack-based memory structure and contains memory components such as Memory, Storage, and Stack (which are used to read/write to the blockchain and manage state).

The EVM is considered quasi-turing complete, which means it can solve problems given a set of instructions and inputs but is limited to the amount of gas provided along with the transaction.

Now, let us cover how the EVM operates internally when a transaction's bytecode is being executed or when a new block is being created.

In this section, we will cover how the EVM operates. Note that this is a high level explanation and doesn't cover every operation of the EVM.

As we mentioned earlier, the EVM executes tasks formatted in bytecode which the EVM interprets in Opcodes. Let us explain how smart contract code (bytecode) is broken down into Opcodes.

For this example, we will reference the Simple storage contract (1_Storage.sol) on Remix.IDE. The simple storage contract's compiled bytecode looks like this:

Note that the EVM only uses 140 unique opcodes; however, there are a total of 256 Opcodes which are 1 byte in length. Now let us look at the bytecode for one of the functions in the contract (e.g., store()).

Each byte in the example above refers to a different Opcode. For example, the first byte (e.g., 60) refers to a PUSH1 opcode, the next byte (e.g., 00) refers to the data being pushed, the third byte (60) refers to the PUSH1 opcode again, and the next byte refers to its input (e.g., e0). To see all the Opcodes for the function above, you can go to evm.codes/playground and input the bytecode into the IDE and click Run (make sure to select Bytecode in the dropdown.

Now that we know a bit more about how the EVM executes bytecode, let us move onto understanding the Ethereum state transition function.

The Ethereum State Transition Function

The Ethereum state transition function is a formula that the EVM processes every time it executes a transaction. The purpose of the function is to make sure transactions adhere to the transaction standard and are technically valid (e.g., correct nonce and valid signature). The formula is as follows:

You should now better understand how the EVM operates and is designed. Next, let us cover some key benefits of the EVM.

If you want to dive deeper into the EVM, check out the following resources:

Or if you're curious about creating your own smart contract, look at our An overview of how smart contracts work on Ethereum guide.

Kudos! You now understand a bit more about the EVM. Got ideas or questions, or want to show off what you have learned? Tell us on Discord or reach out to us via Twitter.

[2]
Edit
Query
Report
Steffi Jackson-Healy
Chief Risk Officer
Answer # 4 #

The Ethereum Virtual Machine (EVM) is the computation engine for Ethereum that manages the state of the blockchain and enables smart contract functionality. The EVM is contained within the client software (e.g., Geth, Nethermind, and more) that you need in order to run a node on Ethereum.

[1]
Edit
Query
Report
Robert Phukan
SLICING MACHINE TENDER