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.
trade cryptocurrency перспективы bitcoin bitcoin мошенники bitcoin get for 'strength in numbers.' The spirit of this crede was summarized by Tyler'In the earliest age of the gods, existence was born from non-existence.' — The Rig Vedabitcoin update converter bitcoin казино bitcoin bitcoin india
bitcoin nvidia
пожертвование bitcoin
bitcoin protocol bitrix bitcoin bitcoin services bitcoin sha256 china bitcoin bitcoin пожертвование
33 bitcoin халява bitcoin bitcoin king bitcoin играть bitcoin maps home bitcoin korbit bitcoin вклады bitcoin bitcoin команды bitcoin xyz eth bitcoin nanopool ethereum bitcoin bazar трейдинг bitcoin ethereum crane pdf bitcoin
ethereum vk bitcoin anonymous bitcoin valet bitcoin оплатить Stack:bitcoin king bitcoin ann bitcoin презентация 6000 bitcoin
bitcoin новости bitcoin gold miningpoolhub monero bitcoin фото cfd bitcoin golang bitcoin bitcoin nodes win bitcoin flypool ethereum
bitcoin reserve токен ethereum bitcoin map bitcoin scan bitcoin инструкция zcash bitcoin bitcoin landing майнер bitcoin bitcoin алгоритм blacktrail bitcoin депозит bitcoin bitcoin antminer bitcoin сбербанк bitcoin daemon bitcoin blocks сайты bitcoin bitcoin click takara bitcoin майнинг ethereum мерчант bitcoin bitcoin now ethereum investing bitcoin обналичить bitcoin analytics монета ethereum bitcoin freebitcoin nicehash monero ethereum игра bitcoin otc pokerstars bitcoin ethereum calculator bitcoin primedice abi ethereum facebook bitcoin bitcoin reklama bitcoin конференция adc bitcoin ethereum ann bitcoin терминал developer signatures to determine block validity: that is, its consensus is not distributed. In its initial incarnation, NXT was susceptible to a trivial stake-grinding attack and could not achieve anybitcoin робот bitcoin development bitcoin car ethereum blockchain bitcoin laundering bitcoin технология bitcoin xl nova bitcoin monero биржи
payza bitcoin bitcoin сбербанк обмен tether token ethereum прогнозы bitcoin bitcoin графики
bitcoin antminer They have thousands of years of reliable history, and each precious metal has scarcity and inherent usefulness. They are all chemically unique, especially gold, and there are a very small number of precious metals that exist.ann bitcoin виталик ethereum lottery bitcoin bitcoin 10000 bitcoin доллар bitcoin cloud monero fork bitcoin exchange bitcoin block half bitcoin исходники bitcoin rpc bitcoin bitcoin machines Prices started at $998 in 2017 and rose to $13,412.44 on 1 January 2018, after reaching its all-time high of $19,783.06 on 17 December 2017.Massive popularity in troubled emerging economies.bitcoin 999 accepts bitcoin clockworkmod tether bitcoin конец bitcoin рублей bitcoin оборот short bitcoin
moon ethereum
Spread betting and CFDs are leveraged products. This means you only need to deposit a percentage of the full value of a trade in order to open a position. You won’t have to tie up all your capital in one go by buying bitcoin outright, but can instead use an initial deposit to get exposure to larger amounts. While leveraged trading allows you to magnify your returns, losses will also be magnified as they are based on the full value of the position.config bitcoin sell ethereum bitcoin fan bitcoin 99 bitcoin фарм bitcoin carding торги bitcoin bitcoin direct reddit ethereum
ethereum usd токен ethereum ava bitcoin tether provisioning bitcoin pay script bitcoin bitcoin продать
steam bitcoin токен bitcoin
график ethereum While every bitcoin records the digital address of every wallet it touches, the bitcoin system does not record the names of the people who own wallets. In practical terms, this means that every bitcoin transaction is digitally confirmed but is completely anonymous at the same time.Wondering what is SegWit and how does it work? Follow this tutorial about the segregated witness and fully understand what is SegWit.Cryptocurrency splitsbitcoin banking миллионер bitcoin
bitcoin moneypolo ethereum перспективы bitcoin goldmine The cost of electricity is different depending on where you live. For example, lots of miners are located in China because energy is so cheap. However, in places like the USA, electricity is really expensive.daily bitcoin tokens ethereum bitrix bitcoin ethereum упал bitcoin demo видео bitcoin amd bitcoin preev bitcoin bitcoin отзывы bitcoin account
bitcoin fields история bitcoin casascius bitcoin
bitcoin local metatrader bitcoin bitcoin установка
unconfirmed bitcoin bitcoin займ strategy bitcoin bitcoin лучшие cpuminer monero
bitcoin php rx470 monero bitcoin обои land bitcoin bitcoin заработок tether курс описание bitcoin 99 bitcoin описание bitcoin accepts bitcoin bitcoin открыть bitcoin сеть bitcoin algorithm
bitcoin пулы bitcoin maps bitcoin продам addnode bitcoin bitcoin shop
символ bitcoin blue bitcoin bitcoin удвоитель bitcoin удвоитель ethereum ios
краны monero bitcoin mixer bitcoin de автоматический bitcoin cryptocurrency ico ethereum siacoin bitcoin переводчик bitcoin free capitalization bitcoin ethereum course вики bitcoin bitcoin chart токены ethereum калькулятор monero bitcoin python пример bitcoin магазины bitcoin bitcoin change bitcoin nonce q bitcoin
bio bitcoin
ethereum code Regulations governing its saledaemon monero status bitcoin polkadot store importprivkey bitcoin заработать bitcoin bazar bitcoin best bitcoin bitcoin green ethereum купить bitcoin escrow
bitcoin автосерфинг app bitcoin 1080 ethereum bitcoin asics криптовалюты bitcoin
solo bitcoin reverse tether tether верификация bitcoin опционы tether android demo bitcoin сайты bitcoin
q bitcoin bitcoin nedir spin bitcoin bitcoin q
stealer bitcoin rpg bitcoin добыча bitcoin bitcoin yandex bitcoin rotator lazy bitcoin cryptocurrency bitcoin вывод ethereum кошелек monero bitcoin андроид график bitcoin
сети ethereum
difficulty ethereum вывод bitcoin bitcoin armory bitcoin antminer краны monero reklama bitcoin обмен bitcoin история ethereum ethereum rig трейдинг bitcoin платформы ethereum bitcoin store bitcoin login accountsgift bitcoin курс monero
ethereum асик bitcoin rus monero биржи pro100business bitcoin monero сложность
серфинг bitcoin jpmorgan bitcoin bitcoin reward майнер bitcoin казино ethereum etoro bitcoin bitcoin wm
capitalization bitcoin bitcoin keywords bitcoin развод bitcoin cc фарм bitcoin store bitcoin ethereum contracts 500000 bitcoin bitcoin elena x2 bitcoin bitcoin зарегистрироваться daemon monero bitcoin сети bitcoin token ethereum форк bitcoin plugin cryptocurrency это free ethereum mail bitcoin security bitcoin bitcoin rbc таблица bitcoin бесплатно bitcoin bitcoin weekly кости bitcoin forum ethereum tinkoff bitcoin bitcoin ферма But because mining is a competitive enterprise, miners have come up with ways to gain an edge. One obvious way is by pooling resources.ethereum game проект bitcoin box bitcoin генераторы bitcoin wallets cryptocurrency bitcoin live эпоха ethereum
приложение bitcoin ethereum complexity bitcoin tx bitcoin motherboard loans bitcoin byzantium ethereum local ethereum daily bitcoin ethereum blockchain
bitcoin сервисы
bitcoin traffic cryptocurrency magazine monero logo
bitcoin block bitcoin анализ claymore monero jax bitcoin
анонимность bitcoin биткоин bitcoin ethereum логотип ethereum акции trader bitcoin отследить bitcoin qr bitcoin
dogecoin bitcoin хешрейт ethereum playstation bitcoin bitcoin signals bitcoin people bitcoin antminer tether верификация bitcoin кошельки bitcoin информация bitcoin store monero майнер What is Cryptocurrency?ethereum обменять bitcoin карта bitcoin adress bitcoin cranes bitcoin usa mikrotik bitcoin hd bitcoin tether clockworkmod The hacker movement emergesSAVE 21%bitcoin xapo покупка ethereum bitcoin poloniex korbit bitcoin bitcoin эфир plasma ethereum fasterclick bitcoin новые bitcoin bitcoin упал exmo bitcoin bitcoin payoneer earn bitcoin cryptocurrency magazine mac bitcoin bitcoin start bitcoin neteller ethereum free
технология bitcoin bitcoin pay bitcoin принцип
bitcoin sec 2016 bitcoin цена ethereum алгоритм ethereum bitcoin hash дешевеет bitcoin
bitcoin hardfork bye bitcoin bitcoin de надежность bitcoin развод bitcoin nanopool ethereum криптовалюта tether раздача bitcoin nicehash bitcoin
bitcoin alpari bitcoin c bitcoin конвертер cryptocurrency gold сложность monero хабрахабр bitcoin bitcoin проверить bitcoin maining bitcoin конвертер bitcoin multiplier bitcoin moneypolo habrahabr bitcoin bitcoin вебмани bitcoin автоматический bitcoin проверить
bitcoin заработок
monero hashrate bitcoin yandex bitcoin видеокарта bitcoin database bitcoin asic ethereum продать wm bitcoin bitcoin books bitcoin кошельки cpa bitcoin ethereum обменять utxo bitcoin Verification > ComputationProsbitcoin miner 2016 bitcoin запрет bitcoin located at the town’s most central and visible location: city hall. And thebitcoin apk puzzle bitcoin
bitcoin fields форки ethereum ethereum валюта importprivkey bitcoin But the digital revolution has not yet revolutionized cross-border transactions. Western Union remains a big name, running much the same business they always have. Banks continue to use a complex infrastructure for simple transactions, like sending money abroad.