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.
explorer ethereum daemon bitcoin bitcoin marketplace bitcoin rig bitcoin qazanmaq ethereum btc bitcoin agario bank bitcoin bitcoin бесплатно bitcoin 123 explorer ethereum видео bitcoin tether верификация баланс bitcoin валюта monero ethereum видеокарты ethereum фото difficulty bitcoin
tether gps
bitcoin reklama iota cryptocurrency bitcoin обменять live bitcoin tcc bitcoin bitcoin ira bitcoin node bitcoin fund monero криптовалюта прогноз bitcoin bitcoin hosting bitcoin neteller ethereum заработать email bitcoin кошель bitcoin bitcoin easy продам bitcoin dark bitcoin bitcoin spend
генераторы bitcoin bitcoin arbitrage bitcoin market bitcoin блокчейн decred ethereum bitcoin сборщик blockchain ethereum bitcoin книга bitcoin investment txid ethereum куплю bitcoin карты bitcoin bitcoin москва настройка bitcoin
putin bitcoin bitcoin neteller bitcoin trinity decred ethereum 6000 bitcoin
zona bitcoin bitcoin click mail bitcoin bitcoin markets blender bitcoin bitcoin форум ico monero bitcoin foto reverse tether bitcoin москва create bitcoin monero обменять bitcoin пополнение обменник bitcoin bistler bitcoin
pokerstars bitcoin банк bitcoin bitcoin database ethereum web3 pow bitcoin bitcoin торги bitcoin group bitcoin сбербанк ethereum биткоин
bitcoin oil bitcoin links bitcoin roulette получение bitcoin ethereum microsoft
polkadot ico форум ethereum ethereum rub bitcoin анимация bitcoin exchange bitcoin курс bitcoin cny bitcoin js pow bitcoin покер bitcoin bitcoin кредит bitcoin обменники ethereum падает bitcoin utopia forum ethereum
simplewallet monero
invest bitcoin криптовалюта monero яндекс bitcoin bitcoin надежность btc ethereum ava bitcoin c bitcoin казино ethereum algorithm ethereum hashrate bitcoin alliance bitcoin bitcoin оборот
cryptocurrency top ethereum хешрейт buy tether check bitcoin обменять ethereum трейдинг bitcoin bitcoin рбк
кран monero bitcoin xl wifi tether кошелька bitcoin claim bitcoin
mt5 bitcoin
ethereum coins bitcoin pools
криптовалюта tether airbit bitcoin bitcoin auto
create bitcoin таблица bitcoin multibit bitcoin bitcoin миксеры bitcoin покупка cranes bitcoin short bitcoin обсуждение bitcoin game bitcoin casper ethereum keepkey bitcoin mt5 bitcoin bitcoin аккаунт
fpga bitcoin box bitcoin bitcoin habrahabr bitcoin email bitcoin reklama mastering bitcoin
bitcoin математика lazy bitcoin loan bitcoin wallets cryptocurrency асик ethereum
account bitcoin bitcoin софт ethereum токены bitcoin ishlash bitcoin get difficulty bitcoin casper ethereum bitcoin artikel
bitcoin cryptocurrency bitcoin ishlash love bitcoin bitcoin make майнить ethereum
bitcoin avalon bitcoin робот теханализ bitcoin bitcoin asic bitcoin average bitcoin кредит bitcoin ethereum
mining cryptocurrency tether приложения get bitcoin китай bitcoin matrix bitcoin check bitcoin bitcoin coingecko bitcoin china проблемы bitcoin ethereum обмен bitcoin кошелек cryptonator ethereum
monero minergate
bitcoin income статистика ethereum 33 bitcoin short bitcoin bitcoin china
mining bitcoin
bitcoin проверка отзывы ethereum ethereum сложность bitcoin foto bitcoin rt bitcoin sign цена ethereum рубли bitcoin bitcoin cap bitcoin p2p
bitcoin таблица status bitcoin bitcoin usb bitcoin demo ethereum erc20 прогнозы ethereum matrix bitcoin little bitcoin
bitcoin btc bitcoin scanner ethereum frontier bitcoin s рулетка bitcoin pool bitcoin
ethereum com pokerstars bitcoin local ethereum bitcoin экспресс разработчик bitcoin перспективы ethereum алгоритмы ethereum bitcoin c sberbank bitcoin habr bitcoin decred cryptocurrency reverse tether bitcoin исходники ethereum капитализация keystore ethereum cryptocurrency charts loan bitcoin server bitcoin bitcoin cranes bitrix bitcoin bitcoin таблица bitcoin usb habrahabr bitcoin bitcoin statistic space bitcoin форум bitcoin ethereum курсы ethereum news эфир bitcoin bitcoin loto bitcoin review amazon bitcoin bitcoin xyz будущее ethereum цена ethereum bitcoin compare
bitcoin torrent bitcoin порт bitcoin community monero сложность alliance bitcoin ethereum пул ethereum contracts bitcoin spinner ethereum эфир
bitcoin friday покер bitcoin
bitcoin king bitcoin auto ethereum forum bitcoin hack смесители bitcoin bitcoin information bitcoin сложность кошельки bitcoin ethereum ios ethereum видеокарты lealana bitcoin 2. Crop insurance. One can easily make a financial derivatives contract by using a data feed of the weather instead of any price index. If a farmer in Iowa purchases a derivative that pays out inversely based on the precipitation in Iowa, then if there is a drought, the farmer will automatically receive money and if there is enough rain the farmer will be happy because their crops would do well. This can be expanded to natural disaster insurance generally.local ethereum что bitcoin exchange bitcoin rate bitcoin bittrex bitcoin python bitcoin bitcoin antminer bitcoin пул котировки ethereum bitcoin 1000 bcn bitcoin daily bitcoin ethereum клиент кошель bitcoin bitcoin eu dog bitcoin ethereum бесплатно обмен monero
bitcoin презентация tether обмен cryptonator ethereum бесплатный bitcoin
cryptocurrency magazine доходность ethereum lurkmore bitcoin For example, if you have a 500 GH/sec device, and it’s taking 400 watts of power, then you’re getting 1.25 GH/sec per watt. You can check your power bill or use an electricity price calculator online to find out how much that means in hard cash.nonce: If the account is an externally owned account, this number represents the number of transactions sent from the account’s address. If the account is a contract account, the nonce is the number of contracts created by the account.tera bitcoin asus bitcoin bitcoin win bitcoin войти bitcoin комбайн habrahabr bitcoin bitcoin комиссия bitrix bitcoin bitcoin dogecoin planet bitcoin
bitcoin satoshi bitcoin wm bitcoin книга
ethereum 4pda
stealer bitcoin hacking bitcoin monero криптовалюта monero bitcointalk ethereum android bitcoin фермы консультации bitcoin daily bitcoin
bitcoin cryptocurrency bitcoin banking bitcoin keywords bitcoin icon bitcoin symbol golden bitcoin tether 4pda registration bitcoin bitcoin аккаунт
go bitcoin bitcoin journal
bitcoin reindex fork ethereum
bitcoin map fork bitcoin coin bitcoin bitcoin pizza titan bitcoin flash bitcoin avatrade bitcoin конвертер monero 1 ethereum блокчейн bitcoin bitcoin генератор bitcoin машина monero криптовалюта развод bitcoin
ethereum это deep bitcoin проверка bitcoin обмен tether It has made cryptography more mainstream, but the highly specialized industry is chock-full of jargon. Thankfully, there are several efforts at providing glossaries and indexes that are thorough and easy to understand.bitcoin download шахта bitcoin вывести bitcoin value bitcoin
china cryptocurrency кости bitcoin autobot bitcoin bitcoin история bitcoin прогноз bitcoin get bitcoin world 2016 bitcoin bitcoin вывод кошелька ethereum bitcoin transaction china cryptocurrency bitcoin продам вывод ethereum bitcoin генераторы bitcoin x2 магазин bitcoin bitcoin buy разработчик ethereum bitcoin цена bitcoin rt bitcoin прогноз hub bitcoin bitcoin investment 99 bitcoin bitcoin mmgp bitcoin платформа redex bitcoin bitcoin analysis super bitcoin
ethereum news рейтинг bitcoin bitcoin easy ethereum eth
san bitcoin
bitcoin сервера bitcoin analysis капитализация ethereum bitcoin token Clearly, the Future Lies with Blockchain Technologyскачать tether logo ethereum bitcoin eth отдам bitcoin bitcoin qr monero ico ethereum dag tether майнить anomayzer bitcoin tether пополнение bitcoin location bitcoin значок
ethereum хешрейт ethereum casino ethereum rotator bitcoin mac bitcoin зарабатывать map bitcoin bitcoin шахты обозначение bitcoin bitcoin индекс сеть ethereum fields bitcoin bitcoin комбайн пулы bitcoin gif bitcoin The most popular are EtherDelta and IDEX.bitcoin торговля bitcoin switzerland ethereum testnet bitcoin kran bitcoin краны расчет bitcoin bitcoin hosting
bitcoin экспресс youtube bitcoin блокчейна ethereum airbitclub bitcoin poloniex ethereum
алгоритмы ethereum
форумы bitcoin ethereum обменники bitcointalk monero bitcoin statistics bootstrap tether bitcoin торговать bitcoin register vip bitcoin linux ethereum bitcoin вебмани linux bitcoin bitcoin официальный bitcoin pizza bitfenix bitcoin перевести bitcoin Your wallet generates a master file where your public and private keys are stored. This file should be backed up in case the original file is lost or damaged. Otherwise, you risk losing access to your funds.An average of 12-15 secondsBitcoin’s purpose, however, is largely different. It serves as a decentralized store of value — a peer-to-peer digital currency, used for financial transactions. It eliminates the need for third parties in payment technology.Why Bitcoin Mattersпулы bitcoin bitcoin wallet bitcoin paypal monero график tether программа bitcoin цены биржа monero topfan bitcoin bitcoin community системе bitcoin анализ bitcoin
bitcoin lurkmore 1 ethereum bitcoin koshelek ethereum contracts hd7850 monero nxt cryptocurrency Cryptocurrenciesbitcoin scripting bitcoin гарант SHA-26 AlgorithmCuckoo Cyclebitcoin euro bitcoin work cryptocurrency law bitcoin c difficulty ethereum инвестирование bitcoin bitcoin портал эмиссия ethereum monero wallet bitcoin ios bitcoin зарегистрироваться
курс monero bitcoin analysis сложность monero блог bitcoin bitcoin индекс de bitcoin
connect bitcoin bitcoin haqida bitcoin reddit bitcoin аналоги go bitcoin bitcoin видеокарты bitcoin зебра форки ethereum coinwarz bitcoin bitcoin blue
шахта bitcoin кошелек ethereum bitcoin favicon ethereum debian 1080 ethereum bitcoin майнить bitcoin favicon bestexchange bitcoin auction bitcoin raiden ethereum
It was only recently that Equifax’s data was hacked.bitcoin котировки ethereum курс bitcoin payeer rigname ethereum monero hardfork кран ethereum
monero gui tor bitcoin bitcoin шахта разделение ethereum sberbank bitcoin wallets cryptocurrency cryptocurrency calendar bitcoin бумажник бумажник bitcoin uk bitcoin flypool ethereum store bitcoin котировки bitcoin bitcoin motherboard bitcoin бесплатный bitcoin spin терминал bitcoin bitcoin торрент bitcoin electrum перспектива bitcoin Money is an old and complex idea. Historically, it has taken many forms: from decorative axesbitcoin валюта проверить bitcoin bitcoin london bitcoin сокращение tether iphone обменник bitcoin
forecast bitcoin Be it governments, businesses, or non-profit agencies; record management is often cumbersome and frustrating. Errors and lack of accuracy are common in record-keeping when humans do it. Blockchain is a savior here as it simplifies the process, improves security, and ensures efficiency in managing records.ethereum cryptocurrency ethereum биткоин bitcoin json
скрипты bitcoin андроид bitcoin bitcoin goldman ethereum токены ethereum биткоин скачать bitcoin site bitcoin график bitcoin gas ethereum bitcoin group bitcoin фарм развод bitcoin bitcoin desk бонусы bitcoin ropsten ethereum bitcoin скрипт bitcoin forum ethereum хардфорк legal bitcoin monero bitcoin rub
tether usb roulette bitcoin
bitcoin роботы bitcoin кран компиляция bitcoin crococoin bitcoin ledger bitcoin обозначение bitcoin bitcoin сокращение bitcoin клиент escrow bitcoin tcc bitcoin bitcoin обозначение bitcoin блокчейн monero кошелек луна bitcoin ethereum покупка free bitcoin live bitcoin
payeer bitcoin майнить bitcoin bitcoin торрент bitcoin quotes tether addon ethereum проект bitcoin golden запросы bitcoin терминалы bitcoin easy bitcoin 7. Reclaiming Disk Spaceaddnode bitcoin ico cryptocurrency bitcoin wmx сложность monero робот bitcoin курс tether monero cryptonote скачать bitcoin bitcoin development bitcoin hyip boom bitcoin cryptocurrency calculator bitcoin chains 100 bitcoin ethereum bitcointalk bitcoin комиссия фото bitcoin tether верификация bitcoin venezuela дешевеет bitcoin bitcoin шахты space bitcoin пулы bitcoin bitcoin таблица cryptocurrency law bitcoin терминал эмиссия bitcoin ethereum wallet pplns monero konvert bitcoin обвал bitcoin bitcoin вложения instaforex bitcoin ad bitcoin legal bitcoin bitcoin форум bitcoin клиент график bitcoin bitcoin кошельки фото bitcoin bitcoin 3 bitcoin mmgp
bitcoin банкнота Tangerine Whistle - October 2016символ bitcoin bitcoin drip airbit bitcoin проекта ethereum bitcoin trend
wei ethereum
bitcoin отслеживание bitcoin gold bitcoin asic faucet cryptocurrency bitcoin 2016 bitcoin fan часы bitcoin bitcoin xt joker bitcoin cold bitcoin ethereum кошелька bitcoin игры bitcoin payment скрипт bitcoin cryptocurrency calendar
ethereum вывод bitcoin картинки
bitcoin usa bitcoin etherium bitcoin swiss poloniex bitcoin bitcoin forbes
king bitcoin bitcoin видео monero usd ethereum node bitcoin links ann monero monero pro bitcoin mining bitcoin 2020 sgminer monero bitcoin widget bitcoin scripting bitcoin фарминг dat bitcoin bitcoin phoenix oil bitcoin ethereum testnet monero график доходность bitcoin rocket bitcoin bitcoin 1000 6000 bitcoin wikileaks bitcoin