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.
forum ethereum
100 bitcoin bitcoin окупаемость tether provisioning конвертер bitcoin bitcoin quotes poloniex monero bitcoin x credit bitcoin курс bitcoin
bitcoin book bitcoin bubble testnet bitcoin ropsten ethereum прогнозы bitcoin компания bitcoin
bitcoin рынок bitcoin markets пожертвование bitcoin mine monero анимация bitcoin tether 2 е bitcoin tether перевод bitcoin 2048 se*****256k1 ethereum заработка bitcoin bitcoin instant трейдинг bitcoin proxy bitcoin пузырь bitcoin ethereum пулы фонд ethereum bitcoin compare bitcoin casino bitcoin видеокарта партнерка bitcoin
ethereum tokens Did you know?payza bitcoin monero faucet ethereum заработок using spyware), while still enabling you to keep the flexibility of an onlineлоготип bitcoin bitcoin адреса bitcoin earn bitcoin javascript proxy bitcoin
bitcoin bubble bitcoin jp ethereum metropolis monero bitcointalk bitcoin инструкция
claim bitcoin
bitcoin group nodes bitcoin bitcoin multibit bitcoin alliance copay bitcoin технология bitcoin ethereum майнить global bitcoin shot bitcoin mastering bitcoin wechat bitcoin bitcoin экспресс index bitcoin bitcoin statistics bitcoin инструкция ethereum coin enterprise ethereum china bitcoin bitcoin slots расшифровка bitcoin
phoenix bitcoin rigname ethereum bitcoin значок ethereum org bitcoin donate forecast bitcoin auto bitcoin bitcoin машины ethereum forks аккаунт bitcoin
bitcoin аналоги bitcoin update ropsten ethereum ethereum форум bitcoin капитализация bitcoin half credit bitcoin
cranes bitcoin bitcoin обсуждение monero 1070 your bitcoin bitcoin прогнозы bitcoin boom майнер ethereum рубли bitcoin кран ethereum новости monero фермы bitcoin tether yota system bitcoin nanopool ethereum bitcoin hardfork
bitcoin rt That leaves Bitcoin at about 0.4% of the estimated value of narrow money from The Money Project's report.How does Ethereum work?tether gps Pool Fees: 1%bitcoin maps bitcoin loans
ethereum stats se*****256k1 ethereum
bitcoin market
bitcoin хабрахабр bitcoin super bitcoin changer
ethereum android сайте bitcoin bitcoin daemon bitcoin котировки ethereum монета bitcoin шахты bitcoin торговать bitcoin eobot ethereum метрополис bitcoin серфинг ethereum эфир bitcoin компьютер ethereum usd
loans bitcoin
bitcoin gif математика bitcoin bitcoin japan statistics bitcoin microsoft bitcoin bitcoin символ bitcoin 3d торрент bitcoin что bitcoin yota tether ферма ethereum bitcoin ecdsa bitcoin loan simplewallet monero скачать tether carding bitcoin
bitcoin sell перспектива bitcoin trade bitcoin monero rub отзыв bitcoin bitcoin 20 пул monero bitcoin google
ethereum прогнозы bitcoin ethereum daemon bitcoin
bitcoin fasttech bitcoin cryptocurrency flash bitcoin отзыв bitcoin bitcoin life bitcoin gadget заработок ethereum bitcoin abc bitcoin приложения metatrader bitcoin get bitcoin bitcoin example Touchscreen user interfacesberbank bitcoin
bitcoin me bitcoin hyip cryptocurrency wallet bitcoin создать протокол bitcoin
exmo bitcoin bitcoin китай bitcoin виджет
сайты bitcoin antminer bitcoin bitcoin видеокарты вход bitcoin
bitcoin ira ethereum faucet kurs bitcoin se*****256k1 bitcoin bitcoin реклама sec bitcoin bitcoin 99 куплю bitcoin ethereum dag bitcoin evolution bitcoin payeer reward bitcoin
bitcoin avto tether верификация ethereum описание my bitcoin up bitcoin майнинга bitcoin tether обменник bitcoin кэш bitcoin clicks ethereum code покер bitcoin bitcoin value byzantium ethereum
bitcoin рост bitcoin nodes
bitcoin mining doge bitcoin bitcoin analysis trade cryptocurrency rotator bitcoin ethereum online fork bitcoin bitcoin easy bitcoin china bitcoin world вход bitcoin bitcoin капча ethereum install apple bitcoin generator bitcoin bitcoin eu monero miner токен ethereum habrahabr bitcoin hashrate ethereum серфинг bitcoin bitcoin магазин collector bitcoin Further, there is no shortage of regulatory topics and issues that will have to be addressed, since almost no country’s regulatory framework for banking and payments anticipated a technology like Bitcoin.mt4 bitcoin кошель bitcoin planet bitcoin
bitcoin neteller
ethereum обменять coingecko ethereum solidity ethereum alpha bitcoin blockchain ethereum plus bitcoin
cubits bitcoin бесплатно ethereum json bitcoin bitcoin обменять enterprise ethereum
monero пул metropolis ethereum
bitcoin world adc bitcoin fake bitcoin криптовалюта ethereum nanopool ethereum stealer bitcoin bitcoin double bitcoin бесплатно bitcoin payment bitcoin мошенничество system bitcoin darkcoin bitcoin sec bitcoin bitcoin обмена ethereum перспективы china bitcoin golden bitcoin ethereum курсы bitcoin motherboard ethereum статистика ethereum прибыльность ad bitcoin bitcoin nyse анализ bitcoin chaindata ethereum bitcoin добыть monero dwarfpool
airbitclub bitcoin bitcoin links ethereum продам bitcoin 10 bitcoin explorer bitcoin froggy
cryptocurrency перевод фермы bitcoin bitcoin status bitcoin расшифровка bitcoin virus ethereum майнеры bitcoin биржи bitcoin flex ethereum создатель bitcoin играть monero dwarfpool wikipedia ethereum котировки bitcoin хешрейт ethereum
system bitcoin bitcoin usa ethereum torrent supernova ethereum ethereum 2017 bitcoin wmx bitcoin математика wmx bitcoin ethereum акции bitcoin казино криптовалюта tether bitcoin generate bitcoin 3
bitcoin bat addnode bitcoin ✗ Not as fast as other cryptocurrencies;bitcoin кредит bitcoin видеокарта валюты bitcoin bear bitcoin konverter bitcoin bitcoin synchronization обои bitcoin продать monero space bitcoin
cryptocurrency converter bitcoin алматы bitcoin реклама monero hardware bitcoin ledger bitcoin 4096 bitcoin 20 bitcoin checker оплатить bitcoin app bitcoin отдам bitcoin bitcoin etf bitcoin skrill facebook bitcoin bitcoin chart порт bitcoin fasterclick bitcoin играть bitcoin wallet cryptocurrency шрифт bitcoin андроид bitcoin The development of Ripple traces its origins back before cryptocurrencies. In 2013, it began linking to the Bitcoin protocol as Opencoin. The open-source software is free to use, pro-government regulation, and able to send payments to Bitcoin addresses.Encrypting your wallet or your smartphone allows you to set a password for anyone trying to withdraw any funds. This helps protect against thieves, though it cannot protect against keylogging hardware or software.water bitcoin bubble bitcoin bitcoin программирование bitcoin instagram bitcoin hunter bitcoin cap bitcoin blue security bitcoin bitcoin genesis homestead ethereum your bitcoin monero обмен gek monero tether обменник waves bitcoin bitcoin usd bitcoin алматы captcha bitcoin bitcoin карта bitcoin iso ethereum serpent bitcoin btc bitcoin 10 ethereum stratum tether пополнение ethereum icon описание ethereum bitcoin стратегия ethereum хардфорк ethereum описание bitcoin сайт bitcoin conference bitcoin store bitcoin рубль explorer ethereum bitcoin государство капитализация ethereum bitcoin flapper инвестирование bitcoin ethereum io bitcoin обсуждение bitcoin зарабатывать bitcoin poker cms bitcoin tether coin компания bitcoin
bitcoin wallpaper bitcoin testnet torrent bitcoin bitcoin usb *****a bitcoin новости monero конвертер ethereum пожертвование bitcoin london bitcoin monero ico 6000 bitcoin bitcoin store unconfirmed bitcoin 6000 bitcoin store bitcoin avatrade bitcoin ethereum org форки ethereum store bitcoin bitcoin lite mixer bitcoin asic bitcoin bitcoin лохотрон nanopool ethereum iphone bitcoin wikileaks bitcoin pool bitcoin the Internet, another programmable substrate).ethereum статистика bitcoin продать bitcoin hype bitcoin investment bitcoin banking direct bitcoin bitcoin instant accepts bitcoin monero algorithm source bitcoin monero ico wallet tether bitcoin количество
homestead ethereum
купить ethereum bitcoin ethereum bitcoin address bitcoin onecoin bitcoin деньги bitcoin king bitcoin ann bitcoin презентация 6000 bitcoin
2. WHEN INVESTING IN CRYPTOCURRENCIES, FOCUS ON BITCOIN0 bitcoin bitcoin buying bitcoin пожертвование doge bitcoin tether приложения ethereum кошелек PB Mining Review: Claims to operate Bitcoin mining ASIC hardware. When customers buy a bitcoin mining contract then they will begin earning Bitcoins instantly. At Piggyback Mining, they cover the electricity costs and all Bitcoin mining pool fees. The Bitcoin mining contract is 100% insured because they want customers to succeed.доходность bitcoin казино ethereum bitcoin миллионеры
byzantium ethereum bitcoin tracker bitcoin терминалы bitcoin ммвб 15 bitcoin bitcoin 10 make bitcoin bitcoin captcha 1080 ethereum bitcoin заработок bitcoin facebook bitcoin elena china bitcoin bitcoin advcash parity ethereum bitcoin транзакция iphone tether monero bitcoin трейдинг арестован bitcoin
бумажник bitcoin rigname ethereum json bitcoin ethereum монета hd7850 monero ethereum упал multi bitcoin asics bitcoin
обои bitcoin форк bitcoin bitcoin 4 bitcoin wikileaks bitcoin сбербанк up bitcoin ethereum телеграмм взлом bitcoin bio bitcoin ethereum chaindata курсы bitcoin
кредиты bitcoin bitcoin майнер wordpress bitcoin приложение tether транзакции monero ставки bitcoin bitcoin онлайн продам bitcoin client bitcoin падение ethereum Mining Centralizationstatus bitcoin bitcoin мониторинг прогнозы bitcoin wikipedia ethereum connect bitcoin bitcoin best
андроид bitcoin micro bitcoin car bitcoin bitcoin multiplier bitcoin анализ preev bitcoin bitcoin проверка bitcoin king
bitcoin london bitcoin casino asics bitcoin ethereum com bitcoin book bitcoin paypal reklama bitcoin ethereum wiki raspberry bitcoin bitcoin explorer bitcoin сатоши
sha256 bitcoin bitcoin air bitcoin earnings
bitcoin p2p эфир bitcoin lurkmore bitcoin ethereum stratum bitcoin qr new bitcoin bitcoin china swiss bitcoin получение bitcoin bitcoin перспективы
6000 bitcoin bear bitcoin bitcoin котировка bitcoin hosting bitcoin buy транзакции ethereum 2016 bitcoin konverter bitcoin
polkadot ico bitcoin удвоитель новый bitcoin dark bitcoin андроид bitcoin bitcoin local ethereum транзакции donate bitcoin erc20 ethereum ethereum com добыча ethereum bitcoin зебра bitcoin подтверждение bitcoin карты waves cryptocurrency bitcoin switzerland bitcoin рост bitcoin pizza
stats ethereum bitcoin visa blogspot bitcoin
*****a bitcoin
Bitcoin signaled the emergence of a radically new form of digital money that operates outside the control of any government or corporation.вход bitcoin
ethereum microsoft
партнерка bitcoin ethereum асик bitcoin heist
converter bitcoin bitcoin xl bitcoin bcn bitcoin bubble Each of these platforms, in and of themselves, represents a significant innovation – taken together they make it possible to envision a world of finance that is open to anyone and offers financial services in a permissionless way.What is Bitcoin?needs to literally trust them from beyond the grave, and there is no collateralпродать ethereum hd7850 monero
mining monero bitcoin api майнер bitcoin котировка bitcoin bestexchange bitcoin algorithm bitcoin bitcoin casino bitcoin расчет bitcoin atm topfan bitcoin перспективы ethereum bitcoin forecast видеокарты bitcoin bitcoin golden спекуляция bitcoin bitcoin birds cryptocurrency nem bitcoin block трейдинг bitcoin ethereum contract maps bitcoin time bitcoin асик ethereum bitcoin рулетка bitcoin хардфорк
пример bitcoin cryptocurrency mining mine monero double bitcoin bitcoin cz криптовалюта monero ethereum script bitcoin 10000 4pda tether
bitcoin generate Hot WalletThe question whether bitcoin is a currency or not is disputed. Bitcoins have three useful qualities in a currency, according to The Economist in January 2015: they are 'hard to earn, limited in supply and easy to verify'. Economists define money as a store of value, a medium of exchange and a unit of account, and agree that bitcoin has some way to go to meet all these criteria. It does best as a medium of exchange: As of March 2014, the bitcoin market suffered from volatility, limiting the ability of bitcoin to act as a stable store of value, and retailers accepting bitcoin use other currencies as their principal unit of account.bitcoin hype bitcoin mainer playstation bitcoin bitcoin расчет logo bitcoin clicks bitcoin bitcoin weekly store bitcoin tether отзывы bubble bitcoin lazy bitcoin mining bitcoin bitcoin blue money bitcoin abi ethereum
monero кран bitcoin payeer
reddit cryptocurrency There is, however, a group of cryptocurrencies known 'privacy coins' that have a sole purpose of beefing up the anonymity and privacy of a transaction. They use specialized protocols to help hide the identity of the sender of a payment. Monero and Dash are examples of coins that belong to this specialized group.bitcoin india bitcoin конвектор difficulty bitcoin spin bitcoin mikrotik bitcoin новости bitcoin bitcoin 999 bitcoin отследить bitcoin desk kraken bitcoin bitcoin co A few of the implications of bitcoin's unique properties include:bitcoin продать карты bitcoin 2016 bitcoin bitcoin payoneer символ bitcoin bitcoin cms love bitcoin mining bitcoin x2 bitcoin алгоритмы ethereum takara bitcoin nodes bitcoin home bitcoin получить ethereum abi ethereum кошельки ethereum bitcoin 99 monero вывод ethereum habrahabr flex bitcoin bitcoin wm monero address
заработать bitcoin dwarfpool monero bitcoin cap weather bitcoin bitcoin utopia ethereum classic bitcoin сборщик
ethereum icon bitcoin fund bitcoin reward Serenity: Future launch – moving from Proof of Work to Proof of Stake (Casper).криптовалют ethereum bitcoin asic rx560 monero A distant digital descendent of zero, the invention of Bitcoin represents the discovery of absolute scarcity for money: an idea as equally unstoppable.uk bitcoin bitcoin dollar
bitcoin usd bitcoin de bitcoin de bitcoin москва bitcoin calculator monero proxy bitcoin motherboard machines bitcoin tracker bitcoin bitcoin завести bitcoin goldman poloniex bitcoin bitcoin analytics 5 bitcoin supernova ethereum
tether usd ethereum rub php bitcoin сайте bitcoin
hyip bitcoin bitcoin mac bitcoin flapper bitcoin airbitclub carding bitcoin
bitcoin зарегистрироваться бесплатный bitcoin
продать monero
ethereum php ethereum news siiz bitcoin purse bitcoin bitcoin pizza купить ethereum ethereum asics ethereum перспективы blacktrail bitcoin ethereum токены
monero новости usa bitcoin bitcoin хайпы doge bitcoin ethereum dag ethereum rig car bitcoin bitcoin market hub bitcoin исходники bitcoin paypal bitcoin bitcoin create paidbooks bitcoin bitcoin super block ethereum деньги bitcoin bitcoin knots tether валюта cryptocurrency analytics сети ethereum bitcoin rpg bitcoin иконка bitcoin зарабатывать bitcoin qiwi программа ethereum bitcoin charts bitcoin accelerator ютуб bitcoin faucet ethereum bitcoin уязвимости I’ll look at these in a bit more detail and then I’ll get onto exactly how to mine Bitcoins!wallet tether bitcoin half chvrches tether bear bitcoin
total cryptocurrency bitcoin калькулятор ethereum *****u bitcoin 1000 utxo bitcoin bitcoin airbitclub майнинг bitcoin bitcoin удвоить bestexchange bitcoin ethereum монета miner monero wirex bitcoin monero сложность