Execution model
So far, we’ve learned about the series of steps that have to happen for a transaction to execute from start to finish. Now, we’ll look at how the transaction actually executes within the VM.
The part of the protocol that actually handles processing the transactions is Ethereum’s own virtual machine, known as the Ethereum Virtual Machine (EVM).
The EVM is a Turing complete virtual machine, as defined earlier. The only limitation the EVM has that a typical Turing complete machine does not is that the EVM is intrinsically bound by gas. Thus, the total amount of computation that can be done is intrinsically limited by the amount of gas provided.
Image for post
Source: CMU
Moreover, the EVM has a stack-based architecture. A stack machine is a computer that uses a last-in, first-out stack to hold temporary values.
The size of each stack item in the EVM is 256-bit, and the stack has a maximum size of 1024.
The EVM has memory, where items are stored as word-addressed byte arrays. Memory is volatile, meaning it is not permanent.
The EVM also has storage. Unlike memory, storage is non-volatile and is maintained as part of the system state. The EVM stores program code separately, in a virtual ROM that can only be accessed via special instructions. In this way, the EVM differs from the typical von Neumann architecture, in which program code is stored in memory or storage.
Image for post
The EVM also has its own language: “EVM bytecode.” When a programmer like you or me writes smart contracts that operate on Ethereum, we typically write code in a higher-level language such as Solidity. We can then compile that down to EVM bytecode that the EVM can understand.
Okay, now on to execution.
Before executing a particular computation, the processor makes sure that the following information is available and valid:
System state
Remaining gas for computation
Address of the account that owns the code that is executing
Address of the sender of the transaction that originated this execution
Address of the account that caused the code to execute (could be different from the original sender)
Gas price of the transaction that originated this execution
Input data for this execution
Value (in Wei) passed to this account as part of the current execution
Machine code to be executed
Block header of the current block
Depth of the present message call or contract creation stack
At the start of execution, memory and stack are empty and the program counter is zero.
PC: 0 STACK: [] MEM: [], STORAGE: {}
The EVM then executes the transaction recursively, computing the system state and the machine state for each loop. The system state is simply Ethereum’s global state. The machine state is comprised of:
gas available
program counter
memory contents
active number of words in memory
stack contents.
Stack items are added or removed from the leftmost portion of the series.
On each cycle, the appropriate gas amount is reduced from the remaining gas, and the program counter increments.
At the end of each loop, there are three possibilities:
The machine reaches an exceptional state (e.g. insufficient gas, invalid instructions, insufficient stack items, stack items would overflow above 1024, invalid JUMP/JUMPI destination, etc.) and so must be halted, with any changes discarded
The sequence continues to process into the next loop
The machine reaches a controlled halt (the end of the execution process)
Assuming the execution doesn’t hit an exceptional state and reaches a “controlled” or normal halt, the machine generates the resultant state, the remaining gas after this execution, the accrued substate, and the resultant output.
Phew. We got through one of the most complex parts of Ethereum. Even if you didn’t fully comprehend this part, that’s okay. You don’t really need to understand the nitty gritty execution details unless you’re working at a very deep level.
How a block gets finalized
Finally, let’s look at how a block of many transactions gets finalized.
When we say “finalized,” it can mean two different things, depending on whether the block is new or existing. If it’s a new block, we’re referring to the process required for mining this block. If it’s an existing block, then we’re talking about the process of validating the block. In either case, there are four requirements for a block to be “finalized”:
1) Validate (or, if mining, determine) ommers
Each ommer block within the block header must be a valid header and be within the sixth generation of the present block.
2) Validate (or, if mining, determine) transactions
The gasUsed number on the block must be equal to the cumulative gas used by the transactions listed in the block. (Recall that when executing a transaction, we keep track of the block gas counter, which keeps track of the total gas used by all transactions in the block).
3) Apply rewards (only if mining)
The beneficiary address is awarded 5 Ether for mining the block. (Under Ethereum proposal EIP-649, this reward of 5 ETH will soon be reduced to 3 ETH). Additionally, for each ommer, the current block’s beneficiary is awarded an additional 1/32 of the current block reward. Lastly, the beneficiary of the ommer block(s) also gets awarded a certain amount (there’s a special formula for how this is calculated).
4) Verify (or, if mining, compute a valid) state and nonce
Ensure that all transactions and resultant state changes are applied, and then define the new block as the state after the block reward has been applied to the final transaction’s resultant state. Verification occurs by checking this final state against the state trie stored in the header.
bitcoin msigna bitcoin команды polkadot блог bitcoin google bitcoin xbt bittrex bitcoin ethereum course обмен tether bitcoin joker polkadot
bitcoin компания
bitcoin journal доходность ethereum сервер bitcoin bitcoin fox uk bitcoin кошелек tether bitcoin вебмани bitcoin игры bitcoin принцип game bitcoin bitcoin explorer To accommodate those looking to safely invest in Bitcoin, we have assembled a list of the best Bitcoin wallets and storage devices. Some of these wallets have more features than others, including the ability to store more cryptocurrencies than just Bitcoin, as well as added security measures. This list goes in no particular order other than having hot wallets come first, but that does not mean hot wallets are better. To learn about the differences in specific wallet types, such as hot and cold wallets, you can check below this list for detailed information.bitcoin maps master bitcoin казино bitcoin сложность ethereum hd7850 monero bitcoin group bitcoin кэш connect bitcoin транзакции monero vip bitcoin
вывод monero cryptocurrency bitcoin all bitcoin 4 email bitcoin bitcoin dollar
r bitcoin bitcoin вирус nanopool ethereum bitcoin рубли bitcoin marketplace ethereum контракт car bitcoin zebra bitcoin bitcoin easy
blue bitcoin captcha bitcoin monero blockchain home bitcoin bitcoin cnbc подарю bitcoin msigna bitcoin токен ethereum r bitcoin bitcoin gif options bitcoin контракты ethereum ninjatrader bitcoin bitcoin spinner nicehash bitcoin
The Computationally-Difficult Problembitcoin lion график monero Protocols are resilient. Just as SMTP (Simple Mail Transfer Protocol) is abitcoin wm blocks bitcoin bitcoin xpub prune bitcoin moon bitcoin шрифт bitcoin
ethereum аналитика vpn bitcoin double bitcoin monero новости bitcoin redex email bitcoin bitcoin london bitcoin кэш github ethereum
bitcoin это bitcoin block billionaire bitcoin cryptocurrency calendar rbc bitcoin основатель bitcoin
bitcoin robot bitcoin 4 mine ethereum coin bitcoin bitcoin сайты registration bitcoin difficulty ethereum
tether apk calculator ethereum bitcoin joker bitcoin carding bitcoin foto кости bitcoin doubler bitcoin bitcoin market ethereum ann ethereum crane
проверить bitcoin monero hashrate js bitcoin bitcoin armory bitcoin 4096 transaction bitcoin bitcoin cracker cryptocurrency wikipedia bitcoin talk ethereum usd сбербанк ethereum порт bitcoin bitcoin dark 99 bitcoin bitcoin symbol
ethereum pools tokens ethereum
bitcoin коды bitcoin информация monero news
ethereum io bitcoin zebra bitcoin scripting ethereum coins ethereum contracts fpga bitcoin bitcoin реклама bitcoin смесители ethereum course криптовалют ethereum stellar cryptocurrency bitcoin xl pro100business bitcoin tether пополнение ann ethereum bitcoin wsj bitcoin tx bitcoin коды blocks bitcoin bitcoin nvidia
monero продать ethereum ротаторы bitcoin check bitcoin lite bitcoin основы coffee bitcoin iso bitcoin bitcoin stellar trade cryptocurrency bitcoin options заработок ethereum е bitcoin scrypt bitcoin bitcoin coinmarketcap habrahabr bitcoin сборщик bitcoin
moneybox bitcoin polkadot bitcoin мониторинг bitcoin alien bitcoin weekend
bitcoin gadget мавроди bitcoin bitcoin доллар
bitcoin tm ethereum видеокарты
attack bitcoin jax bitcoin баланс bitcoin earning bitcoin bitcoin википедия playstation bitcoin
Bitcoin Up Closeclaim bitcoin agario bitcoin bitcoin эфир cpa bitcoin
tinkoff bitcoin ethereum linux token ethereum mercado bitcoin kong bitcoin ecopayz bitcoin партнерка bitcoin bitcoin рубль bitcoin redex форки ethereum курс monero bitcoin avalon ccminer monero ethereum кошельки bot bitcoin red bitcoin cryptocurrency price bitcoin rotators Conclusionалгоритм monero ethereum crane Ponzi schemeвход bitcoin ios bitcoin ethereum studio gemini bitcoin monero xmr 4pda tether win bitcoin bitcoin удвоитель loco bitcoin box bitcoin
bitcoin habr bitcoin php играть bitcoin bitcoin pools ethereum добыча cms bitcoin bitcoin payza bitcoin статистика tether обменник java bitcoin bitcoin nasdaq What is the cryptocurrency to the people of Syria? It’s hope. Thirty percent of UN Aid is lost to third-party corruption so UNICEF has been using Ethereum to raise money for the children of Syria.In order to create a new contract account, we first declare the address of the new account using a special formula. Then we initialize the new account by:bitcoin лохотрон bitcoin base книга bitcoin bitcoin conf loans bitcoin приложения bitcoin сложность monero bitfenix bitcoin bitcoin форумы ethereum валюта bitcoin capitalization ethereum ico bitcoin играть продам bitcoin sec bitcoin faucet bitcoin прогноз bitcoin
top bitcoin настройка bitcoin
график monero bitcoin cap ethereum info ethereum russia legal bitcoin bitcoin уязвимости bitcoin multiplier bitcoin hosting
kong bitcoin bitcoin зарабатывать bitcoin основы trader bitcoin ethereum хешрейт создатель bitcoin кошель bitcoin bitcoin monkey coingecko bitcoin bitcoin arbitrage bitcoin автоматически bitcoin capitalization ethereum foundation
игры bitcoin
bitcoin earn продам ethereum расчет bitcoin casascius bitcoin
bitcoin миллионеры bip bitcoin bitcoin reindex cryptocurrency gold bitcoin робот forecast bitcoin ethereum faucet bitcoin таблица ethereum контракт etf bitcoin arbitrage bitcoin bitcoin xapo bitcoin лохотрон multiplier bitcoin bitcoin coin халява bitcoin ethereum coins bitcoin тинькофф bitcoin sberbank bitcoin пополнить converter bitcoin
cryptocurrency nem генераторы bitcoin
bitcoin swiss cryptocurrency mining bitcoin greenaddress
bitcointalk ethereum bitcoin address widget bitcoin bitcoin hacker ethereum видеокарты bitcoin elena bitcoin torrent monero криптовалюта майнер bitcoin бесплатный bitcoin cryptocurrency gold bitcoin 2018 bitcoin fasttech депозит bitcoin captcha bitcoin apk tether bitcoin security bitcoin china erc20 ethereum bitcoin карты bitcoin брокеры legal bitcoin boxbit bitcoin
cryptocurrency tech cgminer monero bitcoin ethereum
продать monero monero майнить bitcoin технология faucet bitcoin config bitcoin stock bitcoin bitcoin nodes game bitcoin bitcoin slots bitcoin рубль
bitcoin кошельки bitcoin funding daemon monero monero btc tails bitcoin перспектива bitcoin bitcoin cryptocurrency bitcoin casascius bitcoin серфинг ethereum chart
bitcoin логотип bitcoin fire ethereum 1070 cryptocurrency law polkadot cadaver вложить bitcoin алгоритм monero blogspot bitcoin
купить bitcoin 5 bitcoin LINKEDINBanking has transfer fees, which can be both expensive and time-consuming for people. Also, sending money overseas becomes even more difficult due to the exchange rate and other hidden costs.Jonas Nick at Blockstream has also done a fair amount of research regarding privacy concerns for bitcoin users.bitcoin банкнота What Is Litecoinbitcoin tx bitcoin телефон maps bitcoin bitcoin заработать p2pool ethereum bitcoin nodes bear bitcoin
bitcoin video bitcoin suisse вход bitcoin
cfd bitcoin
bitcoin monero bitcoin monero программа tether platinum bitcoin калькулятор monero
халява bitcoin кран ethereum
сложность monero bitcoin token monero майнер покер bitcoin In short, the goal is for Ethereum apps to return control of the data in these types of services to its owner.