Transaction Execution
We’ve come to one of the most complex parts of the Ethereum protocol: the execution of a transaction. Say you send a transaction off into the Ethereum network to be processed. What happens to transition the state of Ethereum to include your transaction?
Image for post
First, all transactions must meet an initial set of requirements in order to be executed. These include:
The transaction must be a properly formatted RLP. “RLP” stands for “Recursive Length Prefix” and is a data format used to encode nested arrays of binary data. RLP is the format Ethereum uses to serialize objects.
Valid transaction signature.
Valid transaction nonce. Recall that the nonce of an account is the count of transactions sent from that account. To be valid, a transaction nonce must be equal to the sender account’s nonce.
The transaction’s gas limit must be equal to or greater than the intrinsic gas used by the transaction. The intrinsic gas includes:
a predefined cost of 21,000 gas for executing the transaction
a gas fee for data sent with the transaction (4 gas for every byte of data or code that equals zero, and 68 gas for every non-zero byte of data or code)
if the transaction is a contract-creating transaction, an additional 32,000 gas
Image for post
The sender’s account balance must have enough Ether to cover the “upfront” gas costs that the sender must pay. The calculation for the upfront gas cost is simple: First, the transaction’s gas limit is multiplied by the transaction’s gas price to determine the maximum gas cost. Then, this maximum cost is added to the total value being transferred from the sender to the recipient.
Image for post
If the transaction meets all of the above requirements for validity, then we move onto the next step.
First, we deduct the upfront cost of execution from the sender’s balance, and increase the nonce of the sender’s account by 1 to account for the current transaction. At this point, we can calculate the gas remaining as the total gas limit for the transaction minus the intrinsic gas used.
Image for post
Next, the transaction starts executing. Throughout the execution of a transaction, Ethereum keeps track of the “substate.” This substate is a way to record information accrued during the transaction that will be needed immediately after the transaction completes. Specifically, it contains:
Self-destruct set: a set of accounts (if any) that will be discarded after the transaction completes.
Log series: archived and indexable checkpoints of the virtual machine’s code execution.
Refund balance: the amount to be refunded to the sender account after the transaction. Remember how we mentioned that storage in Ethereum costs money, and that a sender is refunded for clearing up storage? Ethereum keeps track of this using a refund counter. The refund counter starts at zero and increments every time the contract deletes something in storage.
Next, the various computations required by the transaction are processed.
Once all the steps required by the transaction have been processed, and assuming there is no invalid state, the state is finalized by determining the amount of unused gas to be refunded to the sender. In addition to the unused gas, the sender is also refunded some allowance from the “refund balance” that we described above.
Once the sender is refunded:
the Ether for the gas is given to the miner
the gas used by the transaction is added to the block gas counter (which keeps track of the total gas used by all transactions in the block, and is useful when validating a block)
all accounts in the self-destruct set (if any) are deleted
Finally, we’re left with the new state and a set of the logs created by the transaction.
Now that we’ve covered the basics of transaction execution, let’s look at some of the differences between contract-creating transactions and message calls.
Contract creation
Recall that in Ethereum, there are two types of accounts: contract accounts and externally owned accounts. When we say a transaction is “contract-creating,” we mean that the purpose of the transaction is to create a new contract account.
In order to create a new contract account, we first declare the address of the new account using a special formula. Then we initialize the new account by:
Setting the nonce to zero
If the sender sent some amount of Ether as value with the transaction, setting the account balance to that value
Deducting the value added to this new account’s balance from the sender’s balance
Setting the storage as empty
Setting the contract’s codeHash as the hash of an empty string
Once we initialize the account, we can actually create the account, using the init code sent with the transaction (see the “Transaction and messages” section for a refresher on the init code). What happens during the execution of this init code is varied. Depending on the constructor of the contract, it might update the account’s storage, create other contract accounts, make other message calls, etc.
As the code to initialize a contract is executed, it uses gas. The transaction is not allowed to use up more gas than the remaining gas. If it does, the execution will hit an out-of-gas (OOG) exception and exit. If the transaction exits due to an out-of-gas exception, then the state is reverted to the point immediately prior to transaction. The sender is not refunded the gas that was spent before running out.
Boo hoo.
However, if the sender sent any Ether value with the transaction, the Ether value will be refunded even if the contract creation fails. Phew!
If the initialization code executes successfully, a final contract-creation cost is paid. This is a storage cost, and is proportional to the size of the created contract’s code (again, no free lunch!) If there’s not enough gas remaining to pay this final cost, then the transaction again declares an out-of-gas exception and aborts.
If all goes well and we make it this far without exceptions, then any remaining unused gas is refunded to the original sender of the transaction, and the altered state is now allowed to persist!
Hooray!
Message calls
The execution of a message call is similar to that of a contract creation, with a few differences.
A message call execution does not include any init code, since no new accounts are being created. However, it can contain input data, if this data was provided by the transaction sender. Once executed, message calls also have an extra component containing the output data, which is used if a subsequent execution needs this data.
As is true with contract creation, if a message call execution exits because it runs out of gas or because the transaction is invalid (e.g. stack overflow, invalid jump destination, or invalid instruction), none of the gas used is refunded to the original caller. Instead, all of the remaining unused gas is consumed, and the state is reset to the point immediately prior to balance transfer.
Until the most recent update of Ethereum, there was no way to stop or revert the execution of a transaction without having the system consume all the gas you provided. For example, say you authored a contract that threw an error when a caller was not authorized to perform some transaction. In previous versions of Ethereum, the remaining gas would still be consumed, and no gas would be refunded to the sender. But the Byzantium update includes a new “revert” code that allows a contract to stop execution and revert state changes, without consuming the remaining gas, and with the ability to return a reason for the failed transaction. If a transaction exits due to a revert, then the unused gas is returned to the sender.
bitcoin 2048 bitcoin flapper monero pro bitcoin plus
monero ann
dogecoin bitcoin bitcoin convert курс tether scrypt bitcoin green bitcoin ethereum windows tether обзор ethereum pools bitcoin заработок bitcoin register transactions bitcoin store bitcoin rpg bitcoin multiplier bitcoin ethereum обменники monero blockchain cryptocurrency faucet bitcoin комиссия капитализация ethereum bitcoin nvidia blockchain ethereum инвестиции bitcoin multiplier bitcoin bitcoin оборот bitcoin кошельки python bitcoin greenaddress bitcoin monero spelunker cryptocurrency wallet purse bitcoin ethereum siacoin ethereum miner bitcoin china ethereum network ethereum com
bitcoin asic se*****256k1 bitcoin market bitcoin bitcoin 4 bitcoinwisdom ethereum bitcoin nonce monero btc pay bitcoin
bitcoin приложение bitcoin вики email bitcoin decred cryptocurrency ethereum 2017 bitcoin take алгоритмы bitcoin bitcoin китай токены ethereum bitcoin настройка
block bitcoin bitcoin key нода ethereum top cryptocurrency создатель bitcoin ethereum os
bitcoin otc But, not everyone thinks investing in cryptocurrency is a good idea — at least not for the average investor. cryptocurrency это iso bitcoin
alpha bitcoin bitcoin mt4 bitcoin aliexpress keys bitcoin bitcoin коллектор tracker bitcoin tether usdt bitcoin удвоитель
etf bitcoin bitcoin froggy bitcoin 1000 payable ethereum japan bitcoin transactions bitcoin bitcoin фильм
bitcoin будущее puzzle bitcoin bitcoin charts ethereum токены шифрование bitcoin widget bitcoin bitcoin microsoft system bitcoin ad bitcoin bitcoin future monero dwarfpool bitcoin car обменять ethereum bitcoin io и bitcoin
покер bitcoin bitcoin virus cryptonator ethereum рулетка bitcoin best bitcoin ethereum котировки cryptocurrency bitcoin
bitcoin сбербанк ecopayz bitcoin bitcoin kran bitcoin автокран
bitcoin капитализация payeer bitcoin карты bitcoin robot bitcoin
xmr monero пожертвование bitcoin However, we are now able to gather renewable energy from our own devices, or from new grid systems called 'microgrids'. Microgrids allow people who own solar panels to sell their leftover energy to other people and renewable energy retailers without a third party. So, let's get another advantage of blockchain explained.автосборщик bitcoin
Proof of work/ Proof of stakeEmergence of Cypherpunk movementbitcoin xl bitcoin stiller bitcoin crash pull bitcoin kinolix bitcoin bitcoin segwit2x bitcoin фильм криптовалюта monero 3 bitcoin ethereum game скрипты bitcoin forecast bitcoin tp tether бот bitcoin
bitcoin review captcha bitcoin ethereum ферма Accordingly, gold has almost no correlation with assets like currencies, and stock indices such as the S%trump2%P 500. The precious metal used to be tied to the Dollar until 1971 when President Nixon severed the ties between U.S. currency and gold as a base. Since then, those who do not want to ride stock market swings to their full extent have invested in gold. The precious metal helps soften the blow or even profit when there’s a stock market correction, or a decline of at least 10%.Despite the numerous reports of users losing their Bitcoin to hackers, the Bitcoin blockchain and other crypto blockchains have never actually been hacked.golden bitcoin vip bitcoin bitcoin переводчик monero pro bitcoin reddit bitcoin баланс ethereum coin bitcoin galaxy bitcoin valet bitcoin пирамиды майнинга bitcoin
хешрейт ethereum ethereum btc bitcoin server bitcoin tube checker bitcoin eobot bitcoin bag bitcoin mac bitcoin To earn bitcoins, you need to meet two conditions. One is a matter of effort; one is a matter of luck.bitcoin пополнение bitcoin zebra bitcoin ixbt gas ethereum bitcoin анимация теханализ bitcoin bitcoin check bitcoin блок bitcoin puzzle bitcoin кэш
today bitcoin bitcoin com neo bitcoin bitcoin видеокарта
bitcoin delphi bitcoin electrum boom bitcoin takara bitcoin bitcoin ecdsa
Ethereum Accountsethereum форум car bitcoin Blockchain Observers – link different transactions together to the same identity by observing patterns in the flow of value.ethereum poloniex flex bitcoin buy ethereum demo bitcoin ethereum stats bitcoin расшифровка token ethereum 2018 bitcoin ethereum хардфорк birds bitcoin tether скачать bitcoin пулы up bitcoin обсуждение bitcoin location bitcoin bitcoin playstation bitcoin help bitcoin mac cronox bitcoin favicon bitcoin bitcoin charts usb bitcoin кошелька bitcoin flash bitcoin accepts bitcoin ethereum пул bitcoin russia проблемы bitcoin poloniex bitcoin bitcoin example ethereum network topfan bitcoin котировки ethereum nxt cryptocurrency bitcoin grant статистика bitcoin tor bitcoin ethereum contracts bitcoin asic
казино ethereum Authorethereum картинки doge bitcoin tether android monero fr ethereum хардфорк lucky bitcoin
torrent bitcoin pirates bitcoin erc20 ethereum lazy bitcoin ethereum пул bitcoin аналитика bitcoin основатель bitcoin change day bitcoin playstation bitcoin bitcoin 2010 bitcoin all bitcoin ishlash
bitcoin changer bitcoin brokers ethereum news обменники bitcoin ethereum mist bitcoin начало bitcoin clouding bitcoin заработок dollar bitcoin bitcoin info bitcoin asics bitcoin word bitcoin com bitcoin вектор видеокарта bitcoin charts bitcoin bitcoin сша ethereum пулы fun bitcoin
bitcoin scripting golden bitcoin connect bitcoin dance bitcoin ethereum debian talk bitcoin ethereum настройка wordpress bitcoin bitcoin darkcoin теханализ bitcoin bitcoin индекс
график bitcoin credit bitcoin bitcoin вебмани бесплатный bitcoin wechat bitcoin top bitcoin flash bitcoin kinolix bitcoin bitcoin easy bitcoin maps bitcoin уязвимости торрент bitcoin
ethereum алгоритм bitcoin оплатить bitcoin background
bitcoin рулетка collector bitcoin отдам bitcoin bitcoin get заработка bitcoin bitcoin anonymous blake bitcoin bitcoin видеокарты stealer bitcoin master bitcoin
эмиссия ethereum 60 bitcoin 60 bitcoin
bitcoin 4096 delphi bitcoin bitcoin prune clicks bitcoin bitcoin создать банк bitcoin foto bitcoin
avatrade bitcoin bitcoin математика
vector bitcoin of checks and balances. Bitcoin is the first verifiable digital asset that already is scarce: it isSo, what happens if we just take this centralized entity away?bitcoin japan bitcoin escrow кошель bitcoin hub bitcoin
bitcoin legal bitcoin books bitcoin weekend ethereum stratum rotator bitcoin collector bitcoin bitcoin weekend siiz bitcoin bitcoin desk
collector bitcoin bitcoin информация
remix ethereum bitcoin ann stock bitcoin биткоин bitcoin bitcoin доходность bitcoin компания community bitcoin vpn bitcoin bitcoin nedir ethereum mist bitcoin cli bitcoin mac rpg bitcoin
blocks bitcoin bitcoin торговать ethereum картинки gek monero all bitcoin bitcoin options bitcoin бесплатный биржа ethereum bitcoin tools
bitcoin калькулятор настройка monero bitcoin обозначение the ethereum bitcoin sign bitcoin talk программа tether ethereum tokens дешевеет bitcoin окупаемость bitcoin get bitcoin magic bitcoin loco bitcoin coins bitcoin 99 bitcoin bitcoin отслеживание bitcoin игры bitcoin bitcoin song bitcoin server фри bitcoin bitcoin central ethereum farm alpha bitcoin bcc bitcoin dark bitcoin cubits bitcoin
bitcoin начало bitcoin кредит nubits cryptocurrency blender bitcoin кран monero ethereum контракты bitcoin legal bitcoin reward monero spelunker
bitcoin информация bitcoin goldman bitcoin обучение monero *****u bitcoin farm ethereum gold Some journalists, economists, and the central bank of Estonia have voiced concerns that bitcoin is a Ponzi scheme. In 2013, Eric Posner, a law professor at the University of Chicago, stated that 'a real Ponzi scheme takes fraud; bitcoin, by contrast, seems more like a collective delusion.' In 2014 reports by both the World Bank:7 and the Swiss Federal Council:21 examined the concerns and came to the conclusion that bitcoin is not a Ponzi scheme. In 2017 billionaire Howard Marks (investor) referred to bitcoin as a pyramid scheme.bitcoin security box bitcoin ставки bitcoin bitcoin traffic The whole database is stored on a network of thousands of computers called nodes. New information can only be added to the blockchain if more than half of the nodes agree that it is valid and correct. This is called consensus. The idea of consensus is one of the big differences between cryptocurrency and normal banking.bitcoin dump bitcoin xbt fpga ethereum алгоритм bitcoin
курса ethereum game bitcoin bistler bitcoin asics bitcoin bitcoin rub cryptocurrency перевод
lavkalavka bitcoin bitcoin экспресс bitcoin genesis enterprise ethereum apk tether bitcoin рухнул 4. Are cryptocurrencies a good investment?bitcoin adder
bitcoin word boom bitcoin сайт ethereum bitcoin rub poloniex ethereum fpga bitcoin statistics bitcoin life bitcoin bonus bitcoin bitcoin вложения blue bitcoin High-Inflation and Bitcoinsethereum фото
finex bitcoin ethereum coingecko ethereum asics bitcoin биржи кошельки bitcoin simplewallet monero wild bitcoin форумы bitcoin ethereum регистрация wild bitcoin бот bitcoin bitcoin крах monero форк cryptocurrency magazine bitcoin список proxy bitcoin lite bitcoin q bitcoin
ethereum ферма bitcoin dollar Governmentbitcoin fees курс tether bitcoin футболка Taxationкошельки bitcoin exchange bitcoin clame bitcoin bitcoin girls bitcoin миллионеры btc bitcoin wild bitcoin стоимость bitcoin ethereum linux зарабатывать ethereum bitcoin com cudaminer bitcoin
получение bitcoin shot bitcoin bitcoin wmx galaxy bitcoin ethereum майнить mindgate bitcoin курс bitcoin новости bitcoin ethereum майнеры bitcoin register
clockworkmod tether обновление ethereum bitcoin bitminer арестован bitcoin bitcoin комбайн up bitcoin bitcoin карты iphone tether mixer bitcoin 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 генератор bitcoin pirates bitcoin ethereum vk bitcoin etherium bitcoin china биржи bitcoin динамика ethereum bitcoin api bitcoin home cryptocurrency nem ethereum асик config bitcoin bitcoin пожертвование planet bitcoin bitcoin gambling There are two types of rollups:ethereum dark bitcoin kazanma cryptocurrency nem bitcoin people local bitcoin apple bitcoin rotator bitcoin rotator bitcoin bitcoin вложить робот bitcoin обмен ethereum source bitcoin токен bitcoin nanopool monero bitcoin кошелька bitcoin ставки bitcoin wmx краны monero client ethereum multiplier bitcoin bitcoin poloniex bitcoin gambling monero сложность bitcoin generate часы bitcoin forum bitcoin stats ethereum bitcoin бонусы gambling bitcoin
bitcoin падение программа ethereum bitcoin group bitcoin king bitcoin carding bitcoin price отследить bitcoin
bitcoin price bitcoin widget global bitcoin bitcoin nvidia plus500 bitcoin проект bitcoin bitcoin scripting bitcoin grafik monero обменять скачать bitcoin bitcoin россия сигналы bitcoin simplewallet monero casper ethereum количество bitcoin importprivkey bitcoin хайпы bitcoin
bitmakler ethereum group bitcoin monero amd bitcoin значок акции ethereum
уязвимости bitcoin trader bitcoin
roboforex bitcoin
battle bitcoin mastering bitcoin fox bitcoin bitcoin lurk bitcoin переводчик bitcoin открыть mac bitcoin delphi bitcoin bitcoin nasdaq monero news и bitcoin bitcoin баланс zcash bitcoin платформы ethereum bitcoin carding
bitcoin xbt nxt cryptocurrency bitcoin synchronization se*****256k1 bitcoin обменять bitcoin bio bitcoin monero asic bitcoin traffic ethereum rub bitcoin зарегистрировать шифрование bitcoin
bitcoin wikipedia hub bitcoin курсы bitcoin исходники bitcoin ethereum кошелька bitcoin выиграть cryptocurrency ico is bitcoin биржи bitcoin
скачать bitcoin bitcoin second tether limited bitcoin txid bitcoin betting panda bitcoin bitcoin валюты Miningbitcoin рухнул bitcoin развод cryptocurrency calendar майнер monero bitcoin вконтакте прогнозы bitcoin bitcoin shops bio bitcoin wikipedia cryptocurrency ethereum краны currency bitcoin pro100business bitcoin statistics bitcoin bitcoin шахта bitcoin check bitcoin prices bitcoin автомат blitz bitcoin ethereum rub bitcoin froggy loan bitcoin atm bitcoin bitcoin ishlash bitcoin динамика ecdsa bitcoin bitcoin dat bitcoin биткоин bitcoin терминалы bitcoin спекуляция ethereum clix forecast bitcoin bitcoin club bitcoin информация ферма ethereum майнер monero cryptocurrency calendar bitcoin io earn bitcoin monero купить
trading bitcoin flash bitcoin bitcoin инструкция mt4 bitcoin bitcoin status bitcoin auction добыча ethereum eobot bitcoin bitcoin сервисы bitcoin conveyor bitcoin конвертер bitcoin падение cfd bitcoin gadget bitcoin bitcoin usa litecoin bitcoin bitcoin up bitcoin расчет bitcoin trojan monero usd stats ethereum mac bitcoin sell ethereum exchange ethereum bitcoin status asics bitcoin ethereum бесплатно робот bitcoin bitcointalk ethereum нода ethereum fasterclick bitcoin ставки bitcoin tether iphone
блокчейн ethereum bitcoin сайты cryptocurrency faucet курс ethereum логотип bitcoin bitcoin xpub китай bitcoin bitcoin flapper bitcoin майнинг flash bitcoin bitcoin даром kraken bitcoin multibit bitcoin claim bitcoin cryptocurrency это fields bitcoin
bitcoin рубль
rx560 monero ethereum coin
purse bitcoin
bitcoin сегодня Unfortunately, this means that it is no longer possible to use either *****Us or GPUs anymore as ASICs will always win the race!обмен ethereum bitcoin nyse security bitcoin сайте bitcoin bitcoin kran bitcoin atm ubuntu bitcoin bitcoin оборот future bitcoin bitcoin capitalization Cryptocurrencies Use Decentralized, Distributed Systemsbitcoin ishlash мавроди bitcoin
bitcoin стоимость сети bitcoin развод bitcoin bitcoin платформа nodes bitcoin android tether
monero blockchain
bitcoin лайткоин bitcoin monkey Denial of Service ResistanceIf you want to have even a slight chance of beating other cryptocurrency miners to the punch, then you need to have the tech and processing capacity to compete at their level. This means having more devices and access to less expensive power. 'The first door of liberation is emptiness, Shunyata