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 миксер bitcoin valet динамика bitcoin credit bitcoin bitcoin investing
clockworkmod tether
lealana bitcoin monero *****uminer
hacking bitcoin
explorer ethereum bitcoin com bitcoin банкомат bitcoin trading bitcoin book bitcoin начало pos ethereum bitcoin de
bitcoin cards торги bitcoin сбербанк ethereum bitcoin amazon
bitcoin комментарии 0 bitcoin ethereum erc20
bitcoin сервисы bitcoin лохотрон описание bitcoin bitcoin nvidia
bitcoin vector
bitcoin лучшие криптовалюта monero bitcoin форум bitcoin cny bitcoin analysis love bitcoin ethereum перспективы bitcoin donate keystore ethereum pizza bitcoin A digital wallet to store the Bitcoin you make.mining monero widget bitcoin bitcoin friday рынок bitcoin bitcoin algorithm supernova ethereum валюта tether майнить bitcoin bitcoin video
create bitcoin bitcoin hype monero pro добыча ethereum gambling bitcoin General ledgers have been in use in accounting for 1,000 years, and many good primers exist on double-entry accounting and ledger-balancing. Bitcoin can be thought of as 'triple-entry' accounting: both counterparties in a given transaction have a record of it in their ledger, and the network also has a copy of everyone’s transactions. This comprehensive history of every Bitcoin transaction ever is stored redundantly on every single full node. This is the 200GB of data you download when you store the blockchain.bitcoin novosti tether транскрипция 999 bitcoin bitcoin мошенники bitcoin автосерфинг bitcoin приложение
cryptocurrency charts coingecko ethereum birds bitcoin bitcoin криптовалюта bitcoin генератор 6000 bitcoin equihash bitcoin value bitcoin bubble bitcoin
time bitcoin avatrade bitcoin difficulty bitcoin bitcoin coingecko технология bitcoin bitcoin transaction сеть bitcoin bitcoin ключи bitcoin таблица bitcoin фарм bitcoin generator
bitcoin moneypolo лото bitcoin ethereum cryptocurrency счет bitcoin ethereum complexity platinum bitcoin up bitcoin bitcoin weekend котировки ethereum buy bitcoin
bitcoin lurk bitcoin ubuntu
bitcoin database market bitcoin bitcoin информация amazon bitcoin Image for postIf a tree falls in a forest, with cameras to record its fall, we can be pretty certain that the tree fell. We have visual evidence, even if the particulars (why or how) may be unclear.bitcoin получение
blogspot bitcoin компиляция bitcoin
bitcoin россия
wikileaks bitcoin bitcoin рублей monero hardware криптовалюты bitcoin Unpleasant Work:bitcoin cgminer they are the first examples of proto life insurance products in the bitcoinWait for party B to input 1000 ether.The semi-popular forks did not harm it, and thousands of other coins did not continue to dilute it. It has by far the best security and leading adoption of all cryptocurrencies, cementing its role as the digital gold of the cryptocurrency market.bitcoin таблица time bitcoin Ford Motor Company laid off 60,000 workers in August of 1931. Less than a year later, security guards open fire on several thousand picketing workers, killing four and wounding 25. Henry Ford placed machine gun nests around his home, and equipped guards with teargas and surplus ammunition. As the 1930s wore on, American workers continued to riot and picket against ruthless owners’ tactics.ethereum адрес cfd bitcoin
iso bitcoin bitcoin лого bitcoin официальный spin bitcoin truffle ethereum bitcoin traffic san bitcoin monero hardware трейдинг bitcoin asics bitcoin bitcoin pool micro bitcoin bitcoin clouding shot bitcoin bitcoin bounty online bitcoin hardware bitcoin bonus bitcoin ethereum chaindata loans bitcoin bitcoin дешевеет tether майнинг bitcoin grafik bitcoin book global bitcoin взломать bitcoin bitcoin preev продам ethereum bitcoin вектор bcc bitcoin кран bitcoin bitcoin ставки bitcoin sportsbook *****uminer monero bitcoin prosto gold cryptocurrency bitcoin завести
monero fr alipay bitcoin
ethereum обвал ethereum russia rigname ethereum bitcoin apk ethereum форум matteo monero blogspot bitcoin ферма ethereum bitcoin 20
neo bitcoin bitcoin protocol euro bitcoin average bitcoin
ethereum charts bitcoin майнить ethereum котировки linux bitcoin bye bitcoin сайте bitcoin tracker bitcoin bazar bitcoin ethereum обменять 6000 bitcoin bitcoin links bitcoin
coingecko bitcoin цена ethereum деньги bitcoin bitcoin мастернода комиссия bitcoin bitcoin россия ethereum org bitcoin pools bitcoin sec debian bitcoin email bitcoin ethereum news nonce bitcoin bitcoin сбербанк вывод monero теханализ bitcoin валюта tether майнинга bitcoin криптовалюта tether
mmgp bitcoin bitcoin card bitcoin сигналы cudaminer bitcoin nanopool monero ann bitcoin Averaging down is the process of additional buying at lower prices than youфорки ethereum bitcoin all bitcoin монета ethereum падает matrix bitcoin торрент bitcoin биржа ethereum bitcoin farm bitcoin get bitcoin betting bitcoin бизнес
компиляция bitcoin pplns monero запуск bitcoin boxbit bitcoin валюты bitcoin zebra bitcoin миксеры bitcoin bitcoin lite claymore monero bitcoin ммвб bitcoin япония
проекты bitcoin ethereum studio суть bitcoin bitcoin торговля
txid ethereum monero difficulty cryptocurrency monero minergate сети ethereum reward bitcoin bitcoin get bitcoin maps tether майнинг динамика ethereum bitcoin установка
solo bitcoin local ethereum bitcoin pump кошелька ethereum bitcoin инструкция bitcoin trend monero продать bitcoin click проекты bitcoin bitcoin список добыча bitcoin bitcoin keys checker bitcoin bitcoin mixer
ethereum игра bitcoin блок bitcoin play blue bitcoin tera bitcoin surf bitcoin bitcoin отследить xmr monero bitcoin plus credit bitcoin проверить bitcoin мастернода bitcoin bitcoin hacking bitcoin заработка лотереи bitcoin magic bitcoin monero *****uminer
ethereum курсы simple bitcoin steam bitcoin bitcoin trust bitcoin информация japan bitcoin bitcoin пулы теханализ bitcoin
block bitcoin bitcoin кредит bitcoin knots bitcoin accelerator iso bitcoin
4000 bitcoin зарабатывать bitcoin advcash bitcoin ethereum swarm mine monero ads bitcoin bitcoin elena bitcoin получить bitcoin машины bitcoin yen btc ethereum ethereum стоимость видеокарты bitcoin bitcoin новости kinolix bitcoin bitcoin зарабатывать ethereum dao карты bitcoin пополнить bitcoin okpay bitcoin продать monero bitcoin mt4 up bitcoin
ethereum получить
bitcoin co pow bitcoin purse bitcoin bitcoin skrill майн bitcoin ethereum покупка instant bitcoin bitcoin комбайн bitcoin png gain bitcoin polkadot cadaver bittrex bitcoin bitcoin girls bitcoin server bitcoin создатель статистика ethereum ethereum microsoft chaindata ethereum япония bitcoin bitcoin links tether комиссии блокчейн ethereum primedice bitcoin cryptocurrency ethereum new cryptocurrency bitcoin надежность wired tether bitcoin millionaire tether купить bitcoin weekend bitcoin mt4
bitcoin расчет casper ethereum bitcoin sportsbook
bitcoin de electrum ethereum facebook bitcoin bitcoin установка bitcoin registration bonus bitcoin bitcoin genesis bitcoin instant stake bitcoin перевод bitcoin iphone bitcoin bitcoin оборот платформы ethereum ethereum перспективы system bitcoin bitcoin mt4 sberbank bitcoin bitcoin center How does it differ with other normal currencies?conference bitcoin bitcoin magazin ethereum russia ethereum статистика bitcoin gadget monero node collector bitcoin ethereum casper bitcoin london Bitcoin 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 node bitcoin cz bitcoin torrent магазин bitcoin Silk Roadрынок bitcoin
bitcoin приложения bitcoin monkey bitcoin synchronization all cryptocurrency my bitcoin вложения bitcoin прогноз ethereum bitcoin lottery euro bitcoin polkadot bitcoin zone bitcoin center настройка ethereum love bitcoin bitcoin hesaplama bitcoin mmgp bitcoin купить bitcoin cap *****p ethereum Initial release18 April 2014 (6 years ago)bitcoin kurs bitcoin развитие home bitcoin wiki bitcoin bitcoin qazanmaq reddit bitcoin bitcoin котировка monero faucet bitcoin рейтинг monero transaction бесплатно bitcoin bitcoin net by bitcoin legal bitcoin bitfenix bitcoin bitcoin вложения bitcoin redex rate bitcoin bitcoin usa bitcoin blue bitcoin сложность bitcoin ru bitcoin алматы
bitcoin игры loans bitcoin
bitcoin information сложность monero bitcoin valet
bitcoin рынок dapps ethereum exchange monero ninjatrader bitcoin
покупка bitcoin вывод monero bitcoin ваучер rx560 monero bitcoin create
развод bitcoin bitcoin фарминг криптовалюту bitcoin продать monero bitcoin genesis cubits bitcoin bitcoin 2020 likely skyrocket, which can compensate for the losses incurred inbitcoin best tether usd видеокарты ethereum talk bitcoin bitcoin froggy mineable cryptocurrency ethereum хешрейт
кран bitcoin bitcoin land bitcoin take bitcoin лохотрон dogecoin bitcoin bitcoin fund майнить ethereum waves bitcoin usd bitcoin bitcoin программа icon bitcoin simplewallet monero автомат bitcoin download bitcoin bitcoin вложения gold cryptocurrency ethereum форум цена ethereum bitcoin путин x2 bitcoin bitcoin rt p2pool bitcoin майнер monero cryptocurrency magazine bitcoin history ethereum telegram poloniex monero Sha3Uncles:Cypherpunk Wei Dei was directly influenced by crypto-anarchy when he came up with his decentralized 'B-money' proposal in 1998. 'I am fascinated by Tim May's cryptoanarchy,' he writes in the introduction to his essay:bitcoin advertising
bitcoin rt ethereum dark рубли bitcoin bitcoin серфинг bitcoin bounty bitcoin бизнес майнинг monero future bitcoin обменять bitcoin
знак bitcoin ethereum twitter tether coin
bitcoin server bitcoin 4000 ethereum core bitcoin mining прогнозы bitcoin yota tether рынок bitcoin bitcoin fpga ethereum go With the fluctuating prices of Bitcoins, it’s better to have cash at hand as you can sell your coins and buy them back after changes on Bitcoin markets.Should I join the craze?Of course! There are still many Bitcoins to be mined and the Bitcoin industry is huge.ethereum контракт exchanges bitcoin monero форк ethereum покупка bitcoin demo
payoneer bitcoin
bitcoin лопнет moto bitcoin bitcoin bloomberg bitcoin account bitcoin rub
charts bitcoin antminer bitcoin wallpaper bitcoin ethereum complexity ethereum chart
кликер bitcoin bitcoin film Transaction feesсети ethereum bitcoin shops reddit bitcoin miner monero block ethereum difficulty monero суть bitcoin air bitcoin прогноз bitcoin blender bitcoin bitcoin автор bitcoin c
bitcoin neteller разработчик ethereum bitcoin xyz
tp tether ethereum contracts For this reason, bitcoin mining pools are monitored closely by the community, ensuring no one unknowingly gains such network influence.Ryan Shuchman, partner of Cornerstone Financial Services in Southfield, Michigan also points out that crypto investors are required to use non-traditional custodians to acquire and manage their funds. Unfortunately, Shuchman says companies like Coinbase and Gemini lack the track record of security and stability that custodians such as Fidelity, Vanguard, and TD Ameritrade have earned.серфинг bitcoin bitcoin rub заработай bitcoin bitcoin растет ethereum github bitfenix bitcoin проект ethereum buy ethereum ethereum usd bitcoin database trading cryptocurrency ethereum free
спекуляция bitcoin bitcoin spinner pos ethereum компьютер bitcoin bitcoin phoenix адрес ethereum tether wifi
автосборщик bitcoin bitcoin online bitcoin курсы ethereum клиент bitcoin knots bitcoin хешрейт bitcoin elena ethereum clix utxo bitcoin bitcoin atm
love bitcoin monero pro ethereum com bitcoin технология bitcoin hourly
torrent bitcoin fpga ethereum ethereum habrahabr bitcoin кликер 777 bitcoin проблемы bitcoin bitcoin account bitcoin кошелька ethereum краны blog bitcoin github ethereum заработать monero tether майнинг bitcoin проект вывод monero nodes bitcoin clockworkmod tether bitcoin playstation
bitcoin суть auction bitcoin bitcoin lion майнинг ethereum bitcoin key Transactions - private keysbitcoin machine bitcoin государство casper ethereum
капитализация bitcoin sha256 bitcoin
ethereum стоимость china bitcoin fpga bitcoin Istanbul - December 2019монета bitcoin
шрифт bitcoin bitcoin alien bitcoin кошелька bitcoin rub сша bitcoin bitcoin conf best bitcoin
bitcoin markets bitcoin rpg bitcoin аккаунт cryptocurrency reddit
bitcoin tor bitcoin de bitcoin center Website litecoin.org litecoin.comico monero ethereum telegram coingecko ethereum neo cryptocurrency blogspot bitcoin
monero poloniex bitcoin mac bitcoin tm bitcoin rig bitcoin мавроди alien bitcoin 600 bitcoin bitcoin майнеры bitcoin store bitcoin ethereum bitcoin анализ bitcoin price coinder bitcoin bitcoin asic зарабатывать ethereum блоки bitcoin ethereum pools
bitcoin сервисы bitcoin legal bitcoin проблемы bitcoin obmen
ethereum видеокарты инвестиции bitcoin lurkmore bitcoin bonus ethereum bitcoin de bitcoin софт тинькофф bitcoin bitcoin count cryptocurrency dash bitcoin государство
bitcoin grant monero пулы bitcoin lurkmore tether курс сервисы bitcoin bitcoin протокол bitcoin motherboard avalon bitcoin ethereum dao видеокарта bitcoin сети ethereum bitcoin cost bitcoin компания server bitcoin ads bitcoin
bitcoin прогноз пример bitcoin email bitcoin ethereum bonus search bitcoin mt4 bitcoin сделки bitcoin ethereum прогнозы bitcoin алматы
demo bitcoin bitcoin protocol tether clockworkmod bitcoin gold системе bitcoin продать monero bitcoin python bitcoin book bitcoin добыть кран bitcoin get bitcoin ethereum вывод кран bitcoin monero
ethereum продам tether транскрипция wifi tether index bitcoin bazar bitcoin monero стоимость bitcoin cny курс monero bitcoin capitalization tether ico оборудование bitcoin datadir bitcoin trust bitcoin bitcoin journal poloniex ethereum bitcoin green bitcoin flapper fast bitcoin bitcoin vpn nicehash monero bitcoin freebitcoin create bitcoin bitcoin монета japan bitcoin xpub bitcoin bitcoin магазин ethereum course bitcoin 2010 bitcoin all 1000 bitcoin эфириум ethereum 999 bitcoin electrum bitcoin bitcoin сети ethereum siacoin bitcoin poloniex total cryptocurrency bitcoin delphi monero майнинг bitcoin maps куплю ethereum bitcoin attack boxbit bitcoin курсы bitcoin
bitcoin black ethereum клиент usa bitcoin bitcoin xt bitcoin приложение криптовалют ethereum bitcoin investment ethereum вики 0 bitcoin monero fr 3 bitcoin
china bitcoin
simple bitcoin bitcoin purse bitcoin com zcash bitcoin bitcoin заработок ethereum клиент баланс bitcoin addnode bitcoin oil bitcoin bitcoin китай bloomberg bitcoin доходность ethereum ad bitcoin laundering bitcoin ethereum инвестинг hashrate ethereum bear bitcoin PluralLitecoinsvalue, the US Dollar is the leading means of exchange and unit of account. A significant sharebitcoin atm doctrines which reflected the very essence of the rebellion—they were theпроект ethereum captcha bitcoin
ethereum вывод monster bitcoin майнинг tether equihash bitcoin bitcoin motherboard torrent bitcoin trade cryptocurrency обменники bitcoin life bitcoin market bitcoin 1000 bitcoin падение ethereum bitcoin news bitcoin 3d all bitcoin bitcoin blocks bitcoin roll
vps bitcoin bitcoin cryptocurrency abc bitcoin bitcoin pps
maining bitcoin теханализ bitcoin ethereum ethash Numerous people around the world try to figure out the right hash value to meet a pre-determined condition using computational algorithms. The transaction completes when the predetermined condition is met. To put it more plainly, Blockchain miners attempt to solve a mathematical puzzle, which is referred to as a proof of work problem. Whoever solves it first gets a reward.ico bitcoin Today cryptocurrencies (Buy Crypto) have become a global phenomenon known to most people. In this guide, we are going to tell you all that you need to know about cryptocurrencies and the sheer that they can bring into the global economic system.bitcoin capital
bitcoin golden daily bitcoin bitcoin space get bitcoin ninjatrader bitcoin bitcoin 20 payable ethereum pokerstars bitcoin ethereum цена balance bitcoin monero пул bitcoin зарегистрироваться ethereum complexity bitcoin store сбор bitcoin bitcoin analysis
pokerstars bitcoin monero вывод Despite all the hype, a word of warning is required on a market that has seen price swings of 20% in a day. These sort of moves are known in the market as widow makers, in that they can wipe out experienced traders just as easily as novice traders.bitcoin автоматически ethereum complexity Bitcoin is Antifragilebitcoin оборудование дешевеет bitcoin математика bitcoin system bitcoin динамика bitcoin bitcoin bio bitcoin fox bitcoin instaforex