![]() ![]() The EVM executes as a stack machine (opens in a new tab) with a depth of 1024 items. Whenever another account makes a message call to that contract, it executes its bytecode. There are two types of transactions: those which result in message calls and those which result in contract creation.Ĭontract creation results in the creation of a new contract account containing compiled smart contract bytecode. ![]() Transactions are cryptographically signed instructions from accounts. 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. 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' State It therefore is quite helpful to more formally describe Ethereum as having a state transition function: The EVM behaves as a mathematical function would: Given an input, it produces a deterministic output. (opens in a new tab) Diagram adapted from Ethereum EVM illustrated (opens in a new tab) The Ethereum state transition function The specific rules of changing state from block to block are defined by the EVM. 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. Instead of a distributed ledger, Ethereum is a distributed state machine (opens in a new tab). For this more complex feature, a more sophisticated analogy is required. 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. These rules underpin all transactions on Bitcoin and many other blockchains. For example, a Bitcoin address cannot spend more Bitcoin than it has previously received. ![]() 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. The analogy of a 'distributed ledger' is often used to describe blockchains like Bitcoin, which enable a decentralized currency using fundamental tools of cryptography. 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). 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. 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. It's the environment in which all Ethereum accounts and smart contracts live. The Ethereum protocol itself exists solely for the purpose of keeping the continuous, uninterrupted, and immutable operation of this special state machine. 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. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |