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 bitcoin луна
bitcoin history
заработок ethereum ethereum курс monero форум ethereum faucet ethereum отзывы
get bitcoin
accepts bitcoin bitcoin invest dat bitcoin
bitcoin kran cryptocurrency trading dag ethereum
dog bitcoin
bitcoin фарминг mini bitcoin mt4 bitcoin bitcoin миксер bitcoin information
iso bitcoin ethereum coins agario bitcoin
carding bitcoin talk bitcoin business bitcoin iota cryptocurrency withdraw bitcoin bitcoin sphere cpa bitcoin iso bitcoin casinos bitcoin bitcoin трейдинг
fasterclick bitcoin difficulty ethereum перспективы ethereum bitcoin расшифровка statistics bitcoin компания bitcoin blog bitcoin bitcoin bazar бутерин ethereum view bitcoin проверить bitcoin ethereum org кран monero bitcoin wmx bitcoin store flappy bitcoin bitcoin world bitcoin today film bitcoin
иконка bitcoin куплю ethereum hd7850 monero брокеры bitcoin amd bitcoin курс ethereum trust bitcoin monero вывод bitcoin hashrate bitcoin compare bitcoin antminer win bitcoin ethereum serpent stratum ethereum bitcoin cryptocurrency bitcoin client monero address 'яндекс bitcoin
криптовалюта tether bitcoin трейдинг bitcoin weekend
bitcoin валюты
etherium bitcoin bitcoin laundering blocks bitcoin poloniex ethereum ethereum видеокарты bitcoin кредиты проект ethereum algorithm bitcoin bitcoin футболка количество bitcoin get bitcoin payoneer bitcoin coin bitcoin bitcoin сайт bitcoin transaction bitcoin global bitcoin dynamics ecopayz bitcoin system bitcoin bitcoin расшифровка бизнес bitcoin ethereum chart cryptocurrency calendar tether apk bitcoin будущее my ethereum monero blockchain bitcoin ocean withdraw bitcoin sec bitcoin ethereum coingecko monero coin roboforex bitcoin blogspot bitcoin bitcoin super bitcoin habrahabr bitcoin friday
vector bitcoin bitcoin 99 1070 ethereum login bitcoin remix ethereum fork bitcoin bitcoin шифрование ethereum кошельки
bitcoin india bitcoin client
cryptocurrency exchanges bitcoin деньги алгоритм monero bitcoin nedir перспективы ethereum википедия ethereum bitcoin 0 bitcoin forums bitcoin exchanges master bitcoin торрент bitcoin ethereum info claim bitcoin ethereum twitter ethereum видеокарты bitcoin рубль ethereum настройка
get bitcoin платформа bitcoin bitcoin генератор
bitcoin instaforex
портал bitcoin boom bitcoin bitcoin майнить майнинга bitcoin бесплатные bitcoin описание bitcoin kong bitcoin faucet cryptocurrency ethereum ann cryptocurrency calculator faucet bitcoin tx bitcoin bitcoin generation bitcoin валюта bitcoin биржа ethereum news fake bitcoin How this digital currency works and why it's so controversialкошелька bitcoin разработчик bitcoin equihash bitcoin ethereum blockchain mastering bitcoin plus500 bitcoin total cryptocurrency bitcoin партнерка bitcoin goldmine bitcointalk ethereum
bitcoin q bitcoin перевод
создать bitcoin dance bitcoin арестован bitcoin bitcoin суть bitcoin экспресс playstation bitcoin bitcoin автоматически ethereum сбербанк visa bitcoin moneypolo bitcoin
торги bitcoin смесители bitcoin bitcoin выиграть
bitcoin lion takara bitcoin ethereum casper bitcoin 100 ann monero bitcoin заработок bitcoin список flash bitcoin polkadot ethereum online global bitcoin bitcoin ads bitcoin мошенничество blake bitcoin bank cryptocurrency портал bitcoin avatrade bitcoin ethereum contracts ethereum сложность bitcoin mainer bitcoin forums bitcoin bloomberg alpha bitcoin bitcoin приложение bitcoin film bitcoin talk auction bitcoin bitcoin count accepts bitcoin
краны monero bitcoin poloniex Like I said a moment ago, smart contracts are just code. This is the same for tokens. Figuring out how to create a cryptocurrency also includes figuring out the safety of it. So, for a user to trust the code, they need to know it is secure. This is why you need a professional audit.bitcoin earn Ticker symbolXMRbitcoin seed
зарабатывать ethereum
matteo monero tether android bitcoin key пузырь bitcoin mist ethereum block bitcoin bonus bitcoin
moto bitcoin bitcoin daily bitcoin multisig ethereum новости чат bitcoin fire bitcoin история ethereum лото bitcoin generate bitcoin мастернода bitcoin rx470 monero bitcoin talk
ethereum хардфорк робот bitcoin ubuntu ethereum bitcoin обменять bitcoin лучшие bitcoin favicon cryptocurrency ico purse bitcoin форумы bitcoin bitcoin forex
bitcoin reddit bitcoin gift reddit bitcoin котировка bitcoin wei ethereum ethereum swarm bitcoin котировка взлом bitcoin Bitcoin’s use case as a currency for developing countries that are currently experiencing high inflation is valuable when considering the volatility of bitcoin in these economies versus the volatility of bitcoin in USD. Bitcoin is much more volatile versus USD than the high-inflation Argentine peso versus the USD. bitcoin location qiwi bitcoin monero хардфорк
mikrotik bitcoin tether валюта bitcoin блокчейн ethereum news apk tether bitcoin автоматически нода ethereum
bitcoin q fast bitcoin polkadot su lamborghini bitcoin фото bitcoin bitcoin store bitcoin пул ethereum bitcointalk суть bitcoin bubble bitcoin network bitcoin ethereum получить ethereum parity расчет bitcoin 5 bitcoin курса ethereum free ethereum bitcoin map adbc bitcoin
doubler bitcoin When the blockchain and its community of volunteers are able to solve the algorithmic puzzle, the rules of cryptography state that a transaction is valid and authentic. However, different blockchains use different methods to solve the puzzle, which is known as a 'consensus mechanism'.bitcoin основы coingecko bitcoin
wiki ethereum monero coin сервера bitcoin bitcoin easy market bitcoin анализ bitcoin bitcoin котировка british bitcoin film bitcoin валюта bitcoin bitcoin китай excel bitcoin bitcoin 2x ethereum pools wirex bitcoin
checker bitcoin bitcoin client bitcoin etherium пул bitcoin bitcoin статья 2016 bitcoin bitcoin окупаемость bitcoin japan bitcoin loan шрифт bitcoin bitcoin bitrix bitcoin central bitcoin войти ethereum info tether bitcointalk short bitcoin bitcoin map fake bitcoin usb tether tether приложения bitcoin clicks
bitcoin trinity bitcoin change cryptocurrency prices bitcoin conf
bitcoin exchange Bitcoin as a credible store of value. For better or worse, this volatility may be inherent tocryptocurrency wikipedia rbc bitcoin store bitcoin map bitcoin bitcoin create python bitcoin bitcoin динамика rate bitcoin отзывы ethereum bitcoin ebay фильм bitcoin metropolis ethereum monero bitcoin получить love bitcoin
bitcoin википедия логотип bitcoin bitcoin aliexpress курс ethereum cryptocurrency trading ethereum обвал покер bitcoin tether mining подтверждение bitcoin bitcoin хабрахабр bitcoin skrill 4 bitcoin bitcoin elena bitcoin valet tether addon bitcoin лопнет bitcoin сложность bitcoin блоки bitcoin fpga bitcoin darkcoin bitcoin чат bitcoin аналитика новости bitcoin bitcoin converter bitcoin mt4 bitcoin fox daemon monero
qiwi bitcoin bitcoin rotator ethereum node tether программа ethereum solidity bitcoin оборот история bitcoin bitcoin paper bitcoin wm mixer bitcoin monero калькулятор bitcoin компьютер Possibility of a hard fork is reduced significantlyконвертер ethereum field bitcoin ethereum solidity bitcoin pdf bitcoin china заработать bitcoin bitcoin gif bitcoin пулы
bitcoin вывод dark bitcoin chaindata ethereum bitcoin мошенничество today bitcoin
bitcoin stealer bitcoin вконтакте bitcoin trading monero криптовалюта delphi bitcoin bitcoin oil bitcoin баланс ethereum forum
bitcoin сервера ethereum debian ethereum os bitcoin ключи контракты ethereum transaction bitcoin mail bitcoin часы bitcoin flypool monero top bitcoin miner monero cpa bitcoin
bitcoin машины minergate bitcoin monero nvidia topfan bitcoin bitcoin crash bitcoin транзакция
bitcoin valet
ethereum скачать bitcoin script get bitcoin doge bitcoin ethereum кошельки биржи monero currency bitcoin bitcoin litecoin ethereum обвал
cryptocurrency trading cryptocurrency magazine miner bitcoin 1070 ethereum bitcoin сигналы ethereum solidity bitcointalk monero bitcoin kran ico ethereum ethereum myetherwallet
bitcoin котировки bitcoin script
оборудование bitcoin ethereum метрополис майн bitcoin testnet ethereum bitcoin 9000 bitcoin картинки майнинг tether bitcoin dollar salt bitcoin новости bitcoin widget bitcoin bitcoin fan coin bitcoin bitcoin оборудование the ethereum erc20 ethereum monero logo okpay bitcoin bitcoin start майнинг monero bitcoin пополнить
bitcoin today Treating your users as co-developers is your least-hassle route to rapid code improvement and effective debugging.bitcoin steam bitcoin xt tether обзор monero client mixer bitcoin bitcoin mainer пицца bitcoin home bitcoin платформе ethereum
bitcoin lucky direct bitcoin отзыв bitcoin bitcoin elena
bitcoin widget
konvertor bitcoin
кости bitcoin book bitcoin monero core security bitcoin клиент bitcoin bitcoin today monero курс ethereum fork калькулятор ethereum bitcoin биржи monero amd
monero майнить armory bitcoin apk tether bitcoin people
обзор bitcoin bitcoin information difficulty ethereum bitcoin atm кредиты bitcoin bitcoin novosti
bitcoin кэш ethereum pools bitcoin testnet комиссия bitcoin bitcoin проект bitcoin hyip community bitcoin биржи ethereum bitcoin earnings bitcoin rotator ios bitcoin bitcoin monkey значок bitcoin биржи ethereum bitcoin database captcha bitcoin
вклады bitcoin bitcoin получить 123 bitcoin bitcoin compromised bitcoin blue bitcoin drip программа ethereum вики bitcoin bitcoin sportsbook (TMFUltraLong)joker bitcoin
bitcoin prune
bitcoin earnings ethereum frontier bitcoin plugin разработчик ethereum bittrex bitcoin iobit bitcoin
monero кошелек black bitcoin cronox bitcoin bitcoin it bitcoin red byzantium ethereum bitcoin ставки кости bitcoin
платформы ethereum новости ethereum etoro bitcoin верификация tether bitcoin cryptocurrency bitcoin сигналы monero стоимость bitcoin youtube apple bitcoin установка bitcoin bitcoin seed The bitcoin scalability problem is the limited rate at which the bitcoin network can process transactions. It is related to the fact that records (known as blocks) in the bitcoin blockchain are limited in size and frequency.doge bitcoin bitcoin get fx bitcoin ethereum poloniex monero 1070 майнинг ethereum bitcoin фермы bitcoin сервера
protocol bitcoin telegram bitcoin дешевеет bitcoin bitcoin bat
cubits bitcoin bitcoin png ethereum аналитика vpn bitcoin bitcoin mmm bitcoin fund bitcoin script транзакции bitcoin bitcoin symbol ethereum russia bitcoin прогноз bitcoin обозначение ethereum bitcoin buy monero криптовалюта bitcoin zona it bitcoin 2 bitcoin bitcoin golden doge bitcoin ethereum хешрейт bitcoin get byzantium ethereum bitcoin video яндекс bitcoin cryptocurrency ethereum news bitcoin сокращение генераторы bitcoin de bitcoin usb tether exchange bitcoin bitcoin зарегистрировать транзакции bitcoin bitcoin компания bitcoin eth ads bitcoin live bitcoin bitcoin system bitcoin journal сложность monero bitcoin trust bitcoin обменять bitcoin система bitcoin sec chaindata ethereum bitcoin com bitcoin jp DAG (Directed Acyclic Graph)Well, Initial Coin Offerings (ICOs) are very similar. ICOs are how blockchain-savvy companies raise funds for their crypto projects. But instead of the investors buying shares, they receive 'tokens'.This is the least common way to buy Bitcoin. There are not many Bitcoin ATMs in the world, so you will have to use this map to see if there is one near you. If there is, you can go to it and buy your Bitcoin using cash, but the fees are expensive — 5-10%.bitcoin air bitcoin buy
bubble bitcoin депозит bitcoin bitcoin anonymous bitcoin график bitcoin signals Each time a cryptocurrency transaction is made, a cryptocurrency miner is responsible for ensuring the authenticity of information and updating the blockchain with the transaction. The mining process itself involves competing with other cryptominers to solve complicated mathematical problems with cryptographic hash functions that are associated with a block containing the transaction data.digi bitcoin mining bitcoin контракты ethereum cronox bitcoin ethereum russia bitcoin london froggy bitcoin bitcoin puzzle разработчик bitcoin ethereum ethash lite bitcoin bitcoin plus bitcoin ann кликер bitcoin app bitcoin
22 bitcoin server bitcoin bitcoin xyz bitcoin banks ethereum plasma monero hardware основатель bitcoin 3 bitcoin bitcoin bow bitcoin 2000 bitcoin pdf bitcoin проверка bitcoin telegram monero client bitcoin satoshi майнинга bitcoin bitcoin презентация forum ethereum cryptocurrency wallet кредиты bitcoin bitcoin oil
mixer bitcoin bitcoin blog love bitcoin мастернода ethereum bitcoin adress майнеры monero bitcoin pps бутерин ethereum bitcoin bcc digi bitcoin доходность bitcoin пожертвование bitcoin bitcoin получить bitcoin обозреватель bitcoin development майн bitcoin rx470 monero fx bitcoin bitcoin services magic bitcoin
crococoin bitcoin ethereum проблемы bitcoin тинькофф etoro bitcoin bitcoin cryptocurrency bitcoin luxury
mine ethereum лотереи bitcoin нода ethereum ico cryptocurrency bitcoin fees bitcoin community iso bitcoin electrum ethereum bitcoin картинка криптовалют ethereum claymore monero bitcoin reserve калькулятор bitcoin bitcoin flip pro100business bitcoin кошельки bitcoin команды bitcoin coinbase ethereum bitcoin msigna будущее bitcoin san bitcoin пополнить bitcoin ltd bitcoin monero fee bitcoin land accelerator bitcoin bitcoin community платформа bitcoin
блокчейн ethereum bitcoin шахта bitcoin it monero стоимость ethereum обменять bitcoin инструкция почему bitcoin tether верификация котировка bitcoin cryptocurrency tech ethereum ico ethereum прибыльность
вывод bitcoin bitcoin get ethereum studio обменять bitcoin bitcoin bitrix Ether is highly liquid (its trading volume is $2.4m in the last 24 hours);ethereum gold steam bitcoin an account with a reputable Bitcoin exchange. The process of opening annetwork bitcoin
bitcoin frog 6000 bitcoin hacking bitcoin форки bitcoin bitcoin script genesis bitcoin ethereum платформа
bitcoin arbitrage bitcoin project автомат bitcoin cardano cryptocurrency
bitcoin analysis monero bitcointalk bitcoin fund zcash bitcoin
bitcoin knots котировки ethereum Ключевое слово aml bitcoin
bitcoin алгоритм rx470 monero bitcoin doge карты bitcoin bitcoin трейдинг
python bitcoin auction bitcoin rise cryptocurrency
bitcoin fan bitcoin сеть bitcoin комиссия mine ethereum ethereum api bitcoin bittorrent
платформу ethereum nicehash bitcoin ethereum кран
collector bitcoin ethereum ротаторы bitcoin capital Economic Argument 1time bitcoin Kazaa has suffered from its own legal troubles, but various other systems, like eDonkey / Overnet, have continued the legacy of free P2P file-sharing software.ethereum валюта