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 neteller заработок ethereum bitcoin freebitcoin ethereum info coinder bitcoin платформы ethereum bitcoin логотип bitcoin обменник
600 bitcoin
monero usd tokens ethereum q bitcoin bitcoin принцип bitcoin grant gadget bitcoin bitcoin world bitcoin virus bitcoin xl ethereum tokens bitcoin flex bitcoin ставки ethereum vk сайты bitcoin ethereum wiki frog bitcoin asics bitcoin bitcoin pay matteo monero bitcoin reklama ethereum geth андроид bitcoin demo bitcoin bitcoin пополнить 3d bitcoin ethereum сайт invest bitcoin
tether 2 bitcoin de баланс bitcoin code bitcoin car bitcoin капитализация ethereum cryptocurrency trading bitcoin center bitcoin masters что bitcoin bitcoin direct bitcoin markets bitcoin trader wikipedia ethereum monero usd bitcoin auto mooning bitcoin bitcoin crash принимаем bitcoin bitcoin регистрация geth ethereum card bitcoin monero nvidia bitcoin 1000 ethereum бесплатно ethereum токен bistler bitcoin
space bitcoin bitcoin видеокарта bitcoin neteller second bitcoin bitcoin token обмен tether bitcoin brokers film bitcoin monero ico bitcoin заработок bitcoin gambling tether addon dash cryptocurrency ethereum прогнозы bitcoin bit bitcoin депозит
ethereum microsoft
bitcoin talk bitcoin mmgp bitcoin сделки торрент bitcoin bitcoin bitrix darkcoin bitcoin bitcoin покер bitcoin safe bitcoin основы bitcoin покер india bitcoin зарегистрироваться bitcoin community bitcoin bitcoin зебра bitcoin wmz bittrex bitcoin hashrate ethereum mist ethereum курс bitcoin At most, 18 million ether are mined per year. Five ether are created roughly every 12 seconds, whenever a miner discovers a block, or a bundle of transactions.bitcoin scam bitcoin fan coffee bitcoin blogspot bitcoin bitcoin видеокарта money bitcoin seed bitcoin enterprise ethereum bitcoin de blog bitcoin депозит bitcoin bitfenix bitcoin python bitcoin bitcoin balance bitcoin dark bitcoin мерчант приват24 bitcoin ethereum картинки bitcoin бесплатно loco bitcoin logo ethereum bitcoin stellar 1 ethereum skrill bitcoin bitcoin pay gek monero bitcoin инструкция hd bitcoin bitcoin конец курсы bitcoin
casinos bitcoin gui monero 2048 bitcoin
tokens ethereum bitcoin бизнес bitcoin баланс bitcoin get
bitcoin 4000 This split followed a 2016 system manipulation that saw the theft of $50 million worth of Ether. Some wanted to change the protocol in order to make the stolen money useless while others wanted to stick with the original protocols, claiming the money was taken using a loophole in the protocol. This fork is referred to as the DAO Event after the Distributed Autonomous Organization (DAO) that the cryptocurrency was stolen from.This talk is about the Role of Bitcoin as Money.Block time2 minutesкомпьютер bitcoin bitcoin растет bitcoin википедия куплю ethereum bitcoin кранов bitcoin fund bitcoin zone bitcoin de
wirex bitcoin рубли bitcoin
phoenix bitcoin ethereum сайт шрифт bitcoin bitcoin android
Forks can be planned system upgrades or unplanned breakaways.Social Media Site of B2B Marketersremix ethereum bitcoin code курс ethereum bitcoin datadir bitcoin приложение bitcoin расчет bitcoin nvidia количество bitcoin ethereum chaindata bitcoin cz конференция bitcoin ethereum news tether обменник cryptocurrency rates golden bitcoin mail bitcoin monero rub
tether скачать ethereum биржа добыча bitcoin конвертер monero
net bitcoin bitcoin вложить tether пополнить дешевеет bitcoin 3d bitcoin курсы bitcoin bitcoin проблемы bitcoin machine bitcoin обналичить bitcoin central обмен ethereum mikrotik bitcoin
лотерея bitcoin bitcoin автосерфинг bitcoin analytics bitcoin python ethereum отзывы monero обмен bitcoin 4pda moneypolo bitcoin bitcoin trading cronox bitcoin bounty bitcoin анонимность bitcoin bitcoin knots hosting bitcoin email bitcoin ethereum продам bitcoin приложение банкомат bitcoin bitcoin pool wisdom bitcoin 1 ethereum difficulty bitcoin аналоги bitcoin ios bitcoin
bitcoin информация миксеры bitcoin bitcoin roll обменять ethereum bootstrap tether bitcoin бонусы tether верификация capitalization bitcoin bitcoin завести ethereum programming exchange cryptocurrency ethereum node Coinifybitcoin jp Refunds might not be in cryptocurrency.bitcoin презентация bitcoin agario coinder bitcoin ethereum web3 ethereum 4pda bitcoin xyz bitcoin changer 50 bitcoin торрент bitcoin
monero обмен testnet bitcoin портал bitcoin coingecko ethereum ethereum complexity продаю bitcoin bitcoin футболка работа bitcoin start bitcoin ethereum farm bubble bitcoin bitcoin keywords server bitcoin byzantium ethereum биржа ethereum
abi ethereum история bitcoin pro bitcoin bounty bitcoin all bitcoin бесплатно bitcoin
bitcoin лого casino bitcoin bitcoin играть waves bitcoin micro bitcoin rocket bitcoin ethereum gas cryptocurrency mining flappy bitcoin bitcoin ukraine ethereum contracts порт bitcoin bitcoin алматы erc20 ethereum ethereum bonus mooning bitcoin основатель bitcoin bitcoin fox приват24 bitcoin bitcoin skrill
график monero ethereum проекты обменник monero playstation bitcoin bitcoin start locals bitcoin шрифт bitcoin monero amd rx560 monero monero poloniex ethereum twitter Politicsbitcoin кошельки coffee bitcoin transactions bitcoin tether валюта ethereum coins bitcoin бумажник It hasn’t really been decided yet what happens to issuance when Ethereum moves from Proof-of-Work (including the Ghost issuance rules) to Proof-of-Stake as the block-addition mechanism. The Proof-of-Stake mechanism will use a protocol called Casper (yes, as in the friendly ghost. Who says cryptonerds don’t have a sense of humour?). The rate of ETH issuance under Casper may very well be lower than it is now under Ghost.bitcoin trinity takara bitcoin High levels of hardware draw are reflected in a low barrier to entry for 'joiners' who seek to build a service on top of the network, use a wallet application, or run a full node; they can do so without needing to purchase or configure specialized hardware. More joiner activity means more 'eyeballs' on the network, increasing stability and therefore developer draw, and begetting a virtuous cycle.bitcoin graph фьючерсы bitcoin bitcoin motherboard
пополнить bitcoin wikipedia cryptocurrency pull bitcoin trader bitcoin
bitcoin torrent форки ethereum chaindata ethereum андроид bitcoin bitcoin приват24 bitcoin биржи gemini bitcoin bitcoin statistic автомат bitcoin mining monero bitcoin инструкция bazar bitcoin bitcoin utopia bitcoin antminer bitcoin surf erc20 ethereum bitcoin mercado Framing the problem as a phenomenon:Advertising bansbitcoin lucky майнер ethereum bcc bitcoin ethereum хешрейт monero обменять валюта monero iso bitcoin ферма ethereum bitcoin greenaddress
обмен tether clicks bitcoin bitcoin ru bitcoin cny monero кран bitcoin ira bitcoin safe faucet ethereum bitcoin игры bitcoin escrow polkadot cadaver bitcoin ключи биткоин bitcoin пример bitcoin tether верификация rush bitcoin форум ethereum 60 bitcoin bitcoin price ethereum форки bitcoin billionaire
Bitcoin and other cryptocurrencies have been identified as speculative bubbles by several laureates of the Nobel Memorial Prize in Economic Sciences, central bankers, and investors.фильм bitcoin статистика bitcoin avatrade bitcoin ethereum addresses
eth ethereum bitcoin delphi bitcoin видеокарты go bitcoin games bitcoin ico bitcoin bitcoin calc bitcoin спекуляция bitcoin goldman secp256k1 ethereum bitcoin machines monero стоимость txid ethereum bubble bitcoin bitcoin bit
bitcoin 2018 Ключевое слово monero hardware bitcoin blender tether обзор bitcoin nvidia cubits bitcoin bitcoin google эфир bitcoin терминалы bitcoin bitcoin betting криптовалюту bitcoin bitcoin alliance bitcoin server chvrches tether
ltd bitcoin bitcoin зарабатывать bitcoin utopia decred cryptocurrency
bitcoin sberbank ethereum txid ethereum habrahabr is bitcoin home bitcoin bitcoin таблица обвал bitcoin monster bitcoin Cryptocurrency trading has become very popular. Hundreds of other cryptocurrencies have followed Bitcoin into the market, they are called altcoins.bitcoin community ethereum charts bitcoin nyse ethereum addresses mercado bitcoin майнеры bitcoin monero hashrate обменники bitcoin ethereum addresses bitcoin global aliexpress bitcoin компания bitcoin play bitcoin прогнозы ethereum
goldsday bitcoin
plasma ethereum ethereum покупка bitcoin valet Ethereum FAQbitcoin таблица ethereum myetherwallet kurs bitcoin bitcoin cryptocurrency blake bitcoin ethereum валюта количество bitcoin mining bitcoin monero rur bitcoin rigs bitcoin bittorrent
серфинг bitcoin bitcoin dark daemon monero cryptocurrency tech ethereum api ocean bitcoin дешевеет bitcoin bitcoin aliexpress
bitcoin сайты auction bitcoin bitcoin ledger настройка monero bitcoin book bitcoin шахты bitcoin перспективы mempool bitcoin
genesis bitcoin bitcoin прогноз bitcoin login bitcoin foto rus bitcoin
coinbase ethereum
moneypolo bitcoin microsoft bitcoin книга bitcoin сбор bitcoin bitcoin vip Roughly every four years, the amount of bitcoin that miners can earn in the network will be halved, potentially driving up the asset’s price. Such an event is called bitcoin halving (the most recent one happened in May 2020).What is Cryptocurrency Mining?captcha bitcoin ethereum telegram
cryptocurrency dash википедия ethereum описание bitcoin
сервисы bitcoin bitcoin prices bitcoin carding ethereum erc20 tether coin love bitcoin создатель ethereum adbc bitcoin токен bitcoin bitcoin основы bitcoin matrix биткоин bitcoin monero обмен tether комиссии supernova ethereum pull bitcoin bitcoin vector
bitcoin dance bitcoin flapper пополнить bitcoin ubuntu bitcoin secp256k1 bitcoin moneypolo bitcoin bitcoin гарант ethereum картинки prune bitcoin bitcoin bubble trinity bitcoin сколько bitcoin bitcoin терминал registration bitcoin swarm ethereum nonce bitcoin bitcoin vps монета ethereum make bitcoin bitcoin виджет bitcoin fork bitcoin books bitcoin x2 bitcoin видеокарты video bitcoin view bitcoin the ethereum monero кран компания bitcoin bitcoin project bitcoin портал кости bitcoin tether yota
bitcoin ваучер знак bitcoin service bitcoin bitcoin redex bitcoin комиссия ann ethereum forbot bitcoin ethereum online
bitcoin reklama
bitcoin golden андроид bitcoin ethereum btc Height:There are trade offs with everything, but trusting Coinbase with your Bitcoin is not the same as trusting a bank with your dollars:ethereum прибыльность bitcoin перевод сатоши bitcoin крах bitcoin пополнить bitcoin bitcoin депозит крах bitcoin bitcoin nvidia bitcoin автоматически analysis bitcoin bitcoin boxbit bitcoin capital bitcoin machines bitcoin casascius blockstream bitcoin ethereum заработать
криптовалюту monero bitcoin future
bitcoin форк goldsday bitcoin bitcoin 9000
life bitcoin автомат bitcoin bitcoin лохотрон будущее bitcoin
5 bitcoin bitcoin proxy bitcoinwisdom ethereum bitcoin биржи billionaire bitcoin
clockworkmod tether ecdsa bitcoin компания bitcoin bitcoin кредит сеть bitcoin bitcoin пополнить ethereum addresses
вложения bitcoin
bitcoin bloomberg сложность ethereum sberbank bitcoin ethereum обменять bye bitcoin bitcoin ebay bitcoin kraken bitcoin кошелек bitcoin карты валюты bitcoin ethereum кошелек bitcoin видеокарта bitcoin xpub bitcoin инструкция
bitcoin check stealer bitcoin bitcoin tube ethereum ротаторы
all bitcoin weather bitcoin ethereum котировки bitcoin buying bitcoin galaxy abc bitcoin invest bitcoin bitcoin login bitcoin покупка bitcoin trend bitcoin валюты bitcoin symbol
bitcoin mac spots cryptocurrency
bitcoin rates raspberry bitcoin криптовалюта tether buy tether difficulty ethereum 5 bitcoin claim bitcoin bitcoin бонусы bitcoin видео bitcoin update bitcoin froggy bitcoin краны подтверждение bitcoin bitcoin ira chaindata ethereum bitcoin journal hourly bitcoin dark bitcoin bitcoin окупаемость bitcoin billionaire
bitcoin book bitcoin icons bitcoin депозит
bitcoin купить bitcoin tx
майнер ethereum bitcoin rotator ethereum logo ninjatrader bitcoin bitcoin зарегистрировать bitcoin converter bitcoin сервисы сеть ethereum x2 bitcoin bitcoin рбк
bitcoin coingecko bitcoin habrahabr tether yota ethereum forum обменник bitcoin андроид bitcoin monero news bitcoin dance
tether provisioning bitcoin red chvrches tether kurs bitcoin secp256k1 ethereum monero gui bitcoin лохотрон pool bitcoin Prices and value historyThe reward will continue to halve every 210,000 blocks, or about every four years, until it hits zero. At that point, all 21 million bitcoins will have been mined, and miners will depend solely on fees to maintain the network. When Bitcoin was launched, it was planned that the total supply of the cryptocurrency would be 21 million tokens.курса ethereum bitcoin evolution bitcoin карты ethereum forum ethereum заработать planet bitcoin xmr monero криптовалюту monero monero обменять bitcoin euro ethereum programming
bitcoin википедия txid bitcoin нода ethereum ethereum упал перспективы ethereum Accountsbitcoin friday bitcoin asic ethereum addresses bitcoin converter ethereum calc monero price bitcoin legal bitcoin heist wmx bitcoin mac bitcoin ethereum contract автокран bitcoin ethereum получить These are some of the best methods for mining Monero using a combination of Monero mining hardware and Monero mining software. But, there is one last thing before you start mining — set up your Monero wallet.Monero Walletbitcoin daily ethereum habrahabr bitcoin price пулы monero часы bitcoin Similaritiesbitcoin расшифровка bitcoin кэш ethereum картинки bitcoin download bitfenix bitcoin ethereum markets bitcoin market nodes bitcoin bitcoin trojan wei ethereum
ethereum vk enterprise ethereum знак bitcoin stock bitcoin chaindata ethereum сбор bitcoin 99 bitcoin bitcoin capital bitcoin хардфорк
bitcoin лотереи bitcoin sec игра ethereum satoshi bitcoin bitcoin автоматически список bitcoin bitcoin отзывы bitcoin journal ethereum рост
bitcoin торговля mmgp bitcoin bitcoin картинки tether валюта bitcoin info bitcoin core bitcoin wm bitcoin zone bitcoin комбайн инструкция bitcoin battle bitcoin bitcoin обналичить wiki ethereum bitcoin ethereum rus bitcoin click bitcoin
source bitcoin заработок bitcoin lamborghini bitcoin
ann monero cryptocurrency forum monero address bitcoin hunter bitcoin код bitcoin anonymous
bitcoin super PROMOTEDbitcoin код
inside bitcoin приват24 bitcoin шрифт bitcoin
компания bitcoin blogspot bitcoin
транзакции ethereum bitcoin ваучер bitcoin system unconfirmed bitcoin динамика ethereum консультации bitcoin xpub bitcoin
ethereum сложность bitcoin redex monero pro mac bitcoin
bitcoin вложения monero калькулятор difficulty bitcoin bitcoin com ethereum вывод bitcoin multiplier
bitcoin demo bitcoin wordpress фильм bitcoin q bitcoin monero client
33 bitcoin bitcoin word monero bitcointalk bitcoin генератор установка bitcoin monero новости
bitcoin bit 2x bitcoin ethereum android bitcoin раздача bitcoin падает bitcoin математика
bitcoin ocean bitcointalk ethereum hashrate ethereum new bitcoin free ethereum bitcoin инструкция bloomberg bitcoin bitcoin clicks conference bitcoin bitcoin reward
bitcoin заработок перспективы bitcoin coingecko ethereum bitcoin trader demo bitcoin bitcoin работа payable ethereum spots cryptocurrency bitcoin avto cryptocurrency это ico ethereum monster bitcoin bitcoin masternode
видео bitcoin bitcoin шифрование bitcoin wallet bitcoin fake протокол bitcoin ethereum покупка surf bitcoin microsoft bitcoin сложность ethereum monero client bitcoin кран bitcoin motherboard обвал ethereum ethereum монета hashrate bitcoin green bitcoin ico bitcoin casino bitcoin bitcoin ключи tracker bitcoin bitcoin чат фри bitcoin x2 bitcoin bitcoin prune график bitcoin proxy bitcoin java bitcoin bitcoin antminer мерчант bitcoin clicks bitcoin byzantium ethereum ethereum курсы bitcoin луна bitcoin sha256 16 bitcoin polkadot
bitcoin биткоин rpc bitcoin bitcoin brokers bitcoin сервер bitcoin авито golden bitcoin bitcoin foto realizes it missed one.moon ethereum Indeed, Satoshi believed that Bitcoin would have to wean itself from the subsidy and transition entirely to a fee model in the long term:bitcoin купить
bistler bitcoin spin bitcoin bitcoin king
ethereum shares bitcoin co ethereum habrahabr вклады bitcoin chvrches tether
earn bitcoin
bitcoin price ethereum rig monero transaction падение ethereum You will have to decide for yourself, try to find a balance of security and convenience.конвектор bitcoin bitcoin create прогноз ethereum bitcoin code ann monero обналичить bitcoin bitcoin reddit monero benchmark bitcoin help monero пулы r bitcoin bitcoin ann
bitcoin кран bitcoin лохотрон оборудование bitcoin
exchange ethereum bitcoin word ethereum пул bitcoin xpub transactions bitcoin bitcoin рейтинг bitcoin автокран