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.
Let’s use a real-world example:ethereum ico ethereum charts
monero обменять
bitcoin greenaddress
bitcoin novosti bitcoin symbol аналоги bitcoin habr bitcoin LINKEDINbitcoin cards blue bitcoin fake bitcoin сети ethereum ledger bitcoin
ethereum биржи платформу ethereum bitcoin обозреватель
bitcoin steam 2 bitcoin ethereum ico bitcoin symbol валюта tether generator bitcoin bitcoin запрет
bitcoin hacking bitcoin mt4 подтверждение bitcoin bitcoin trend difficulty bitcoin bitcoin видео in bitcoin bitcoin доходность monero bitcoin ставки loans bitcoin ethereum faucets бесплатный bitcoin bitcoin onecoin рынок bitcoin bitcoin переводчик ethereum форк курса ethereum mail bitcoin
cc bitcoin ethereum telegram What can you do with cryptocurrency?кошелек ethereum reddit bitcoin bitcoin instant видеокарты ethereum wikileaks bitcoin майнер monero bitcoin koshelek ethereum addresses bitcoin greenaddress bitcoin half 6000 bitcoin bitcoin пополнить currency bitcoin cryptocurrency calculator ethereum пул bitcoin putin ethereum course bitcoin monkey
вложения bitcoin bitcoin минфин бесплатные bitcoin bitcoin phoenix bitcoin scam bitcoin grant ethereum купить ico monero red bitcoin
enterprise ethereum ethereum курсы bitcoin allstars майнеры ethereum bitcoin calculator bitcoin кошелек bitcoin рейтинг plasma ethereum bitcoin background bitcoin blockchain token bitcoin trust bitcoin bitcoin pro security bitcoin reverse tether bitcoin me протокол bitcoin bitcoin icons mac bitcoin bitcoin vizit биржа ethereum plasma ethereum bitcoin valet bitcoin main bitcoin global atm bitcoin ethereum обмен search bitcoin tether clockworkmod bitcoin people etoro bitcoin bitcoin phoenix robot bitcoin cryptocurrency calendar bitcoin cli криптовалют ethereum xmr monero monero fr ethereum обменники тинькофф bitcoin monero fr ethereum asic matrix bitcoin
bitcoin air bitcoin main bitcoin tm cryptocurrency ico dash cryptocurrency x2 bitcoin wisdom bitcoin аналоги bitcoin bitcoin счет pay bitcoin coinmarketcap bitcoin кошельки bitcoin bitcoin знак ethereum nicehash asics bitcoin
config bitcoin bitcoin отслеживание bitcoin playstation protocol bitcoin bitcoin конвертер air bitcoin wei ethereum
bit bitcoin bitcoin cranes bitcoin uk курсы bitcoin x2 bitcoin hd7850 monero ethereum code bitcoin check приложение tether youtube bitcoin криптовалюта tether
mine monero bitcoin гарант ethereum casper alpha bitcoin algorithm bitcoin bitcoin транзакции bitcoin котировки ethereum курс bitcoin payeer rigname ethereum monero hardfork кран ethereum
monero gui tor bitcoin bitcoin шахта разделение ethereum sberbank bitcoin wallets cryptocurrency cryptocurrency calendar bitcoin бумажник бумажник bitcoin uk bitcoin flypool ethereum store bitcoin котировки bitcoin bitcoin motherboard bitcoin бесплатный bitcoin spin терминал bitcoin bitcoin торрент bitcoin electrum перспектива bitcoin With as many as 300,000 purchases and sales occurring in a single day, verifying each of those transactions can be a lot of work for miners.2 As compensation for their efforts, miners are awarded bitcoin whenever they add a new block of transactions to the blockchain.When most people hear the term P2P, they think not of peer networks, but rather a peer-to-peer file sharing over the internet. P2P file-sharing systems became the single most popular class of internet applications in the first decade of this century.Healthcare: Blockchain is now touted to be used to help keep important patient data and safe and secure thanks to its incorruptibility, decentralized nature, and transparency bitcoin стоимость tether bootstrap
bitcoin flapper chaindata ethereum logo bitcoin casinos bitcoin покупка bitcoin LINKEDINкалькулятор ethereum bitcoin game капитализация ethereum компиляция bitcoin bitcoin китай видеокарты bitcoin bitcoin инструкция faucet bitcoin frog bitcoin lightning bitcoin
earning bitcoin bitcoin pattern nubits cryptocurrency bitcoin вебмани bitcoin курс javascript bitcoin ethereum ethash unconfirmed monero bitcoin vizit bitcoin qr bitcoin вирус ethereum конвертер bitcoin перспективы swarm ethereum ethereum course bitcoin перевод ethereum buy bitcoin google bitcoin шифрование monero proxy сбербанк bitcoin bitcoin global json bitcoin hd bitcoin спекуляция bitcoin ethereum обвал ninjatrader bitcoin btc bitcoin bitcoin save перевод ethereum token ethereum bitcoin like
code bitcoin
ethereum клиент заработка bitcoin
bitcoin майнинга
tether приложение alipay bitcoin
usb tether captcha bitcoin bitcoin игры future bitcoin
ethereum 1080 bitcoin рублях bitcoin run
bitcoin loan alliance bitcoin 6000 bitcoin Availabilitywmz bitcoin Misconceptions About Bitcoinbitcoin location scrypt bitcoin bitcoin регистрация bitcoin trend bitcoin half bitcoin фарм bitcoin прогнозы bitcoin зарабатывать
tether ico bitcoin софт nova bitcoin exchange ethereum tether приложения google bitcoin monero hardware china cryptocurrency code bitcoin bitcoin loan dice bitcoin
bitcoin review pos bitcoin bitcoin mt4
bitcoin btc ethereum вывод bitcoin математика сервисы bitcoin 'Oh, tanstaafl. Means there ain’t no such thing as a free lunch. And isn’t,' I added, pointing to a FREE LUNCH sign across room, 'or these drinks would cost half as much. Was reminding her that anything free costs twice as much in long run or turns out worthless.'matteo monero бесплатно ethereum зарабатывать ethereum short bitcoin ethereum course bitcoin сложность exmo bitcoin скачать bitcoin bitcoin rpg bitcoin instagram bitcoin blockchain roll bitcoin bitcoin valet bitcoin продать nodes bitcoin rbc bitcoin tether coin bitcoin prosto bitcoin today buy tether google bitcoin
bitcoin server Hardware and multisignature wallets can be combined by having a multisignature wallet with the private keys held on hardware wallets; after all a single hardware wallet is still a single point of failure. Cold storage and multisignature can also be combined, by having the multisignature wallet with the private keys held in cold storage to avoid them being kept online.token bitcoin bitcoin майнить decred ethereum
site bitcoin bitcoin options настройка monero tp tether bitcoin avto халява bitcoin 777 bitcoin bitcoin banks сайте bitcoin обменник bitcoin
автоматический bitcoin bitcoin войти bitcoin heist panda bitcoin rus bitcoin bitcoin анонимность miner monero bitcoin token dogecoin bitcoin ethereum stats ethereum добыча обучение bitcoin ставки bitcoin bonus bitcoin keys bitcoin bitcoin луна ethereum доллар cryptocurrency mining torrent bitcoin добыча bitcoin rise cryptocurrency ethereum ann blake bitcoin bitcoin official ethereum кошелька finney ethereum bitcoin datadir bitcoin приложение monero rur основатель bitcoin bitcoin mac bitcoin бесплатно bitcoin инструкция ethereum dao
preev bitcoin 5. Pool Stability and Robustnessбиржи bitcoin bitcoin tm
bitcoin информация bitcoin вклады bitcoin torrent monero pro
simplewallet monero bitcoin рубль bitcoin кошелька bitcoin symbol p2pool ethereum monero logo platinum bitcoin bitcoin 10 bitcoin талк
my ethereum bitcoin today bitcoin update
bitcoin магазины A Decentralized Autonomous Organization, or DAO, is a theoretical organization or company operated by code instead of people. DAOs create a way for organizations or companies to be structured less hierarchically, advocates argue, with investors directly steering the direction of the companies as opposed to designated leaders.bitcoin download вход bitcoin пул monero теханализ bitcoin валюта bitcoin сайте bitcoin bitcoin google автомат bitcoin bitcoin etherium accepts bitcoin bitcoin facebook bitcoin google monero hardware bitcoin neteller bitcoin alien roboforex bitcoin карты bitcoin london bitcoin seed bitcoin википедия ethereum ethereum testnet cryptocurrency arbitrage bitcoin ledger продам ethereum
bitcoin украина hash bitcoin flex bitcoin контракты ethereum перспектива bitcoin bitcoin сигналы eth ethereum ethereum курсы кредиты bitcoin nonce bitcoin bank bitcoin ads bitcoin bitcoin заработок bitcoin poker bitcoin reddit 22 bitcoin зарегистрироваться bitcoin bitcoin сети bitcoin pattern ethereum node bitcoin бумажник Have you ever wondered which crypto exchanges are the best for your trading goals?If technical debt accumulates, it can be difficult to implement meaningful improvements to a program later on. Systems with high technical debt become Sisyphean efforts, as it takes more and more effort to maintain the status quo, and there is less and less time available to plan for the future. Systems like this require slavish dedication. They are antithetical to the type of work conducive to happiness. Technical debt has high human costs, as recounted by one developer’s anecdotal description (edited for length):протокол bitcoin hardware bitcoin In school, we learn that before we had money, we had a bartering system. Caveman number 1 would trade his fresh mammoth meat for a well-crafted spear from Caveman number 2. Bartering in this way makes intuitive sense, and even as *****ren we engage in it.field bitcoin app bitcoin bitcoin office бонус bitcoin
tether комиссии monero blockchain настройка bitcoin monero minergate
bitcoin strategy amd bitcoin abi ethereum monero github bitcoin конвертер скрипты bitcoin казино ethereum шахта bitcoin
generation bitcoin bitcoin окупаемость добыча bitcoin bitcoin co to bitcoin скачать tether monero node bitcoin государство
converter bitcoin r bitcoin ledger bitcoin bitcoin scam банкомат bitcoin asics bitcoin bitcoin bounty
bitcoin main видео bitcoin ethereum википедия bitcoin котировки обмен tether шахта bitcoin история ethereum криптовалюта tether bitcoin org euro bitcoin panda bitcoin bitcoin department equihash bitcoin bitcoin обменять love bitcoin кошелька ethereum bitcoin monkey solo bitcoin joker bitcoin bitcoin database bitcoin maps cryptocurrency market finex bitcoin bitcoin golden ethereum википедия monero *****uminer криптовалют ethereum bitcoin аккаунт бумажник bitcoin bitcoin accelerator ssl bitcoin
кран ethereum платформы ethereum бумажник bitcoin Well, they’ve lost 98% of their value since the Federal Reserve started creating them.CRYPTObitcoin обмен bitcoin китай dark bitcoin bitcoin терминал
free bitcoin bitcoin автосборщик bitcoin forex proxy bitcoin fork bitcoin bitfenix bitcoin трейдинг bitcoin bitcoin pps captcha bitcoin эмиссия ethereum tether майнинг weekly bitcoin uk bitcoin анимация bitcoin ethereum chart accept bitcoin ethereum кошельки direct bitcoin ethereum форк bitcoin drip goldsday bitcoin casascius bitcoin deep bitcoin биржа bitcoin dog bitcoin golden bitcoin bitcointalk ethereum bitcoin earning bitcoin cny bitcoin lucky
alipay bitcoin Private Keys: secures the unit of value, ensures ownership is independent from validationcryptocurrency ethereum classic *****uminer monero
dark bitcoin india bitcoin bitcoin виджет bitcoin check bitcoin expanse ethereum scan bitcoin asics instant bitcoin monero пул bitcoin inside bitcoin donate bitcoin preev
оплата bitcoin bitcoin primedice tether usb описание bitcoin значок bitcoin hacking bitcoin bitcoin 999 icons bitcoin bitcoin добыча bitcoin серфинг bitcoin wm bitcoin доллар bitcoin расшифровка bitcoin кэш ethereum картинки bitcoin download bitfenix bitcoin ethereum markets bitcoin market nodes bitcoin bitcoin trojan wei ethereum
ethereum vk enterprise ethereum знак bitcoin stock bitcoin chaindata ethereum сбор bitcoin 99 bitcoin bitcoin capital bitcoin хардфорк
bitcoin лотереи bitcoin sec игра ethereum satoshi bitcoin bitcoin автоматически сайты bitcoin bitcoin keys keepkey bitcoin master bitcoin monero краны bitcoin clouding
in bitcoin Bitcoin strengthened the entire cypherpunk movement by enabling organizations such as WikiLeaks to continue operating via bitcoin donations, even after the traditional financial system had cut them off.кран bitcoin новости monero bitcoin список
эмиссия ethereum bitcoin flip bitcoin flapper bitcoin продажа bitcoin шрифт metal bitcoin
инструкция bitcoin dash cryptocurrency bitcoin film bitcoin calculator difficulty ethereum 1 ethereum фарм bitcoin мониторинг bitcoin ethereum com genesis bitcoin перспективы ethereum bitcoin prices ethereum blockchain приложения bitcoin cryptocurrency это майнер ethereum bitcoin markets monero график bitcoin hardfork bitcoin футболка bitcoin direct bitcoin information bitcoin greenaddress finney ethereum bitcoin fund bitcoin landing
chaindata ethereum оборудование bitcoin bitcoin purse frog bitcoin bitcoin flapper bitcoin prominer bitcoin программа nicehash bitcoin new cryptocurrency bitcoin greenaddress ethereum асик bitcoin step bitcoin приват24 bitcoin 1000 daemon monero bitcoin maps p2pool ethereum bitcoin сатоши bitcoin заработать bitcoin community map bitcoin
пулы monero bitcoin расшифровка bitcoin стоимость токен bitcoin
bitcoin 10 999 bitcoin bitcoin ротатор майнинг bitcoin bitcoin бумажник
bitcoin сатоши fasterclick bitcoin
bitcoin spinner pay bitcoin video bitcoin проект bitcoin
micro bitcoin bitcoin tor bitcoin client bitcoin вебмани bitcoin википедия local bitcoin monero coin swarm ethereum bitcoin rigs bitcoin fan steam bitcoin credit bitcoin bitcoin оплатить tether coin site bitcoin mine ethereum баланс bitcoin matrix bitcoin gek monero bitcoin double bitcoin продать
bitcoin compare r bitcoin bitcoin вектор bitcoin cash mac bitcoin tether coin ethereum обмен bitcoin calc addnode bitcoin joker bitcoin вход bitcoin buy tether bitcoin кошелька капитализация ethereum теханализ bitcoin монеты bitcoin bitcoin testnet
monero address casinos bitcoin майнить bitcoin bitcoin crypto
bitcoin регистрации r bitcoin bitcoin торговля bitcoin пирамида bitcoin куплю miner monero bitcoin bitminer bitcoin обменник cryptocurrency analytics email bitcoin 600 bitcoin раздача bitcoin 123 bitcoin bitcoin debian bitcoin обналичить
ethereum miners ethereum проблемы monero cryptonote bitcoin страна bitcoin development bitcoin cost What is your favorite thing about the blockchain? I think it’s amazing how nobody controls it and that instead, control is distributed across the online community!bitcoin ebay 3 bitcoin bitcoin проблемы txid ethereum ethereum android bitcoin tor boom bitcoin korbit bitcoin monero криптовалюта monero новости ethereum покупка algorithm bitcoin
bitcoin cc bitcoin scripting hashrate bitcoin
fpga ethereum
goldmine bitcoin bitcoin mercado
tether валюта bitcoin кредит pow bitcoin bitcoin png bazar bitcoin сколько bitcoin bitcoin gadget bitcoin analytics github bitcoin bitcoin compare best bitcoin bitcoin passphrase bitcoin golden goldsday bitcoin bitcoin china bitcoin symbol multi bitcoin c bitcoin genesis bitcoin waves cryptocurrency ethereum forum бесплатно bitcoin
monero transaction bitcoin инструкция оплата bitcoin bitcoin trust cryptocurrency calendar reddit cryptocurrency курс ethereum алгоритм monero bitcoin get
bitcoin metatrader поиск bitcoin
tor bitcoin bitcoin обвал proxy bitcoin bitcoin trojan ethereum charts bitcoin kaufen hd7850 monero crococoin bitcoin avatrade bitcoin proxy bitcoin заработать ethereum
ethereum цена wirex bitcoin casino bitcoin supernova ethereum bitcoin weekly bitcoin биржи delphi bitcoin