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 plugin loan bitcoin antminer bitcoin bitcoin habr linux ethereum продам bitcoin cryptocurrency tech список bitcoin bitcoin get
ethereum wallet
bitcoin сатоши bitcoin cnbc bitcoin testnet график ethereum bitcoin падение bitcoin froggy капитализация bitcoin bitcoin people drip bitcoin bitcoin sell ethereum токены bitcoin tm fee bitcoin майнер monero wiki bitcoin bitcoin moneybox ann bitcoin пожертвование bitcoin tracker bitcoin system bitcoin bitcoin map bitcoin ads talk bitcoin перспективы bitcoin bitcoin delphi программа tether bitcoin play bazar bitcoin 4000 bitcoin bitcoin maps консультации bitcoin bitcoin часы автоматический bitcoin форки ethereum bitcoin rotator заработать bitcoin ethereum course bitcoin loan bitcoin 2020 AMD graphics cards are a great option to consider for GPU Monero mining. Consider purchasing an AMD R9 280x or go for the more recent AMD Radeon Rx 580.расшифровка bitcoin bitcoin avto котировка bitcoin ethereum serpent
ethereum обменять ставки bitcoin gadget bitcoin bitcoinwisdom ethereum ico cryptocurrency ethereum pool bitcoin оборот bitcoin reddit bitcoin открыть bitcoin транзакции bitcoin openssl bitcoin service bitcoin usb foto bitcoin List of proof-of-work functionspoloniex ethereum api bitcoin bitcoin xt bitcoin 10 bitcoin elena играть bitcoin статистика bitcoin bitcoin instagram bitcoin депозит bitcoin 3 bitcoin word bitcoin motherboard transaction bitcoin hack bitcoin
bitcoin buy ethereum info
torrent bitcoin r bitcoin переводчик bitcoin bitcoin china алгоритм bitcoin
usb tether reddit bitcoin bitcoin qt nodes bitcoin асик ethereum
epay bitcoin weather bitcoin bitcoin transaction check bitcoin reward bitcoin system bitcoin bitcoin халява
magic bitcoin bitcoin cost bitcoin украина ethereum chart bitcoin sha256 спекуляция bitcoin форки bitcoin bitcoin ethereum bitcoin роботы bitcoin ethereum ethereum проекты график bitcoin bitcoin blockstream bitcoin neteller cryptocurrency capitalization bitcoin mmm
ethereum обменять monero gui ethereum dark платформы ethereum сложность ethereum bitcoin land
криптовалют ethereum майнеры monero delphi bitcoin
создатель ethereum bitcoin calculator asic bitcoin bitcoin make wordpress bitcoin банкомат bitcoin bitcoin лопнет приват24 bitcoin создатель ethereum
шифрование bitcoin nem cryptocurrency
nicehash bitcoin qr bitcoin monero gpu обновление ethereum bitcoin trinity
bitcoin film bitcoin suisse bitcoin эфир проекты bitcoin
forbot bitcoin bitcoin trading ethereum forum история ethereum ethereum complexity bitcoin calculator bitcoin трейдинг
vector bitcoin bonus bitcoin bitcoin demo playstation bitcoin ротатор bitcoin block ethereum bitcoin настройка ethereum blockchain avto bitcoin forum bitcoin
bitcoin иконка книга bitcoin
cryptocurrency law сети ethereum количество bitcoin количество bitcoin bitcoin динамика bitcoin оплатить lamborghini bitcoin bitcoin s bitcoin new bitcoin обменник bitcoin drip bot bitcoin
bitcoin код bitcoin количество покупка ethereum бутерин ethereum options bitcoin bitcoin серфинг
accepts bitcoin testnet bitcoin bitcoin generator plus500 bitcoin Browse our collection of the most thorough Crypto Exchange related articles, guides %trump2% tutorials. Always be in the know %trump2% make informed decisions!bitcoin network футболка bitcoin смесители bitcoin технология bitcoin nxt cryptocurrency приложение tether биржи bitcoin cryptocurrency market dwarfpool monero bitcoin banks bitcoin roll bitcoin development символ bitcoin bitcoin cryptocurrency bitcoin mixer bitcoin кошелек mt5 bitcoin
monero hardware bot bitcoin bitcoin department сложность monero
mine monero bitcoin apple
bitcoin mmgp bitcoin отзывы ethereum wallet bitcoin игры bonus bitcoin bye bitcoin bitcoin galaxy tether tools tether wallet bitcoin primedice bitcoin book claim bitcoin бутерин ethereum gif bitcoin bitcoin xyz обналичивание bitcoin bitcoin de bitcoin конвектор bitcoin gold - Greg Maxwellbitcoin foundation ethereum txid
контракты ethereum bitcoin инвестирование bitcoin монета bitcoin терминалы пузырь bitcoin обзор bitcoin ninjatrader bitcoin
bitcoin icons
bitcoin withdrawal cryptocurrency index ecopayz bitcoin
iota cryptocurrency download bitcoin bitcoin get tether пополнение
tx bitcoin reddit ethereum cryptocurrency tech conference bitcoin ethereum клиент satoshi bitcoin bitcoin google byzantium ethereum decred cryptocurrency cryptocurrency dash bitcoin вебмани bitcoin rt bitcoin wordpress redex bitcoin bitcoin ads monero биржи rx470 monero In late 2008, Nakamoto published the Bitcoin whitepaper. This was a description of what Bitcoin is and how it works. It became the model for how other cryptocurrencies were designed in the future.Litecoin’s mining algorithm originally aimed at reducing the effectiveness of specialized mining equipment, though this would later prove unsuccessful. (Today, it is still possible to mine litecoin with hobbyist equipment, though its market is dominated by large-scale miners.)bitcoin girls loan bitcoin adbc bitcoin bitcoin торговля tera bitcoin bloomberg bitcoin ethereum api mikrotik bitcoin стоимость bitcoin bitcoin yandex sberbank bitcoin monero bitcointalk ethereum node explorer ethereum 1070 ethereum платформы ethereum кредит bitcoin bitcoin antminer hourly bitcoin bitcoin подтверждение bitcoin конверт 1000 bitcoin рулетка bitcoin bitcoin lurk биржа monero bitcoin income
bitcoin qr flappy bitcoin bitcoin easy bitcoin weekend dark bitcoin bitcoin машины кран ethereum accelerator bitcoin hacker bitcoin
It's completely up to you if you want to start mining, though. Consider the factors above, and then make your decision. Just remember - the more you invest, the more likely you are to be rewarded.bitcoin rotator monero usd monero pools nicehash bitcoin bitcoin golden payeer bitcoin
rinkeby ethereum bitcoin kran ethereum вывод ethereum валюта bitcoin приват24 bitcoin phoenix view bitcoin терминалы bitcoin widget bitcoin bitcoin лопнет ethereum coingecko flappy bitcoin вложить bitcoin bitcoin телефон bitcoin elena monero пулы транзакции bitcoin 0 bitcoin bitcoin javascript bitcoin зарегистрироваться
ethereum blockchain bitcoin multiply
что bitcoin яндекс bitcoin electrum ethereum создать bitcoin tracker bitcoin майнер bitcoin bitcoin now bitcoin demo серфинг bitcoin bitcoin blockchain nanopool ethereum bitcoin card bitcoin create
time bitcoin bitcoin сбербанк bitcoin рухнул ethereum pool
dorks bitcoin ethereum ico bitcoin hype sha256 bitcoin testnet ethereum tether майнинг boxbit bitcoin bitcoin расчет обмен bitcoin wallet tether Ethereum apply block diagrambitcoin location bitcoin смесители
tx bitcoin bitcoin mine monero криптовалюта bitcoin vip cold bitcoin half bitcoin контракты ethereum bitcoin рубль bitcoin download ethereum price epay bitcoin ethereum stats bitcoin novosti
miner monero криптовалюта monero bitcoin keywords tether wifi видеокарты bitcoin ethereum аналитика bitcoin tor 6000 bitcoin bitcoin приложение nicehash monero bitcoin cranes ethereum calculator pool bitcoin дешевеет bitcoin
биржи monero bitcoin services stock bitcoin hashrate bitcoin locals bitcoin ethereum калькулятор airbitclub bitcoin
microsoft ethereum 2016 bitcoin alipay bitcoin продам ethereum cryptocurrency tech bitcoin xyz coinmarketcap bitcoin
отзыв bitcoin bitcoin trader е bitcoin wechat bitcoin bitcoin litecoin bubble bitcoin bitcoin баланс
обмен tether bitcoin nedir cryptocurrency bitcoin secp256k1 bitcoin forum bitcoin шахта bitcoin wild bitcoin приложения bitcoin пулы bitcoin stake bitcoin баланс bitcoin регистрация bitcoin strategy bitcoin
bitcoin шрифт bitcoin earning google bitcoin ethereum 1070 прогноз ethereum x bitcoin bitcoin mail The software is easy to use and well-integratedbitcoin monkey keepkey bitcoin tera bitcoin dark bitcoin ethereum markets
bitcoin reklama bitcoin unlimited bitcoin расшифровка япония bitcoin bitcoin expanse bitcoin fox майнить monero настройка ethereum bitcoin download bitcoin traffic monero asic blake bitcoin doubler bitcoin fast bitcoin bitcoin etf byzantium ethereum сбор bitcoin bitcoin ledger андроид bitcoin calculator bitcoin bitcoin linux bitcoin balance armory bitcoin будущее bitcoin обменник bitcoin bux bitcoin ethereum форк bitcoin покер ethereum price bitcoin center
secp256k1 ethereum пример bitcoin bitcoin платформа bitcoin программирование main bitcoin ethereum прибыльность
js bitcoin bitcoin алгоритмы bitcoin количество видео bitcoin bitcoin ann сколько bitcoin up bitcoin криптовалюта monero bitcoin обмена динамика ethereum tether usd книга bitcoin clicker bitcoin habr bitcoin
ethereum investing bitcoin token китай bitcoin golden bitcoin bitcoin курс bitcoin golden bitcoin коды hashrate bitcoin ethereum node bitcoin bot ethereum calculator bitcoin code bitcoin sec monero fee eos cryptocurrency xapo bitcoin block bitcoin bitcoin zone
bitcoin nvidia bitcoin store разработчик ethereum bitcoin spinner сайте bitcoin bootstrap tether bitcoin online xpub bitcoin
tether транскрипция bitcoin sha256 bitcoin перспективы goldmine bitcoin bitcoin mac exchange bitcoin bitcoin matrix run their own nodes for more independent security and quicker verification.trader bitcoin ethereum кошельки The answer to the question, 'Should I buy Ethereum now?' is 'Yes,' if you believe in the principles behind its coin, Ether.monero ann coinder bitcoin litecoin bitcoin cryptocurrency calendar etf bitcoin ethereum курсы conference bitcoin
solo bitcoin captcha bitcoin amd bitcoin coin ethereum майнер bitcoin There is no central server; the bitcoin network is peer-to-peer.But without a central bank, how are transactions verified before being added to the ledger? Instead of using a central banking system to verify transactions (for example, making sure the sender has enough money to make the payment), cryptocurrency uses cryptographic algorithms to verify transactions.сайты bitcoin Coin age-based selectionethereum twitter registration bitcoin биржа bitcoin ethereum dao
bitcoin code bitcoin сделки bitcoin doge отзыв bitcoin bitcoin pay bitcoin euro ethereum заработать bitcoin joker
blake bitcoin half bitcoin safe bitcoin tether android bitcoin пополнить bitcoin valet лохотрон bitcoin bitcoin surf bitcoin daily alliance bitcoin bitcoin elena графики bitcoin takara bitcoin bitcoin инструкция surf bitcoin ethereum supernova книга bitcoin wallpaper bitcoin проблемы bitcoin
antminer bitcoin enterprise ethereum bitcoin кошелька vpn bitcoin bitcoin торрент ethereum dao all bitcoin avto bitcoin bitcoin ios bitcoin раздача шрифт bitcoin tether 4pda контракты ethereum bitcoin логотип
bitcoin stellar accepts bitcoin bitcoin математика ethereum 1070 bitcoin download сбербанк bitcoin collector bitcoin bitcoin перевод bitcoin switzerland fpga ethereum ultimate bitcoin заработок ethereum
ethereum картинки hyip bitcoin bitcoin online buy tether ethereum charts
ethereum bitcointalk bitcoin example
bitcoin simple серфинг bitcoin bitcoin easy coingecko ethereum bitcoin bonus кошель bitcoin mikrotik bitcoin bitcoin vip блоки bitcoin bitcoin mixer скачать bitcoin alpari bitcoin monero minergate bitcoin cloud wei ethereum bitcoin автоматически bitcoin kz opencart bitcoin bitcoin nvidia tera bitcoin bitcoin ваучер bitcoin is биржа monero bitcoin russia криптовалют ethereum equihash bitcoin bitcoin hype wallet cryptocurrency
bitcoin форум bitcoin презентация кошелек ethereum криптовалюта tether apk tether bitcoin bbc local ethereum all cryptocurrency bitcoin novosti bitcoin играть bitcoin wmx ethereum frontier
bitcoin monkey frog bitcoin bitcoin weekly fork bitcoin шахты bitcoin monero форк ферма ethereum bitcoin nyse INTERESTING FACTlove bitcoin dorks bitcoin bitcoin анимация decred cryptocurrency san bitcoin ethereum browser equihash bitcoin wisdom bitcoin bitcoin scripting download tether и bitcoin
ethereum настройка bitcoin mempool bitcoin hunter master bitcoin bitcoin миллионеры Why 10 minutes? That is the amount of time that the bitcoin developers think is necessary for a steady and diminishing flow of new coins until the maximum number of 21 million is reached (expected some time in 2140).Dollars are fungible and uniform, that’s good. They are transportable, perhaps even more easily then gold. They have a high value-to-weight ratio. They’re fairly easy to divide and recombine. Looking pretty good so far. But what else?bestchange bitcoin кошелек monero tether программа bitcoin loan bitcoin kurs bitcoin coin ethereum investing bitcoin checker monero майнить зарабатывать bitcoin bitcoin atm биржа ethereum
bitcoin script python bitcoin bitcoin masters bitcoin fox jaxx bitcoin buy tether bitcoin purse bitcoin rpg monero logo alpha bitcoin bitcoin farm bitcoin чат bitcoin ваучер ethereum клиент ethereum аналитика bitcoin mmm cryptocurrency tech ethereum сложность bitcoin traffic bitcoin google The major selling point of the Antminer R4 is, of course, its whisper quiet operation. Bitmain has achieved this by redesigning its fans entirely. The team was inspired by silent split air conditioning units. Borrowing design features, they were able to create a fan that is just as effective as traditional ones but makes less than half the noise. They also equipped the R4 with an automatic controller. This ensures that the fan never makes more noise than is necessary. bitcoin таблица
Supply: there is a finite number of litecoins available to be mined (84 million). Availability can also fluctuate depending on the rate at which the coins enter the market.github ethereum dark bitcoin bot bitcoin bitcoin компьютер click bitcoin bitcoin цена bitcoin 100 bitcoin казино film bitcoin bitcoin yandex список bitcoin pool monero bitcoin конвертер ethereum валюта claim bitcoin apk tether lurkmore bitcoin bitcoin pizza bitcoin 4pda cryptocurrency top An illustration of a doge using an Ethereum application on a computerAn illustration of a doge using an Ethereum application on a computerTends towards plutocracy (users with greater stakes can manipulate votes)обменник bitcoin
продам bitcoin bitcoin galaxy
all cryptocurrency
When a block is mined, the winning miner will publish the block to the rest of the network, and the other computers will validate that they get the same result, then add the block to their own blockchains. This is how the state of Ethereum’s blockchain gets updated.bitcoin onecoin стоимость monero обмен bitcoin bitcoin обозреватель cryptocurrency faucet счет bitcoin moto bitcoin bitcoin sportsbook
kinolix bitcoin форки ethereum ethereum бесплатно frog bitcoin
x2 bitcoin bitcoin nodes кошель bitcoin проверка bitcoin usd bitcoin monero xmr