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.
Fungibilitygemini bitcoin токены ethereum testnet bitcoin bitcoin лопнет monero dwarfpool film bitcoin foto bitcoin san bitcoin настройка monero monero cryptonight game bitcoin bitcoin комментарии аналоги bitcoin bitcoin минфин
email bitcoin
bitcoin evolution explorer ethereum xpub bitcoin
bitcoin продам monero hardware bitcoin grafik курс tether
bitcoin blockchain bitcoin block ethereum майнить ethereum валюта cz bitcoin сша bitcoin bitcoin обозреватель технология bitcoin калькулятор monero habrahabr bitcoin бесплатно ethereum
bitcoin yandex
life bitcoin bitcoin evolution The Value of Bitcoin as an Assetkorbit bitcoin
bitcoin 1070 ethereum supernova ethereum игра
платформе ethereum вики bitcoin car bitcoin china bitcoin купить tether abi ethereum code bitcoin addnode bitcoin bitcoin математика bitcoin cc tether программа etoro bitcoin bitcoin покупка
cran bitcoin Supports more than 1,100 cryptocurrenciesbitcoin автоматический ethereum casino bcc bitcoin
alpari bitcoin краны monero инструкция bitcoin ethereum forum bitcoin project mini bitcoin
ethereum russia nicehash ethereum ethereum raiden bitcoin investment bitcoin scanner blender bitcoin bitcoin etf ethereum википедия вывод monero bitcoin вход ethereum описание bitcoin flapper зарегистрироваться bitcoin birds bitcoin bitcoin motherboard
pool monero bitcoin telegram investment bitcoin bitcoin серфинг Bitcoin Cash is a hard fork of bitcoin increasing the maximum block size. Bitcoin XT, Bitcoin Classic and Bitcoin Unlimited each supported an increase to the maximum block size. On 1 August 2017, the day when BTC forked, the BTC blockchain split into two separate blockchains: one maintained in accordance with the rules currently valid for BTC, and the other maintained in accordance with the rules currently valid for BCH. If one had coins on the BTC chain prior to the fork and has not yet moved them, one could move them on one or the other or both chains. Thus, all holders of BTC also became holders of BCH at the split time. Henceforth BTC and BCH are separate and trade at entirely independent valuations relative to each other, fiat currencies, and other assets.lightning bitcoin fork bitcoin rinkeby ethereum bitcoin agario приложение tether bitcoin kraken mainer bitcoin bitcoin 4096 bitcoin minecraft bitcoin автомат bitcoin capitalization daemon bitcoin ledger bitcoin ethereum coin ethereum форки википедия ethereum bitcoin обозначение earn bitcoin бизнес bitcoin Litecoin as a future toolbitcoin microsoft best cryptocurrency bitcoin 5 bitcoin lurk bitcoin расчет x2 bitcoin
bitcoin бесплатные unconfirmed monero bitcoin fpga
bitcoin surf bitcoin bitcointalk rub bitcoin биржи bitcoin bitcoin описание cryptocurrency gold
bitcoin пулы analysis bitcoin ethereum доходность
capitalization bitcoin bitcoin пирамиды robot bitcoin home bitcoin bitcoin novosti ethereum icon de bitcoin bitcoin co bitcoin purse cfd bitcoin ethereum forks
bitcoin депозит bitcoin аналитика ethereum fork bitcoin видеокарты bitcoin терминал bitcoin withdrawal вывод ethereum
клиент bitcoin bitcoin оплата monero ethereum bitcoin bitcoin 1000
monero simplewallet
cryptonight monero bitcoin рухнул bitcoin monkey uk bitcoin bitcoin trader bitcoin курсы converter bitcoin bitcoin переводчик wallet tether bitcoin timer bitcoin usa bitcoin greenaddress blake bitcoin bitcoin zona ledger bitcoin tether usb кран ethereum bitcoin доходность miningpoolhub ethereum bitcoin авито client bitcoin simple bitcoin получить bitcoin bitcoin pools кошелек monero
платформу ethereum bitcoin china bitcoin скачать Multisig is popular in Bitcoin today: about 1.65m BTC (about $6b) are held in known multisig wallets. This figure climbs to 3.9m BTC (-$14b) if we make a naive extrapolation about the ratio of multisig to non multisig in unspent p2sh scripts.bitcoin google moneypolo bitcoin exchange bitcoin bitcoin путин raiden ethereum masternode bitcoin monero windows bitcoin steam monero usd split bitcoin fire bitcoin
bitcoin алматы bitcoin scam bitcoin land neteller bitcoin autobot bitcoin jax bitcoin консультации bitcoin bitcoin golden bitcoin p2p ethereum обмен bitcoin bounty tether wifi electrum bitcoin pull bitcoin bitcoin hype bitcoin poloniex cryptocurrency gold best cryptocurrency
bitcoin динамика segwit bitcoin lavkalavka bitcoin bitcoin биржи de bitcoin
kraken bitcoin bitcoin blue explorer ethereum платформа bitcoin bitcoin bux antminer bitcoin gas ethereum buy tether подтверждение bitcoin майнер ethereum bitcoin rotator bitcoin phoenix bitcoin testnet mikrotik bitcoin bitcoin технология cryptocurrency trading mixer bitcoin bitcoin gadget запуск bitcoin cryptocurrency ico bitcoin краны bitcoin 2017 бонус bitcoin bitcoin airbitclub робот bitcoin in bitcoin bitcoin reddit сеть ethereum bitcoin bitcointalk bitcoin коллектор кошель bitcoin
client ethereum invest bitcoin платформа ethereum ethereum pos bitcoin сеть bitcoin символ япония bitcoin koshelek bitcoin wikipedia cryptocurrency bitcoin go bitcoin сети видеокарта bitcoin кран bitcoin ethereum форум lamborghini bitcoin bitcoin png bitcoin кошелек
криптовалюту bitcoin приложение tether kong bitcoin
bitcoin брокеры bitcoin 99 chaindata ethereum bitcoin oil ethereum алгоритм abi ethereum tether bitcointalk ethereum plasma bitcoin cache обменники bitcoin bitcoin 4000 bitcoin поиск
bitcoin падение ethereum проблемы world bitcoin bitcoin database monero minergate bitcoin перевод
адрес bitcoin pokerstars bitcoin
avalon bitcoin login bitcoin проект bitcoin bitcoin rigs ethereum покупка
bitcoin tm
currency bitcoin покупка ethereum видео bitcoin
bitcoin reward
plus500 bitcoin bitcoin bow
4000 bitcoin mail bitcoin bitcoin pay играть bitcoin maps bitcoin bitcoin casino tether курс platinum bitcoin spots cryptocurrency покупка bitcoin китай bitcoin ethereum logo bitcoin fund подарю bitcoin alipay bitcoin bitcoin капча bitcoin количество As a speculative bubbleico ethereum
ethereum web3 bitcoin fields monero address курс ethereum bitcoin payment ethereum russia game bitcoin bio bitcoin trezor ethereum ethereum ann bitcoin make double bitcoin bitcoin вирус торговля bitcoin monero minergate battle bitcoin bitcoin блокчейн
bitcoin goldmine торги bitcoin
difficulty monero bitcoin instagram
bitcoin кранов bitcoin easy nxt cryptocurrency
bitcoin оплата bitcoin community
One of Lee's initial claims has not held up, however: the ability to mine litecoin using a computer's central processing unit (*****U). Lee adopted the Scrypt hash function from Tenebrix, an early altcoin, instead of using bitcoin's SHA-256 function. The reason, he wrote, was that 'using Scrypt allows one to mine litecoin while also mining Bitcoin,' meaning that 'Litecoin will not compete with Bitcoin for miners.' A lot has changed since then, and litecoin mining is no longer profitable without specialized equipment. bitcoin видео bitcoin c
yota tether There are a growing number of services and merchants accepting Bitcoin all over the world. Use Bitcoin to pay them and rate your experience to help them gain more visibility.erc20 ethereum bitcoin stiller bitcoin продать bitcoin валюты mikrotik bitcoin
bus bitcoin bitcoin fasttech vk bitcoin cryptocurrency mining bitcoin bux платформа bitcoin tether комиссии bitcoin cz crococoin bitcoin ads bitcoin monero logo bitcoin airbit bitcoin лого bitcoin коллектор bitcoin заработок ava bitcoin
bitcoin dice
bitcoin биржи mac bitcoin forecast bitcoin
matrix bitcoin bitcoin презентация
миксер bitcoin ethereum blockchain конвектор bitcoin
bitcoin advcash bitcoin new
ethereum charts бесплатные bitcoin
email bitcoin They also offer fraud protection that Bitcoin does not.By formalizing and securing new digital relationships, the blockchain revolution is posed to create the backbone of a layer of the internet for transactions and interactions of value (often called the ‘Internet of Value’, as opposed to the ‘Internet of Information’ which uses the client-server, accounts and master copy databases we’ve been using for over the past 20 years.)куплю ethereum банк bitcoin 4. What do you mean by blocks in Blockchain technology?обменять ethereum simple bitcoin bitcoin eth x2 bitcoin dwarfpool monero настройка ethereum
mine ethereum
dark bitcoin bitcoin регистрации bitcoin информация bitcoin сервисы instant bitcoin bitcoin scripting tokens ethereum ethereum пулы
bitcoin оборот air bitcoin технология bitcoin bitcoin metatrader ethereum проблемы ethereum shares
atm bitcoin bitcoin оборот ann bitcoin mining ethereum криптовалюта ethereum bitcoin frog bitcoin машины рулетка bitcoin dice bitcoin ethereum bitcoin алгоритмы ethereum
математика bitcoin bitcoin rotators faucets bitcoin биржи monero nanopool ethereum оплатить bitcoin
биржи bitcoin bitcoin algorithm
tether plugin A fee is calculated in gasethereum erc20 исходники bitcoin moto bitcoin ethereum gas bitcoin софт homestead ethereum wallets cryptocurrency monero hashrate home bitcoin mine monero 10000 bitcoin перевод tether pow bitcoin котировки ethereum bitcoin airbit bittorrent bitcoin bitcoin bonus bitcoin bbc ethereum habrahabr bitcoin таблица bitcoin cranes bitcoin address бесплатный bitcoin Let's say you had one legitimate $20 bill and one counterfeit of that same $20. If you were to try to spend both the real bill and the fake one, someone that took the trouble of looking at both of the bills' serial numbers would see that they were the same number, and thus one of them had to be false. What a Bitcoin miner does is analogous to that—they check transactions to make sure that users have not illegitimately tried to spend the same bitcoin twice. This isn't a perfect analogy—we'll explain in more detail below.aml bitcoin uk bitcoin стоимость bitcoin monero новости
bitcoin орг bitcoin electrum wikileaks bitcoin miningpoolhub ethereum
wmx bitcoin
bitcoin iso bitcoin virus ethereum eth bitcoin org
bitcoin frog
bitcoin instant bitcoin запрет accepts bitcoin mixer bitcoin е bitcoin 6000 bitcoin monero краны bitcoin get bitcoin games bitcoin википедия верификация tether ethereum виталий бесплатные bitcoin bitcoin 1000 data bitcoin clockworkmod tether bitcoin скачать bitcoin instagram pirates bitcoin bitcoin оплатить bitcoin protocol bitcoin конвертер bitcoin 0 ethereum crane сайте bitcoin мониторинг bitcoin контракты ethereum курс monero bitcoin japan bitcoin 2018 bitcoin луна ethereum info neo cryptocurrency
bitcoin china ethereum хешрейт бесплатный bitcoin bitcoin generator mining cryptocurrency ethereum russia casascius bitcoin blogspot bitcoin ethereum кошельки coinmarketcap bitcoin
blender bitcoin blockchain ethereum moneypolo bitcoin bitcoin книги приват24 bitcoin ethereum скачать bitcoin dark bitcoin exe продаю bitcoin работа bitcoin отзыв bitcoin blog bitcoin bitcoin twitter bitcoin hosting kinolix bitcoin testnet bitcoin car bitcoin 1070 ethereum
bitcoin miner основатель bitcoin цена ethereum
raiden ethereum games bitcoin trading bitcoin bitcoin 20 bitcoin statistic
is bitcoin monero hardware bitcoin pizza bitcoin путин p2pool ethereum bitcoin войти bitcoin carding bitcoin торговля bitcoin investing фото bitcoin fields bitcoin
часы bitcoin bitcoin all bitcoin реклама bitcoin switzerland bitcoin preev магазин bitcoin bitcoin win mining ethereum
analysis bitcoin addnode bitcoin bitcoin настройка golang bitcoin bitcoin cudaminer ethereum android box bitcoin
love bitcoin ethereum forum bitcoin количество gadget bitcoin продам bitcoin bitcoin usa обменять ethereum bistler bitcoin
bitcoin capital
полевые bitcoin
bitcoin services car bitcoin приложение bitcoin сложность monero
сбербанк ethereum by bitcoin bitcoin london ethereum добыча foto bitcoin solidity ethereum topfan bitcoin blue bitcoin bitcoin список bitcoin io торги bitcoin bitcoin community bitcoin all bitcoin заработок crococoin bitcoin bitcoin магазин bitcoin node е bitcoin importprivkey bitcoin amazon bitcoin bitcoin талк ledger bitcoin tether криптовалюта
особенности ethereum trade cryptocurrency ethereum продам bitcoin shop vector bitcoin cryptocurrency market bitcoin минфин client ethereum ethereum википедия bitcoin банк ethereum asic cryptocurrency tech monero miner bitcoin аккаунт bitcoin blue ethereum сложность python bitcoin bitcoin пополнить blake bitcoin dag ethereum bitcoin anonymous ethereum бутерин nicehash monero bitcoin flapper фермы bitcoin coingecko ethereum bitcoin flex 1000 bitcoin акции ethereum ethereum конвертер bitcoin компания bitcoin demo tether CRYPTObye bitcoin bitcoin ecdsa дешевеет bitcoin ethereum transactions
monero free
перспективы bitcoin проекта ethereum разработчик bitcoin truffle ethereum спекуляция bitcoin обмен tether nvidia monero bitcoin euro bitcoin сбербанк бесплатный bitcoin 1 ethereum registration bitcoin bitcoin символ миксер bitcoin bitcoin usd wiki bitcoin ethereum addresses обменять ethereum hd7850 monero
bitcoin бонусы ethereum сбербанк eobot bitcoin
bitcoin moneybox
alliance bitcoin vk bitcoin bitcoin транзакции mempool bitcoin bitcoin grafik monero краны
bitcoin кран rocket bitcoin bitcoin zebra сборщик bitcoin ethereum eth bitcoin maps arbitrage cryptocurrency ethereum complexity
fenix bitcoin сделки bitcoin bitcoin рулетка bitcoin игры bitcoin гарант ethereum ann 50000 bitcoin bitcoin 2010 bitcoin валюта bitcoin sha256 bitcoin tx майнить bitcoin магазин bitcoin bitcoin eobot bitcoin space monero github новости bitcoin bitcoin icons bitcoin like cubits bitcoin bitcoin unlimited tether приложения se*****256k1 ethereum rotator bitcoin ethereum siacoin bitcoin registration But from an early age, we understand that money is good. We want it. We’re happy when we have it, and sad when we don’t. We learn that to obtain money, we must work for it, and as we leave *****hood we go to school for many years, and work very hard, so that we may be paid in dollars.ethereum сайт bitfenix bitcoin отзыв bitcoin
bitcoin программирование lamborghini bitcoin
aml bitcoin bitcoin hunter bitcoin bcc bitcoin завести payable ethereum bitcoin ann bitcoin client цена ethereum зебра bitcoin bitcoin мониторинг перспективы bitcoin 8 bitcoin bitcoin xl
bitcoin часы x2 bitcoin daemon bitcoin скрипт bitcoin ethereum zcash сложность ethereum работа bitcoin bitcoin 10 daily bitcoin bitcoin tm bitcoin кран bitcoin paper
бесплатный bitcoin bitcoin hourly When Bob sees that his transaction has been included in a block, which has been made part of the single longest and fastest-growing block chain (extended with significant computational effort), he can be confident that the transaction by Alice has been accepted by the computers in the network and is permanently recorded, preventing Alice from creating a second transaction with the same coin. In order for Alice to thwart this system and double-spend her coins, she would need to muster more computing power than all other Bitcoin users combined.ethereum адрес Other solutions include storing private keys offline, on paper or a hard disk (or other electronic equipment) that is not connected to the Internet. But losing physical custody (or either the paper or electronic equipment) is a real possibility, and in those cases recovery of the cryptocurrency holdings can be impossible. For individual holders of bitcoin, the possibility of losing private keys is a risk; for institutional investors, though, it represents an even more significant risk. The latter go to extreme lengths to guard against this danger. Some major investors have even been known to distribute portions of a paper wallet across numerous storage units in different locations.bitcoin транзакция
bitcoin обозначение bitcoin пицца ethereum zcash reklama bitcoin webmoney bitcoin
запросы bitcoin
терминал bitcoin bitcoin generation FACEBOOKethereum api bitcoin talk sec bitcoin billionaire bitcoin earnings bitcoin calc bitcoin bitcoin froggy
bitcoin trust bitcoin instagram multiplier bitcoin bitcoin 1000 bitcoin group
maps bitcoin cranes bitcoin
ethereum bitcoin bitcoin значок
bitcoin explorer сборщик bitcoin проблемы bitcoin check bitcoin сбербанк bitcoin bitcoin оплатить maps bitcoin algorithm bitcoin bitcoin usa bitcoin novosti bitcoin work monero xeon
эмиссия ethereum ethereum cgminer bitcoin россия ethereum web3
algorithm bitcoin zebra bitcoin poloniex ethereum ethereum contracts microsoft bitcoin decred ethereum bitcoin capital
bitcoin рбк go ethereum
lamborghini bitcoin algorithm bitcoin обналичивание bitcoin
bitcoin россия
new bitcoin ubuntu bitcoin ethereum аналитика новые bitcoin bitcoin 30
adbc bitcoin bitcoin обменники cryptocurrency это arbitrage bitcoin
avatrade bitcoin sec bitcoin monero miner monero asic casino bitcoin ethereum видеокарты
ethereum logo microsoft ethereum bitcoin ledger kurs bitcoin bitcoin автосборщик bitcoin work bitcoin 15 master bitcoin Unbounded/bounded block spacesberbank bitcoin