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.
ethereum бесплатно monero difficulty ethereum википедия
weekend bitcoin
майнер ethereum green bitcoin bitcoin up
bitcoin презентация ethereum coingecko bitcoin заработок nicehash monero bitcoin legal проекта ethereum view bitcoin bitcoin фильм bitcoin зарегистрироваться bitcoin скачать monero proxy How does the network encourage miners to participate in maintaining the blockchain? Again, taking Bitcoin as an example, the network holds a lottery in which all the mining rigs around the world race to become the first to solve a math problem, which also verifies and updates the blockchain with new transactions. Each winner is awarded new bitcoin, which can then make its way into the broader marketplace.bitcoin дешевеет json bitcoin bitcoin транзакция
monero gpu ethereum blockchain сеть ethereum ethereum contracts bitcoin основатель ethereum динамика my ethereum bear bitcoin фермы bitcoin пул monero bitcoin plus 4pda tether up bitcoin tor bitcoin bitcoin boom 1 bitcoin bitcoin принцип For as long as that counter above keeps climbing, your computer will keep running a bitcoin mining script and trying to get a piece of the action. (But don’t worry: It’s designed to shut off after 10 minutes if you are on a phone or a tablet, so your battery doesn’t drain).wei ethereum ethereum проблемы monero hardfork bitcoin client calculator ethereum bitcoin перевести bitcoin habr
ethereum fork
брокеры bitcoin bitcoin loan
bitcoin timer jax bitcoin bitcoin бумажник bitcoin withdrawal ethereum script abi ethereum bitcoin network ethereum кошелька
block bitcoin gadget bitcoin bitcoin бизнес bitcoin перевод bitcoin pay talk bitcoin bitcoin луна monero обменять flex bitcoin бесплатно ethereum обновление ethereum love bitcoin ledger bitcoin txid bitcoin bitcoin lurk bitcoin reddit home bitcoin раздача bitcoin difficulty bitcoin
bitcoin экспресс ethereum кошелька the ethereum ethereum supernova cryptonator ethereum
One important aspect of the way the Ethereum works is that every single operation executed by the network is simultaneously effected by every full node. However, computational steps on the Ethereum Virtual Machine are very expensive. Therefore, Ethereum smart contracts are best used for simple tasks, like running simple business logic or verifying signatures and other cryptographic objects, rather than more complex uses, like file storage, email, or machine learning, which can put a strain on the network. Imposing fees prevents users from overtaxing the network.bitcoin 4000 fast bitcoin bitcoin bot bitcoin center рост bitcoin freeman bitcoin ethereum rotator byzantium ethereum удвоитель bitcoin bitcoin metal free bitcoin сервера bitcoin bitcoin алматы
сбербанк bitcoin bitcoin token bitcoin redex
bitcoin masters bitcoin department Before BlockchainConclusionEmailBitcoin ATMs are machines that will send bitcoin to your wallet in exchange for cash. They operate in a similar way to bank ATMs – you feed in the bills, hold your wallet’s QR code up to a screen, and the corresponding amount of bitcoin is beamed to your account. Coinatmradar can help you to find a bitcoin ATM near you.bitcoin миллионеры rinkeby ethereum
вывод monero bitcoin markets динамика ethereum ethereum crane ethereum монета
обучение bitcoin bitcoin keywords rotator bitcoin live bitcoin 100 bitcoin c bitcoin ethereum asic 1080 ethereum bitcoin прогноз space bitcoin fast bitcoin ethereum сбербанк split bitcoin cryptocurrency tech bitcoin расчет bitcoin vps bitcoin official таблица bitcoin coinbase ethereum ethereum com bitcoin investing maps bitcoin bitcoin приложение bitcoin мониторинг bitcoin paper But as we explore blockchain’s potential, we see even broader horizons.bitcoin antminer 99 bitcoin стоимость bitcoin
новый bitcoin monero price особенности ethereum cryptocurrency capitalisation взлом bitcoin total cryptocurrency boxbit bitcoin connect bitcoin bitcoin de se*****256k1 bitcoin bitcoin goldman monero blockchain block bitcoin bitcoin 2017 bitcointalk ethereum monero free bitcoin оборудование cryptocurrency bitcoin waves bitcoin paidbooks bitcoin bitcoin путин покупка ethereum boom bitcoin bitcoin png bitcoin symbol
bitcoin 123 bitcoin кранов bitcoin oil
bitcoin safe
xapo bitcoin blog bitcoin cryptocurrency dash stock bitcoin explorer ethereum
qtminer ethereum bitcoin black bitcoin biz bitcoin bat
порт bitcoin bitcoin casascius хабрахабр bitcoin криптовалюту monero bitcoin capitalization cryptocurrency calculator bitcoin minecraft халява bitcoin bitcoin 10000 bitrix bitcoin арбитраж bitcoin bitcoin отзывы
bitcoin пополнить monero benchmark bitcoin nonce bitcoin сети
ethereum cryptocurrency ethereum телеграмм cryptocurrency bitcoin фарм bitcoin открыть monero logo
bitcoin лого accept bitcoin
bitcoin картинка принимаем bitcoin ethereum online
bitcoin office bitcoin трейдинг bitcoin forecast chain bitcoin antminer ethereum bitcoin hosting bitcoin ios local bitcoin
bitcoin bonus bitcoin new payoneer bitcoin bitcoin swiss ethereum обвал bitcoin ваучер bitcoin plugin робот bitcoin coins bitcoin blogspot bitcoin monero обмен калькулятор bitcoin vip bitcoin
bitcoin рублей monero github space bitcoin microsoft ethereum monero js bitcoin calculator bitcoin стратегия forum cryptocurrency
bitcoin co
bitcoin fun ethereum bitcointalk bitcoin cracker ethereum blockchain bitcoin котировки биржа bitcoin bitcoin take monero pro iso bitcoin
bitcoin widget bitcoin q
korbit bitcoin antminer bitcoin bitcoin халява криптовалюта tether bitcoin reserve
bitcoin hacker solo bitcoin ico cryptocurrency bitcoin instagram p2pool ethereum bitcoin future
консультации bitcoin
bitcoin майнинга ethereum coins bitcoin x2
компания bitcoin обмен tether
bitcoin 4 The safest way to hold your coins is to use a hardware wallet. This is the cryptocurrency equivalent of a vault!вики bitcoin ethereum homestead the ethereum connect bitcoin lootool bitcoin android ethereum токены ethereum bitcoin example nova bitcoin bitcoin шахты bitcoin twitter the ethereum wallets cryptocurrency bitcoin group 100 bitcoin
сети ethereum перевод ethereum bitcoin galaxy 3d bitcoin ethereum clix http bitcoin wei ethereum jax bitcoin micro bitcoin bitcoin ebay вложения bitcoin bitcoin хардфорк bitcoin casino bitcoin poloniex fee bitcoin sha256 bitcoin cryptocurrency charts bitcoin отзывы dollar bitcoin видео bitcoin bitcoin матрица bitcoin apple lamborghini bitcoin ethereum контракты casino bitcoin транзакции bitcoin bitcoin майнинга bitcoin дешевеет bitcoin capitalization bitcoin кэш advcash bitcoin эфир bitcoin бесплатные bitcoin bitcoin usd bitcoin server адрес bitcoin clicker bitcoin eos cryptocurrency bitcoin monkey location bitcoin ethereum котировки bitcoin конвертер bitcoin koshelek
avatrade bitcoin bitcoin nodes 50 bitcoin Bitcoin changed the way people think about money. Hundreds of other cryptocurrencies have been created since and they all want to change the world!weather bitcoin programming bitcoin tp tether bitcoin central bitcoin mine monero bitcointalk ethereum видеокарты bitcoin lurk blogspot bitcoin bitcoin роботы проект ethereum доходность ethereum 16 bitcoin bitcoin сайт bitcoin market
bitcoin сша monero кошелек
bitcoin 0 bitcoin cli bitcoin гарант token bitcoin ethereum описание луна bitcoin ethereum casper total cryptocurrency
bitcoin rt ethereum fork bitcoin machines bitcoin ann steam bitcoin qiwi bitcoin bitcoin symbol bitcoin pdf bitcoin автоматически bitcoin facebook bitcoin технология qiwi bitcoin bitcoin криптовалюта bitcoin capitalization автомат bitcoin The combination of bitcoin's properties as 'digital gold', its censorship resistance, and flexibility due to its digital nature make it a powerful tool for people to take direct control over their financial lives, and/or take refuge from inflationary central bank monetary policies. This is why some describe bitcoin as 'a peaceful revolution'.Transparencyспекуляция bitcoin ethereum btc etherium bitcoin ethereum myetherwallet community bitcoin bitcoin today best bitcoin bitcoin миллионеры tether android phoenix bitcoin cryptocurrency calculator bitcoin mastercard bitcoin dice tether android bitcoin key ethereum bonus weather bitcoin bitcoin direct bitcoin analytics maining bitcoin bitcoin ваучер se*****256k1 bitcoin bitcoin dogecoin finney ethereum fire bitcoin
token ethereum bitcoin стратегия CRYPTObitcoin стоимость future bitcoin ethereum доллар bitcoin расшифровка blocks bitcoin flappy bitcoin сервисы bitcoin dat bitcoin bitcoin ru bitcoin donate bitcoin metatrader bitcoin fpga биржа monero
bitcoin x2 finney ethereum капитализация bitcoin bitcoin mail cgminer ethereum