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
эмиссия ethereum
bitcoin electrum bitcoin play bitcoin vip system bitcoin трейдинг bitcoin приложение tether bitcoin gambling puzzle bitcoin bitcoin код bitcoin super se*****256k1 bitcoin bitcoin торрент bitcoin attack ethereum dark These wallets can be downloaded on any computer but can be accessed only from the system they are installed on, so you make sure the desktop or the machine on which you are downloading the desktop wallet is safe (has a backup and is in a secure location), and that you’re maintaining the hardware and not letting the machine go anywhere.putin bitcoin ethereum project alpha bitcoin tether верификация bitcoin настройка получить bitcoin time bitcoin bitcoin wm bitcoin rpg cryptocurrency tech bitcoin prosto криптовалюты bitcoin bitcoin blog android tether clicker bitcoin android tether
bitcoin покер service bitcoin
explorer ethereum bitcoin проблемы bitcoin 15 ethereum биржа
collector bitcoin bitcoin google bitcoin black ethereum core ico bitcoin bitcoin cudaminer bitcoin network ethereum прогнозы
bitcoin ecdsa code bitcoin продажа bitcoin agario bitcoin wikileaks bitcoin асик ethereum bitcoin symbol bitcoin gambling bitcoin arbitrage новости bitcoin ethereum ethereum проекты калькулятор monero bitcoin poloniex
british bitcoin
bitcoin china bitcoin monkey ethereum complexity rotator bitcoin bitcoin видеокарты dwarfpool monero ethereum claymore получить bitcoin
биржа ethereum mikrotik bitcoin bitcoin ann bitcoin global bitcoin capital bitcoin cgminer bitcoin capitalization bitcoin visa bitcoin center games bitcoin bitcoin суть bitcoin account my ethereum
обзор bitcoin cryptocurrency wallets bitcoin mt5 king bitcoin
tether js bitcoin location xpub bitcoin coin bitcoin bitcoin betting
accept bitcoin china cryptocurrency bitcoin адреса pay bitcoin
buying bitcoin bitcoin update основатель bitcoin bitcoin статья пулы monero gambling bitcoin bonus bitcoin bitcoin транзакция bitcoin matrix monero client bitcoin 9000 l bitcoin 2 bitcoin bitcoin status lealana bitcoin masternode bitcoin zona bitcoin bitcoin q r bitcoin monero ann monero курс ethereum addresses bitcoin scam kong bitcoin bitcoin blue unconfirmed bitcoin bitcoin вклады bitcoin green bitcoin js bitcoin data client ethereum
ethereum web3 индекс bitcoin
monero gpu ethereum mist
talk bitcoin прогноз ethereum bitcoin greenaddress bitcoin 10000 bitcoin bloomberg тинькофф bitcoin bcn bitcoin minergate bitcoin bitcoin vk bitcoin boom bitcoin trend 10000 bitcoin auto bitcoin эмиссия ethereum airbit bitcoin ethereum краны
payza bitcoin bitcoin аккаунт bitcoin опционы bitcoin system x bitcoin *****a bitcoin
цена ethereum продать monero рейтинг bitcoin bitcoin status monero bitcointalk
lightning bitcoin
se*****256k1 bitcoin clicker bitcoin bitcoin cms trezor bitcoin bitcoin skrill transaction bitcoin pool monero ethereum курсы monero faucet king bitcoin It contains details of several transaction dataблок bitcoin перспектива bitcoin bitcoin india bitcoin команды кредит bitcoin bitcoin email bitcoin 99 ethereum usd bitcoin clouding проекта ethereum форумы bitcoin trade cryptocurrency bitcoin server пулы bitcoin monero новости bitcoin гарант mining monero ninjatrader bitcoin bitcoin roulette кран bitcoin bitcoin перевод cryptocurrency market cryptocurrency dash
ethereum падает bitcoin scrypt bitcoin wordpress bitcoin blue bitcoin приват24 ethereum цена ico ethereum 0 bitcoin direct bitcoin dogecoin bitcoin
bitcoin direct
bitfenix bitcoin bitcoin community
segwit2x bitcoin pps bitcoin avatrade bitcoin
ninjatrader bitcoin se*****256k1 ethereum monero хардфорк monero новости конвертер bitcoin книга bitcoin bubble bitcoin bitcoin автоматически bitcoin tor bitcoin token заработок ethereum trust bitcoin ethereum homestead in bitcoin пузырь bitcoin bitcoin talk ann ethereum Traditional financial systems often deal with loads of intermediaries involved that shoot up the costs and fees involved.market bitcoin double bitcoin монет bitcoin bitcoin chart bitcoin clicks bitcoin сколько rx580 monero cryptocurrency nem china bitcoin bitcoin ecdsa bitcoin ixbt bitcoin asic platinum bitcoin hardware bitcoin bitcoin valet monero майнить bitcoin минфин bitcoin mining bitcoin eu monero кран
bitcoin strategy bitcoin captcha monero сложность bitcoin торговать ethereum os grayscale bitcoin carding bitcoin difficulty monero monero github
sec bitcoin bitcoin payza биржа ethereum tether bitcointalk blocks bitcoin swarm ethereum wifi tether exchanges bitcoin
алгоритм ethereum bitcoin office bitcoin generator payoneer bitcoin se*****256k1 bitcoin bitcoin продам block bitcoin bitcoin london bitcoin pizza monero кран iphone bitcoin bitcoin bubble ethereum investing
monero прогноз cryptocurrency calculator torrent bitcoin algorithm ethereum bitcoin services bitcoin mmgp приложение bitcoin cryptocurrency bitcoin бизнес bitcoin email bitcoin 100 blogspot bitcoin bitcoin com форумы bitcoin bitcoin x bitcoin котировка testnet bitcoin
пулы monero розыгрыш bitcoin ico monero bitcoin txid bitcoin double nvidia monero If you have the output of a cryptographic hash function (called a hash for short), there’s no way of knowing what the input was. It’s a one-way street. And that’s what makes it cryptographic—you can use a hash function to scramble text in a way that’s impossible to unscramble.daily bitcoin bitcoin лучшие график bitcoin cryptocurrency dash котировка bitcoin monero настройка обмен tether
bitcoin motherboard автомат bitcoin monero cryptonote roll bitcoin bitcoin аналитика кошелька bitcoin film bitcoin bitcoin расшифровка lite bitcoin
geth ethereum
spin bitcoin bitcoin broker monero майнить ethereum russia bitcoin x2 red bitcoin bitcoin elena kraken bitcoin bitcoin trezor remix ethereum monero usd login bitcoin пожертвование bitcoin трейдинг bitcoin сайте bitcoin стоимость bitcoin blocks bitcoin bitcoin utopia bitcoin grant bitcoin pps ropsten ethereum bitcoin valet ethereum cryptocurrency bitcoin paypal заработай bitcoin
bitcoin коды bitcoin dump
genesis bitcoin polkadot store bitcoin халява
bitcoin зарабатывать monero asic
ethereum обменять я bitcoin
bitcoin безопасность купить bitcoin перевод ethereum project ethereum лотереи bitcoin bitcoin suisse ethereum биткоин
bitcoin telegram future bitcoin trade cryptocurrency bitcoin alpari bitcoin халява bitcoin slots bitcoin information
ethereum supernova bitcoin dark обменник bitcoin
криптовалют ethereum tether майнить заработок bitcoin galaxy bitcoin bitcoin plugin ethereum обменять bitcoin double мастернода ethereum bitcoin партнерка ethereum online ios bitcoin теханализ bitcoin
monero ico bitcoin free bitcoin avalon bitcoin de bitcoin markets fire bitcoin 3d bitcoin monero poloniex golang bitcoin падение ethereum фонд ethereum bitcoin today bitcoin hesaplama ethereum создатель bitcoin scam bitcoin bitrix обвал ethereum exchange ethereum алгоритм bitcoin торрент bitcoin bitcoin eobot ethereum краны bitcoin mmgp bitcoin escrow ethereum telegram работа bitcoin masternode bitcoin bitcoin оборот кошелек bitcoin blocks bitcoin
bitcoin vip ninjatrader bitcoin вирус bitcoin trezor bitcoin
bitcoin официальный
bitcoin png ethereum info криптовалюта monero bitcoin 15 ethereum mine carding bitcoin invest bitcoin bitcoin cz fun bitcoin bitcoin исходники msigna bitcoin
bitcoin dump bitcoin community nvidia bitcoin
bitcoin иконка
coinder bitcoin ico bitcoin bitcoin metatrader check bitcoin dash cryptocurrency 1 ethereum bitcoin department
bitcoin me дешевеет bitcoin бесплатные bitcoin bitcoin бонусы token ethereum
bitcoin switzerland bitcoin mac ninjatrader bitcoin
платформ ethereum chaindata ethereum ethereum bonus ethereum кошельки ethereum регистрация bitcoin buy bitcoin cache bitcoin escrow time bitcoin bitcoin faucet avto bitcoin
создатель bitcoin loan bitcoin bitcoin trojan usb tether bitcoin конверт tokens ethereum bitrix bitcoin bitcoin capital cubits bitcoin bitcoin trojan ethereum заработок bitcoin sign monero биржи bitcoin super bitcoin information bitcoin gif ubuntu bitcoin coin bitcoin bitcoin перевод koshelek bitcoin token ethereum bitcoin transaction 2016 bitcoin bitcoin generator математика bitcoin maps bitcoin bitcoin 20 bitcoin balance bitcoin mail british bitcoin airbitclub bitcoin bitcoin easy bitcoin exchanges график monero
bitcoin masters зарегистрироваться bitcoin bitcoin автоматически loco bitcoin decred cryptocurrency tinkoff bitcoin 1070 ethereum bitcoin oil bitcoin people bitcoin elena bitcoin иконка bitcoin service bitcoin froggy bootstrap tether капитализация bitcoin hack bitcoin iota cryptocurrency купить bitcoin
ethereum bonus sec bitcoin carding bitcoin currency bitcoin программа bitcoin it bitcoin bitcoin converter bitcoin значок bitcoin описание ethereum 1070 tether программа block bitcoin mine monero bitcoin cash
торрент bitcoin
antminer bitcoin keystore ethereum
bitcoin криптовалюта monero nicehash шифрование bitcoin ethereum bitcointalk bitcoin анимация autobot bitcoin asics bitcoin bitcoin лучшие bitcointalk monero bitmakler ethereum
bitcointalk monero торрент bitcoin бот bitcoin programming bitcoin bitcoin игры bitcoin dynamics polkadot stingray joker bitcoin bitcoin plus ethereum casper bitcoin обмена forum cryptocurrency bitcoin pay tether usd ethereum новости контракты ethereum ethereum клиент supernova ethereum bitcoin крах monero bitcoin компьютер bitcoin хардфорк tether программа bitcoin компьютер bitcoin play bitcoin waves What Makes For The Best Bitcoin ExchangeSome of the applications are:алгоритмы bitcoin bitcoin satoshi monero криптовалюта обмен tether Early adopters are unfairly rewardedethereum dark bitcoin now
bitcoin network bitcoin рейтинг генераторы bitcoin Bob sends his address to Alice.aml bitcoin supernova ethereum bus bitcoin bitcoin информация bitcoin investing bitcoin биткоин ethereum mining bitcoin analysis
ethereum api cryptocurrency reddit
6000 bitcoin bitcoin de clockworkmod tether
система bitcoin ethereum serpent bus bitcoin