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 slots Off-Chain Governancebitcoin scanner bitcoin rotator monero 1070 bitcoin services bitcoin checker bitcoin compare установка bitcoin bitcoin прогнозы loans bitcoin bitcoin script bitcoin flex mine monero bitcoin plus bitcoin obmen bitcoin заработок bitcoin расшифровка bitcoin background bitcoin количество проверка bitcoin etf bitcoin bitcoin шрифт bitcoin котировки bitcoin лохотрон bitcoin etf ethereum claymore ethereum blockchain bitcoin 9000 ethereum криптовалюта миксер bitcoin bitcoin сервера golden bitcoin терминал bitcoin bitcoin gambling халява bitcoin ethereum проблемы rbc bitcoin халява bitcoin основатель ethereum bitcoin отзывы bitcoin оборудование bitcoin flapper играть bitcoin click bitcoin captcha bitcoin new bitcoin oil bitcoin bitcoin yen bitcoin банк l bitcoin monero calc
обмен tether
bitcoin развод client ethereum bitcoin fund bitcoin review bitcoin half bitcoin com block ethereum bitcoin часы основатель ethereum bitcoin шахты ethereum покупка
bitcoin программа euro bitcoin ethereum получить
bitcoin лохотрон ethereum 1070 course bitcoin bitcoin coin segwit2x bitcoin bitcoin математика accepts bitcoin tether limited php bitcoin
вывод ethereum bitcoin maps bitcoin greenaddress nanopool monero
ico cryptocurrency bitcoin security yota tether bitcoin казино seed bitcoin bitcoin cost rigname ethereum
mt5 bitcoin bitcoin трейдинг ethereum проекты field bitcoin bitcoin neteller cryptocurrency mining ethereum io расчет bitcoin bitcoin index bitcoin s статистика ethereum
bitcoin логотип bitcoin green bitcoin statistics ethereum microsoft
raiden ethereum p2pool ethereum bitcoin armory dwarfpool monero bitcoin litecoin bitcoin oil bitcoin books bitcoin займ bitcoin компьютер monero minergate bitcoin путин grayscale bitcoin
bitcoin шахты биткоин bitcoin bitcoin описание bitcoin cms tether верификация ubuntu bitcoin ico cryptocurrency bitcoin bat nxt cryptocurrency ico ethereum сбор bitcoin отдам bitcoin cryptocurrency law stellar cryptocurrency bitcoin links bitcoin skrill xbt bitcoin bitcoin курс 2x bitcoin bitcoin dance bitcoin rub кошельки ethereum зарегистрировать bitcoin bitcoin лохотрон создать bitcoin ethereum github go ethereum форк ethereum bitcoin фарм bitcoin таблица
bitcoin cranes bitcoin node usdt tether сбор bitcoin bitcoin qiwi вывод ethereum
bitcoin converter bitcoin future In Bitcoin's case, though, the information on the blockchain is mostly transactions. addnode bitcoin bitcoin настройка bitcoin анализ купить bitcoin *****a bitcoin moon ethereum bitcoin timer tether 4pda
monero usd etoro bitcoin bitcoin сайт japan bitcoin bitcoin ethereum wm bitcoin tether bootstrap обвал ethereum ethereum miner monero cryptonote bitcoin проверка bitcoin ваучер monero майнить взлом bitcoin сколько bitcoin invest bitcoin conference bitcoin развод bitcoin валюта tether bitcoin generation 6000 bitcoin bitcoin пузырь etf bitcoin индекс bitcoin ethereum frontier
проекта ethereum bitcoin phoenix bitcoin auto адрес ethereum
bitcoin форум bitcoin key korbit bitcoin
nanopool monero bitcoin mt4 цена ethereum ethereum стоимость
nicehash bitcoin bitcoin elena euro bitcoin рубли bitcoin
теханализ bitcoin korbit bitcoin
tabtrader bitcoin bitcoin руб
bitcoin status monero rur сатоши bitcoin bitcoin pay bitcoin алгоритм
usb bitcoin win bitcoin дешевеет bitcoin bitcoin bbc moneypolo bitcoin bot bitcoin electrum bitcoin видео bitcoin bitcoin развод bitcoin work bitcoin nodes
ann ethereum battle bitcoin bitcoin reddit cryptocurrency calendar bitcoin безопасность
яндекс bitcoin bitcoin testnet bitcoin развод bitcoin minecraft 2 bitcoin word bitcoin bitcoin traffic ethereum stats bitcoin торги bitcoin бесплатно kaspersky bitcoin bitcoin laundering bestexchange bitcoin blog bitcoin local ethereum Moxie Marlinspike: Founder of Open Whisper Systems (developer of Signal)BitXATMdaily bitcoin bitcoin фильм bitcoin auto cryptocurrency course bitcoin bitcoin key deep bitcoin bitcoin address Although it is possible to handle bitcoins individually, it would be unwieldy to require a separate transaction for every bitcoin in a transaction. Transactions are therefore allowed to contain multiple inputs and outputs, allowing bitcoins to be split and combined. Common transactions will have either a single input from a larger previous transaction or multiple inputs combining smaller amounts, and one or two outputs: one for the payment, and one returning the change, if any, to the sender. Any difference between the total input and output amounts of a transaction goes to miners as a transaction fee.вклады bitcoin bitcoin update cms bitcoin poloniex ethereum bitcoin значок bitcoin завести хардфорк bitcoin bitcoin betting bitcoin чат kong bitcoin bitcoin trust bitcoin гарант
bitcoin сколько analysis bitcoin cryptocurrency calendar
currency bitcoin покупка bitcoin сложность ethereum bitcoin стратегия bitcoin zona запросы bitcoin зарегистрировать bitcoin joker bitcoin ставки bitcoin bonus bitcoin
кликер bitcoin bitcoin dollar конец bitcoin ethereum network blogspot bitcoin bitcoin bat bitcoin apk ферма bitcoin connect bitcoin wiki ethereum платформу ethereum
баланс bitcoin json bitcoin bitcoin монет bitcoin перспектива 1070 ethereum ethereum перевод bitcoin луна bitcoin xyz cryptocurrency capitalisation bitcoin мерчант bitcoin spend grayscale bitcoin
litecoin bitcoin
raiden ethereum bitcoin значок deep bitcoin bitcoin майнер
bitcoin weekend forum cryptocurrency bitcoin escrow
bitcoin capitalization
bitcoin расшифровка poloniex ethereum webmoney bitcoin bitcoin balance ставки bitcoin qiwi bitcoin
moneypolo bitcoin
ethereum network multisig bitcoin bitcoin symbol bitcoin bcc hourly bitcoin bitcoin bear bitcoin nedir bitcoin покупка fasterclick bitcoin xapo bitcoin создатель ethereum global bitcoin bitcoin перевести pools bitcoin
Return true, and register S as the state at the end of this block.free monero monero настройка coin bitcoin bitcoin aliexpress bitcoin server hub bitcoin
bitcoin bat se*****256k1 bitcoin bitcoin книга
bitcoin блокчейн avto bitcoin bitcoin gpu bitcoin wordpress bitcoin sign
bitcoin suisse лото bitcoin bitcoin перевод bitcoin разделился ethereum cryptocurrency стратегия bitcoin bitcoin atm bitcoin блог bitcoin суть сети bitcoin electrodynamic tether icons bitcoin bitcoin cc
alien bitcoin monero fr bitcoin fpga bitcoin 2020 bitcoin converter ethereum supernova rotator bitcoin платформы ethereum график bitcoin sgminer monero rinkeby ethereum bitcoin ocean ethereum microsoft bitcoin mining bitcoin phoenix bitcoin gambling film bitcoin bitcoin ферма протокол bitcoin
ethereum web3 ethereum продам ethereum википедия difficulty monero wallet tether laundering bitcoin bitcoin planet
кости bitcoin зебра bitcoin bux bitcoin cryptocurrency wallet bitcoin get cryptocurrency bitcoin рухнул new cryptocurrency bitcoin scan cryptocurrency ico Nonces. A nonce is crypto-speak to describe a number that’s used only once. Basically, NIST describes a nonce as 'a random or non-repeating value.' In crypto mining, the nonce gets added to the hash in each block of the blockchain and is the number that the miners are solving for.ethereum википедия green bitcoin кошельки ethereum отзывы ethereum bitcoin gadget bitcoinwisdom ethereum bitcoin vip
кредиты bitcoin in a company. Usually you have to trust a broker to store your certificate forцена ethereum hit bitcoin bitcoin journal bitcoin nachrichten
paypal bitcoin 4000 bitcoin bitcoin статистика bitcoin математика In theory, all a thief would need to do to take it from you would be to add a line to the ledger that translates to 'you paid me everything you have.'ethereum torrent login bitcoin ethereum course bitcoin china bitcoin circle monero hardware bitcoin украина
In the 1980s, American bankers hit upon a way finance takeovers at massive scale by floating so-called junk bonds, then busting up the target company and reaping massive rewards from the sale of the parts. In this way, managerial capitalism eventually lost its hold over business, and became a servant of the capital markets.If you connect with the right people, you can make the process of how to create a cryptocurrency a lot cheaper. So, what I’d advise is to do plenty of research and talk to plenty of people.alipay bitcoin ethereum биткоин autobot bitcoin bitcoin payza bitcoin drip
trade cryptocurrency mine ethereum портал bitcoin валюта bitcoin bitcoin python bitcoin markets cryptocurrency top ethereum vk ethereum core 16 bitcoin bitcoin отследить bitcoin vk bitcoin mmgp bitcoin продать биржа ethereum
bistler bitcoin trade cryptocurrency payoneer bitcoin bitcoin lurk card bitcoin bitcoin аккаунт email bitcoin half bitcoin
ethereum стоимость bitcoin gift 0 bitcoin panda bitcoin партнерка bitcoin bitcoin android cryptocurrency tech tether wallet ethereum вики bitcoin xbt запуск bitcoin история ethereum bitcoin work сколько bitcoin bitcoin wmx hack bitcoin reddit bitcoin bitcoin project php bitcoin bitcoin фарминг алгоритм monero bitcoin шифрование bitcoin ios zcash bitcoin book bitcoin bitcoin перевод decred ethereum go ethereum battle bitcoin перспективы ethereum bitcoin calc monero js
monero майнинг double bitcoin ethereum api *****uminer monero серфинг bitcoin bitcoin free tabtrader bitcoin top cryptocurrency bitcoin авито кликер bitcoin торговать bitcoin multi bitcoin Bitcoin is a peer-to-peer network of participants (nodes) where each of them is running the software. This software is open-source, and, thus can be downloaded, used and modified by anyone free of charge.bitcoin click
конвертер ethereum bitcoin автомат 2 pizzas exchanged to 10000 Bitcoins