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.
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 . Ethereum's state is a large data structure which holds not only all accounts and balances, but a machine statehg0088线上, 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.
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:
1Y(S, T)= S'2
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
In the context of Ethereum, the state is an enormous data structure called a , which keeps all accounts linked by hashes and reducible to a single root hash stored on the blockchain.
Contract creation results in the creation of a new contract account containing compiled smart contracthg0088线上 bytecode. Whenever another account makes a message call to that contract, it executes its bytecode.
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 , which perform standard stack operations like
SUB, etc. The EVM also implements a number of blockchain-specific stack operations, such as
All Ethereum clientshg0088线上 include an EVM implementation. Additionally there are multiple standalone implementations, including: