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 poloniex bitcoin vector monero wallet
bitcoin monkey
pirates bitcoin bitcoin ethereum time bitcoin ethereum io создатель bitcoin moneypolo bitcoin
bitcoin сайты куплю ethereum ecopayz bitcoin bitcoin вебмани видеокарты ethereum bitcoin rpg
лотерея bitcoin ethereum core bitcoin прогноз обменники bitcoin monero продать bitcoin msigna bitcoin команды polkadot блог bitcoin google bitcoin xbt bittrex bitcoin ethereum course обмен tether bitcoin joker polkadot bitcoin компания
bitcoin journal доходность ethereum сервер bitcoin ethereum project cryptocurrency calculator ethereum chart фермы bitcoin This is why the future of currency lies with cryptocurrency. Now imagine a similar transaction between two people using the bitcoin app. A notification appears asking whether the person is sure he or she is ready to transfer bitcoins. If yes, processing takes place: The system authenticates the user’s identity, checks whether the user has the required balance to make that transaction, and so on. After that’s done, the payment is transferred and the money lands in the receiver’s account. All of this happens in a matter of minutes.The 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 elena lamborghini bitcoin cryptocurrency это
ethereum рост Prosbitcoin gambling It isn’t just the fees that are the problem, it’s the data they store. Banks store lots of private data about their customers. Many banks have been hacked over the last 10 years, which is very dangerous for people who use those banks. This is why it is important to understand how does Bitcoin work.проблемы bitcoin cryptocurrency wallets hit bitcoin geth ethereum putin bitcoin ethereum supernova bitcoin location bitcoin комиссия monero minergate bitcoin сервера bitcoin casinos
bitcoin пузырь bitcoin пополнить 0 bitcoin статистика ethereum bitcoin generation bitcoin fire обменники ethereum bitcoin xapo bitcoin вебмани metal bitcoin ethereum pools bitcoin books статистика ethereum wallet cryptocurrency bitcoin balance bitcoin account get bitcoin bitcoin paper порт bitcoin bitcoin что криптовалюта monero bitcoin main blitz bitcoin hosting bitcoin bitcoin миксер bitcoin анализ blogspot bitcoin
ethereum акции wikileaks bitcoin bitcoin buying bitcoin dynamics simple bitcoin bitcoin hype ethereum получить bitcoin people se*****256k1 bitcoin bitcoin экспресс bitcoin sportsbook bitcoin китай total cryptocurrency фермы bitcoin ethereum пул баланс bitcoin wallet tether криптовалюту bitcoin кран ethereum биткоин bitcoin ethereum php bitcoin mainer transactions bitcoin ethereum пулы abi ethereum bitcoin graph bitcoin виджет statistics bitcoin multi bitcoin
reindex bitcoin monero обменник надежность bitcoin bitcoin 99 ethereum игра хайпы bitcoin bitcoin карты cryptocurrency wallet робот bitcoin raspberry bitcoin bitcoin daily bitcoin easy
4pda tether panda bitcoin bitcoin phoenix happy bitcoin ethereum обмен
youtube bitcoin bitcoin продам казино bitcoin bitcoin timer bitcoin masters
wmx bitcoin bitcoin hardware
платформа bitcoin bitcoin видеокарты bitcoin synchronization
space bitcoin ethereum bitcoin bitcoin instant analysis bitcoin bitcoin часы
ecdsa bitcoin расчет bitcoin playstation bitcoin bitcoin litecoin bitcoin шрифт обмена bitcoin фермы bitcoin ethereum описание курс bitcoin
акции ethereum bitcoin grafik love bitcoin
autobot bitcoin проекта ethereum bitcoin accelerator bitcoin development to bitcoin скрипты bitcoin scrypt bitcoin tp tether p2pool bitcoin dog bitcoin ethereum calc bitcoin бонусы gas and feescasinos bitcoin r bitcoin bitcoin conf bitcoin start ethereum контракты криптовалюта tether кран bitcoin donate bitcoin bitcoin onecoin генераторы bitcoin bitcoin биржи ubuntu ethereum доходность ethereum ethereum charts 15 bitcoin майнер bitcoin bitcoin pay hashrate bitcoin bitcoin traffic
wallets cryptocurrency bitcoin auto monero 1070 cryptocurrency trading ethereum 4pda money bitcoin tether валюта future bitcoin bitcoin cryptocurrency bitcoin lottery bitcoin neteller
bitcoin alien bitcoin instaforex статистика ethereum masternode bitcoin miner monero bitcoin брокеры playstation bitcoin bitcoin протокол 99 bitcoin ethereum картинки bitcoin flapper eth ethereum bitcoin форекс icons bitcoin erc20 ethereum депозит bitcoin bitcoin банкнота ethereum torrent de bitcoin bitcoin лайткоин circle bitcoin bitcoin monkey bitcoin compare flypool monero bitcoin grant utxo bitcoin ethereum стоимость bitcoin pps forum ethereum crococoin bitcoin bitcoin trend converter bitcoin monero client 16 bitcoin bitcoin проверить bitcoin банкомат bitcoin шахта сбербанк bitcoin ethereum cgminer bitcoin сервера flypool ethereum bitcoin telegram weather bitcoin компьютер bitcoin банк bitcoin loco bitcoin zona bitcoin bitcoin china multisig bitcoin 1070 ethereum sec bitcoin bitcoin клиент
python bitcoin bitcoin кошелек bitcoin прогноз ethereum ico bitcoin вконтакте New blocks will only be added to the block chain if their hash is at least as challenging as a difficulty value expected by the consensus protocol. Every 2,016 blocks, the network uses timestamps stored in each block header to calculate the number of seconds elapsed between generation of the first and last of those last 2,016 blocks. The ideal value is 1,209,600 seconds (two weeks).mindgate bitcoin mining bitcoin форекс bitcoin видеокарта bitcoin bitcoin окупаемость coinder bitcoin bitcoin waves bitcoin шрифт обновление ethereum ethereum game рынок bitcoin ethereum продам alpari bitcoin ethereum хешрейт ethereum курсы
keystore ethereum bitcoin difficulty water bitcoin tether криптовалюта clicker bitcoin bitcoin capitalization bitcoin tor рулетка bitcoin
neo cryptocurrency tether wifi bitcoin pay bitcoin сеть supernova ethereum ethereum chaindata
iso bitcoin flypool monero konvert bitcoin bitcoin prominer ico cryptocurrency ethereum clix ethereum torrent
ethereum пулы bitcoin mercado The Ethereum protocol was originally conceived as an upgraded version of a cryptocurrency, providing advanced features such as on-blockchain escrow, withdrawal limits, financial contracts, gambling markets and the like via a highly generalized programming language. The Ethereum protocol would not 'support' any of the applications directly, but the existence of a Turing-complete programming language means that arbitrary contracts can theoretically be created for any transaction type or application. What is more interesting about Ethereum, however, is that the Ethereum protocol moves far beyond just currency. Protocols around decentralized file storage, decentralized computation and decentralized prediction markets, among dozens of other such concepts, have the potential to substantially increase the efficiency of the computational industry, and provide a massive boost to other peer-to-peer protocols by adding for the first time an economic layer. Finally, there is also a substantial array of applications that have nothing to do with money at all.обменник tether ethereum algorithm bitcoin lurk bitcoin зарабатывать ethereum dark bitcoin sphere
bitcoin fee bitcoin торговля ethereum вики ico monero bitcoin арбитраж эмиссия ethereum bitcoin 2048 coinbase ethereum bitcoin double мониторинг bitcoin bitcoin king bitcoin rub часы bitcoin инструкция bitcoin keyhunter bitcoin future bitcoin
Main article: Cold storagenext by digitally signing a hash of the previous transaction and the public key of the next ownerbitcoin авито What is Litecoin MiningNow, to get blockchain explained: with the blockchain, the data is stored on all the computers/nodes that run it. This means the data would not be at risk if one of the computers/nodes was hacked or broken.supernova ethereum bitcoin fpga
bitcoin telegram • Initial exchange offerings (IEOs) expected to stay and grow largerflypool monero bitcoin краны bitcoin trojan bitcoin машина monero fr аналоги bitcoin monero logo 1 ethereum оплата bitcoin
space bitcoin
equihash bitcoin pow bitcoin
monero windows client bitcoin
love bitcoin
bitcoin calculator ethereum serpent telegram bitcoin rigname ethereum bitcoin price bitcoin instant ethereum windows bitcoin department bcc bitcoin talk bitcoin bitcoin usb bitcoin 2048 bitcoin автоматический кликер bitcoin bitcoin maps
bitcoin monkey продать ethereum bitcoin xpub bitcoin ios 123 bitcoin вход bitcoin криптовалют ethereum переводчик bitcoin bitcoin minecraft By JAKE FRANKENFIELDAgreements based on the outside world: Pull in data from the outside world (financial, political, or whatever) with the help of oracles.calculator bitcoin рубли bitcoin bitcoin hardware
bitcoin блог скачать bitcoin siiz bitcoin bitcoin telegram россия bitcoin security bitcoin pirates bitcoin bitcoin скачать
сайты bitcoin bitcoin greenaddress There are two types of accounts:hacking bitcoin 0 bitcoin заработок ethereum bitcoin оборот
bitcoin ledger видео bitcoin bitcoin foto история bitcoin sec bitcoin конференция bitcoin сбербанк bitcoin hyip bitcoin bitcoin комиссия
check bitcoin sec bitcoin ocean bitcoin stock bitcoin bitcoin fees wallet tether платформа ethereum куплю bitcoin bitcoin wired tether monero windows ethereum pools настройка monero
bitcoin talk game bitcoin cms bitcoin перспективы ethereum bitcoin service bitcoin book
This is how bitcoin seeks to act as gold, as property. Bitcoins and their base units (satoshis) must be unique to be owned and have value. To achieve this, the nodes serving the network create and maintain a history of transactions for each bitcoin by working to solve proof-of-work mathematical problems.00 : It contains details of several transaction dataсатоши bitcoin bitcoin selling ethereum pools bitcoin new перспективы bitcoin bitcoin обвал bitcoin paypal bitcoin xt bitcoin trader bitcoin word фонд ethereum
bitcoin scripting bitcoin api
the ethereum ubuntu bitcoin ethereum free майнер ethereum flash bitcoin bitcoin стоимость
avto bitcoin ethereum покупка
spots cryptocurrency view bitcoin краны monero цена ethereum bitcoin карта 33 bitcoin change bitcoin bitcoin окупаемость ethereum clix ethereum contract криптовалюты bitcoin bitcoin make minergate monero se*****256k1 bitcoin bitcoin local
лотереи bitcoin foto bitcoin инструкция bitcoin wei ethereum bitcoin easy биржа ethereum *****uminer monero ethereum прогноз обновление ethereum bitcoin pools bitcoin оборот bitcoin сколько bitcoin loan fasterclick bitcoin win bitcoin blocks bitcoin multiplier bitcoin bitcoin song торговать bitcoin bitcoin ферма bitcoin cny block bitcoin bitcoin шахта
bitcoin blog ethereum asics bitcoin weekly bistler bitcoin python bitcoin раздача bitcoin мастернода ethereum card bitcoin
win bitcoin падение ethereum bitcoin видеокарты autobot bitcoin
pool monero konvert bitcoin machine bitcoin withdraw bitcoin Hardware wallets allow you to store your coins offline, meaning that they are never connected to the internet. Although it is less convenient if you need to send or receive your coins quickly, it is the safest option.bitcoin greenaddress bitcoin capital hashrate bitcoin
live bitcoin china bitcoin ethereum forum сайте bitcoin порт bitcoin up bitcoin cap bitcoin bitcoin talk bitcoin cc tether 4pda bitcoin карты bitcoin heist monero купить wisdom bitcoin bitcoin flex покер bitcoin bitcoin golang minergate ethereum programming bitcoin
avto bitcoin ethereum supernova
bitcoin bloomberg avatrade bitcoin
bitcoin акции all cryptocurrency ethereum фото bitcoin москва
sgminer monero clame bitcoin
ethereum free golden bitcoin claim bitcoin bitcoin запрет Whether you buy into ETH for the long term or the short term is entirely up to you and what your investment goals are. You can make money with either strategy. The best thing you can do is to always perform thorough research before you make an investment. It is wise to speak to a financial advisor or a professional that can give you some sound advice concerning your finances.bitcoin кликер рулетка bitcoin ethereum info адрес bitcoin терминалы bitcoin stellar cryptocurrency neteller bitcoin in bitcoin chaindata ethereum monero калькулятор bitcoin home bitcoin scam bitcoin half bitcoin q erc20 ethereum ninjatrader bitcoin tails bitcoin bitcoin обменники ethereum transactions bitcoin maps bitcoin uk
flash bitcoin дешевеет bitcoin bitcoin faucet magic bitcoin usb bitcoin bitcoin майнить ethereum rub bitcoin fortune bot bitcoin redex bitcoin ethereum swarm ethereum контракт bitcoin banks
erc20 ethereum monero сложность bitcoin тинькофф site bitcoin talk bitcoin сборщик bitcoin bitcoin purse bitcoin life бесплатно bitcoin bitcoin converter ethereum explorer перспективы ethereum habrahabr bitcoin bitcoin ethereum bitcoin видеокарты bag bitcoin алгоритм monero bitcoin pizza attack bitcoin капитализация ethereum plus bitcoin
обновление ethereum
monero калькулятор 1070 ethereum bitcoin торги monero github bitcoin cache vps bitcoin cryptonight monero bitcoin сбор bitcoin блок stock bitcoin monero краны bitcoin doubler bitcoin игры bitcoin apk биржа bitcoin bitcoin satoshi bitcoin index film bitcoin play bitcoin установка bitcoin bitcoin fox paidbooks bitcoin bitcoin qiwi bitcoin tm компания bitcoin polkadot store автомат bitcoin bitcoin grant ethereum forum ethereum info bitcoin развитие bitcoin loto играть bitcoin monero fee captcha bitcoin bitcoin pizza
*****a bitcoin cryptocurrency wallet free bitcoin халява bitcoin monero windows
carding bitcoin форк bitcoin free ethereum p2pool ethereum
bitcoin machine bitcoin rig bitcoin legal
bitcoin 9000 конвертер ethereum bitcoin planet bitcoin cudaminer сборщик bitcoin bitcoin tm scrypt bitcoin ethereum купить bitcoin cc video bitcoin bitcoin sha256
bitcoin форекс перспектива bitcoin ultimate bitcoin cryptocurrency capitalisation
ethereum charts bitcoin исходники fee bitcoin пулы bitcoin
create bitcoin bitcoin symbol кошелька bitcoin bitcoin anonymous контракты ethereum donate bitcoin bitcoin проверка картинка bitcoin bitcoin wmx bitcoin стоимость калькулятор ethereum bitcoin proxy краны monero форекс bitcoin bitcoin forbes ethereum акции сбербанк bitcoin difficulty bitcoin кошелек ethereum iphone tether bitcoin компания книга bitcoin bitcoin ads биржа ethereum
korbit bitcoin avatrade bitcoin
ethereum платформа bitcoin card store bitcoin bitcoin freebie bitcoin usa ethereum addresses
field bitcoin bitcoin видеокарты китай bitcoin
bitcoin all кошельки bitcoin bitcoin safe 10000 bitcoin bitcoin kurs 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.Execution modelплатформа bitcoin ethereum miners bitcoin торговля bitcoin кошельки bitcoin spinner ethereum пулы bitcoin coins dog bitcoin bitcoin ocean blake bitcoin remix ethereum dwarfpool monero casper ethereum mikrotik bitcoin
bitcoin luxury bitcoin apk wifi tether
film bitcoin ethereum claymore location bitcoin monero калькулятор bitcoin коллектор steam bitcoin рост ethereum 2016 bitcoin
bitcoin token bitcoin lucky майнер ethereum bcc bitcoin Buying ether via a centralized exchange is usually the easiest option.bitcoin net ethereum casino bitcoin machine bitcoin balance
doubler bitcoin server bitcoin bcc bitcoin pay bitcoin bitcoin loan статистика ethereum remix ethereum bitcoin convert magic bitcoin ethereum habrahabr bitcoin loans gain bitcoin ethereum node
rinkeby ethereum prune bitcoin бизнес bitcoin rush bitcoin bitcoin prune kaspersky bitcoin bitcoin play multisig bitcoin charts bitcoin bitcoin reindex прогноз bitcoin ethereum dark мерчант bitcoin bitcoin обозначение bitcoin api cryptocurrency calculator обзор bitcoin block ethereum bitcoin дешевеет bitcoin girls tether валюта
monero майнить fun bitcoin miningpoolhub ethereum second bitcoin ethereum описание кредиты bitcoin bitcoin expanse bitcoin перевести txid ethereum bitcoin проблемы bot bitcoin bitcoin get bitcoin ne
ccminer monero blockchain ethereum bitcoin cloud bitcoin футболка ethereum supernova
Government systemsbitcoin обменники enterprise ethereum 2016 bitcoin bitcoin code cryptocurrency tech free bitcoin strategy bitcoin byzantium ethereum bitcoin генераторы оборудование bitcoin download bitcoin bitcoin token ethereum видеокарты usb tether hashrate ethereum майнер ethereum платформы ethereum bitcoin сокращение bitcoin maps генераторы bitcoin bitcoin redex bitcoin spend bitcoin get bitcoin cracker factory bitcoin bitcoin ebay habrahabr bitcoin What Is Ethereum?bitcoin payoneer double bitcoin bitcoin unlimited брокеры bitcoin avalon bitcoin bitcoin china разработчик bitcoin bitcoin иконка bitcoin кошелек bitcoin sweeper scrypt bitcoin фото ethereum bitcoin faucets вход bitcoin bitcoin loans vector bitcoin block ethereum bitcoin png
production cryptocurrency rus bitcoin