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.
enterprise ethereum bitcoin fake Institutional economists drew a distinction between the management class and the class of 'technical operators' (the people doing the work, in many cases engineers and technicians). The managerial elite consisted of the 'analysts' or 'specialists' who acted as the bureaucratic planners, budgetary allocators, and non-technical managers.bitcoin demo ethereum game the ethereum bitcoin монеты bitcoin background bitcoin minecraft
логотип bitcoin
server bitcoin bitcoin background особенности ethereum cryptocurrency nem bitcoin hardfork boxbit bitcoin bitcoin monkey bitcoin адрес bitcoin capitalization wikileaks bitcoin китай bitcoin транзакции ethereum logo ethereum bitcoin компьютер ethereum clix bitcoin fox registration bitcoin обучение bitcoin продать monero bitcoin графики пулы bitcoin bitcoin открыть monero майнить bitcoin pizza 2 bitcoin ставки bitcoin bitcoin avalon ethereum addresses bitcoin ммвб ethereum info forum bitcoin ethereum transaction captcha bitcoin bcc bitcoin bitcoin форк ethereum blockchain bitcoin биржи moto bitcoin bitcoin hype
кости bitcoin bitcoin yen bitcoin форк bitcoin center dance bitcoin
bitcoin evolution bitcoin cap monero сложность information bitcoin ethereum parity
bcc bitcoin bitcoin map bitcoin scripting 1 bitcoin расчет bitcoin forbot bitcoin bitcoin legal by bitcoin график bitcoin lealana bitcoin credit bitcoin bitcoin россия казино bitcoin bitcoin youtube динамика ethereum ethereum перспективы bitcoin cny tether wallet
терминалы bitcoin bitcoin accepted
bitcoin eth
locate bitcoin bitcoin clicker скрипт bitcoin bitcoin novosti time bitcoin ethereum charts
ethereum russia neo cryptocurrency jax bitcoin bitcoin pay 16 bitcoin автомат bitcoin bitcoin прогноз bitcoin datadir swarm ethereum ethereum проблемы bitcoin dat конференция bitcoin bitcoin платформы ethereum claim bitcoin trader bitcoin майнинга bitcoin bitcoin bloomberg bitcoin статистика робот bitcoin зарегистрировать bitcoin ecdsa bitcoin addnode bitcoin se*****256k1 bitcoin приложение bitcoin
gemini bitcoin bitcoin get bitcoin statistic сложность monero bitcoin example ethereum frontier
ethereum online ethereum пулы ethereum купить футболка bitcoin
pool bitcoin
удвоитель bitcoin bitcoin коллектор ethereum chart global bitcoin bitcoin fan bitcoin настройка сигналы bitcoin bitcoin ads bitcoin habr bitcoin nonce ethereum siacoin bonus bitcoin arbitrage bitcoin инструкция bitcoin cryptocurrency market bitcoin change bitcoin gif
bitcoin информация bitcoin maps multibit bitcoin майнер bitcoin bitcoin экспресс
bitcoin nyse bitcoin database MyceliumWhat’s more, it manages to achieve this incredible hash rate whilst remaining efficient when it comes to energy consumption. The unit consumes just 0.075J/GH. That’s around 1480W of power draw. This crushes Bitmain’s flagship model, the Antminer S9, which has a power consumption rating of 0.098J/GH. ethereum регистрация добыча bitcoin bitcoin 4000 bitcoin testnet настройка monero dash cryptocurrency dark bitcoin
ethereum stratum bitcoin bcc bitcoin download bitcoin redex bitcoin foundation bitcoin transaction bitcoin machines bitcoin pattern today bitcoin bitcoin converter bitcoin часы
рубли bitcoin ethereum transactions tether приложения bitcoin лохотрон
credit bitcoin monero wallet майнинга bitcoin bitcoin database bitcoin bitcoin автоматически addnode bitcoin ethereum course bitcoin торговля форум bitcoin сколько bitcoin bitcoin список bitcoin generator
buying bitcoin
bitcoin fx карты bitcoin
lazy bitcoin bitcoin matrix фото bitcoin
ethereum 2017
10000 bitcoin bitcoin таблица
ethereum сбербанк advcash bitcoin bitcoin wallpaper bitcoin прогнозы ethereum видеокарты ethereum алгоритмы bitcoin программа ethereum pos plus500 bitcoin microsoft bitcoin
monero usd bitcoin минфин инструкция bitcoin перспектива bitcoin bitcoin биржи ethereum contract monero сложность people bitcoin bitcoin 10 биржи ethereum
bitcoin word In this section, we have elucidated how computers on the Bitcoin network achieves decentralized and distributed consensus at a global scale. We’ve examined why Proof-of-Work is a critical enabler of machine consensus, and how Proof-of-Stake, while flawed, may be used in addition to Proof-of-Work to make human consensus (ie., project governance) more transparent and inclusive. In the next section, we will discuss the value of public cryptocurrency systems when stakeholders are held in a stable balance of power.How Value Accrues In Proof-of-Work Networksпокер bitcoin tether верификация
bitcoin debian up bitcoin coindesk bitcoin настройка monero kaspersky bitcoin bitcoin nvidia mine monero opencart bitcoin bitcoin прогноз start bitcoin зарабатывать bitcoin ethereum видеокарты bitcoin компьютер
ethereum ферма datadir bitcoin wirex bitcoin bitcoin обозреватель wechat bitcoin ethereum dag bitcoin config polkadot stingray A stock image representing various types of cryptocurrenciesbitcoin сети bitcoin миллионеры программа ethereum карты bitcoin bitcoin hyip iphone bitcoin bitcoin рост bitcoin fan продать ethereum tera bitcoin bitcoin сервисы bitcoin проверка client ethereum ethereum эфир код bitcoin bitcoin betting bitcoin ishlash ethereum пулы monero новости верификация tether ethereum пул boxbit bitcoin nicehash bitcoin ethereum coin
трейдинг bitcoin фарминг bitcoin bitcoin coingecko bitcoin valet alpha bitcoin bitcoin grant locals bitcoin
bitcoin world frontier ethereum faucet bitcoin scrypt bitcoin 3 bitcoin bitcoin formula bitcoin evolution пополнить bitcoin
api bitcoin ethereum casper free ethereum ultimate bitcoin ethereum проекты bank bitcoin bitcoin лайткоин рост bitcoin sha256 bitcoin таблица bitcoin
взломать bitcoin hourly bitcoin coins bitcoin ethereum forks connect bitcoin r bitcoin bitcoin nachrichten
bitcoin delphi бесплатно bitcoin bitcoin symbol ethereum эфир расшифровка bitcoin reddit ethereum buy ethereum bitcoin монеты get bitcoin collector bitcoin a large number of leaf nodes at the bottom of the tree that contain the underlying datasuper bitcoin The legality of Bitcoin mining depends entirely on your geographic location. The concept of Bitcoin can threaten the dominance of fiat currencies and government control over the financial markets. For this reason, Bitcoin is completely illegal in certain places.bitcoin greenaddress
bitcoin protocol bitcoin paypal ethereum проблемы mining bitcoin bitcoin legal time bitcoin express bitcoin bitcoin generate бесплатный bitcoin bitcoin miner tether верификация half bitcoin free monero проверка bitcoin rx580 monero транзакции ethereum bitcoin cc wisdom bitcoin халява bitcoin bitcoin vk контракты ethereum bitcoin миллионеры bitcoin x2 bitcoin client bitcoin freebitcoin 1080 ethereum бесплатные bitcoin ethereum токен
bitcoin video ethereum эфир ethereum картинки magic bitcoin mindgate bitcoin 3 bitcoin tether майнинг
bitcoin tm bitcoin отследить миксер bitcoin bitcoin лохотрон bitcoin millionaire ethereum dao bitcoin pool bitcoin компания
The network is secured by specialized computer units called miners that are distributed across a large number of unique entities. When you submit a transaction to the Bitcoin blockchain, these miners need to check that you have the necessary Bitcoin to send it, and that various other rules are followed.dat bitcoin bitcoin вконтакте bitcoin ira korbit bitcoin ethereum usd tether clockworkmod сколько bitcoin продажа bitcoin bitcoin взлом ethereum telegram Too much debt → Create more money → More debt → Too much debtBob alone can withdraw a maximum of 1% of the funds per day, but Alice has the ability to make a transaction with her key shutting off this ability.blake bitcoin bitcoin инвестирование easy bitcoin bitcoin darkcoin lamborghini bitcoin bitcoin step капитализация bitcoin ethereum stratum bitcoin продам exmo bitcoin bitcoin code bitcoin london bitcoin видеокарты анонимность bitcoin bitcoin machines bitcoin pay difficulty bitcoin email bitcoin
bitcoin продать добыча bitcoin bitcoin work lootool bitcoin bitcoin markets bcc bitcoin
trade bitcoin market bitcoin sberbank bitcoin bitcoin de
poloniex ethereum bitcoin автоматически символ bitcoin bitcoin red tether приложения bitcoin purse bitcoin котировка top cryptocurrency bitcoin playstation bitcoin ставки
bitcoin car
monero прогноз stake bitcoin bitcoin отзывы wikileaks bitcoin
bitcoin frog 777 bitcoin 2018 bitcoin dao ethereum bitcoin com перевод bitcoin bitcoin сети bitcoin master metal bitcoin bitcoin опционы bitcoin maps bitcoin машина стоимость monero moneypolo bitcoin mail bitcoin tether android ann ethereum взлом bitcoin ethereum erc20
система bitcoin bitcoin доллар youtube bitcoin bitcoin путин bitcoin gold bitcoin main maining bitcoin
fee bitcoin ethereum cryptocurrency bitcoin hesaplama 100 bitcoin сложность bitcoin reddit bitcoin
bitcoin accelerator buying bitcoin майн ethereum
bitcoin презентация пул ethereum Categorizing coins for investmenttether gps алгоритмы ethereum пулы bitcoin ethereum обменять bitcoin nedir
bitcoin knots boom bitcoin dog bitcoin nodes bitcoin ethereum news биржа ethereum bitcoin change wikileaks bitcoin bitcoin yen
bitcoin payza bitcoin презентация bitcoin click аккаунт bitcoin tether майнить
segwit2x bitcoin bitcoin world I’m not trying to criticize or praise Peter Schiff here; just highlighting a recent sentiment sampling.2016 bitcoin
bitcoin анализ decred ethereum bitcoin fees пулы monero cubits bitcoin The cryptocurrency itself is not in the wallet. In the case of bitcoin and cryptocurrencies derived from it, the cryptocurrency is decentrally stored and maintained in a publicly available distributed ledger called the blockchain.Wondering what is SegWit and how does it work? Follow this tutorial about the segregated witness and fully understand what is SegWit.due to an attack or performance issues. x bitcoin bitcoin инструкция купить bitcoin ethereum фото ethereum zcash сети bitcoin bitcoin plugin cryptonator ethereum casper ethereum
finney ethereum bitcoin вики bitcoin стоимость
ethereum обмен
bitcoin book биржа bitcoin bitcoin bcc total cryptocurrency зарабатывать bitcoin bitcoin партнерка ethereum доходность
testnet bitcoin future bitcoin ethereum swarm
компиляция bitcoin bitcoin billionaire bistler bitcoin заработка bitcoin комиссия bitcoin ethereum txid bitcoin mining tether верификация bitcoin traffic windows bitcoin bitcoin отследить
bitcoin income конвертер bitcoin ethereum myetherwallet прогнозы bitcoin machine bitcoin bitcoin майнер se*****256k1 bitcoin bitcoin farm bounty bitcoin bitcoin обои bitcoin сбербанк bitcoin microsoft coin bitcoin кран bitcoin xpub bitcoin coin ethereum icons bitcoin bitcoin таблица ethereum рост monero dwarfpool bitcoin space tether купить
2 bitcoin coinmarketcap bitcoin 60 bitcoin бесплатный bitcoin
reddit ethereum платформ ethereum bitcoin вирус проблемы bitcoin accepts bitcoin майн ethereum сложность monero
bitcoin иконка bitcoin strategy bitcoin telegram
weekly bitcoin сервер bitcoin порт bitcoin bitcoin statistic monero ico bitcoin вконтакте autobot bitcoin bitcoin вирус forum ethereum bitcoin s twitter bitcoin ethereum биржа bitcoin история bitcoin регистрация bitcoin income bitcoin 2017 блокчейн bitcoin roboforex bitcoin рейтинг bitcoin ethereum news bitcoin neteller
ethereum история bitcoin 5 bitcoin local british bitcoin bitcoin pdf
bitcoin 5 bitcoin компания
bitcoin форк bitcoin exchange
bitcoin darkcoin
bitcoin рубль bitcoin шахты tether android скрипты bitcoin bitcoin код сайте bitcoin ethereum кошельки bitcoin make bitcoin луна ethereum difficulty bitcoin обои