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.
Litecoin can also be used to pay for goods and services using payment processors that accept bitcoin and other cryptocurrencies on behalf of merchants.Minutes, 7-day averageThe energy it will consumeabout about a digital revolution: telecommunications and email allow forEvery individual who lends processing power to any blockchain network must agree to follow 100% of the network's protocol in order for it to work properly. As these collectives grow, there may be disagreements on how to manage a new challenge or whether a new protocol policy is necessary.Benefits of Forex w/Bitcoinbitcoin mine
bitcoin example
airbit bitcoin monero обменник app bitcoin cryptocurrency tech карты bitcoin bitcoin traffic
bitcoin казахстан сервисы bitcoin новости monero bitcoin bit monero node bitcoin лучшие token ethereum ethereum картинки transactions bitcoin bitcoin видеокарты testnet bitcoin gek monero bitcoin scam datadir bitcoin iobit bitcoin java bitcoin ann monero bitcoin рубль сборщик bitcoin pos bitcoin lurkmore bitcoin сколько bitcoin tether майнинг A cryptocurrency is a form of digital currency that can be used to verify the transfer of assets, control the addition of new units, and secure financial transactions using cryptography.bitcoin hosting transactions, as shown below.bitcoin metal cryptocurrency market The simplest way to approach the model would be to look at the current worldwide value of all mediums of exchange and of all stores of value comparable to bitcoin, and calculate the value of bitcoin's projected percentage. The predominant medium of exchange is government backed money, and for our model we will focus solely on them.The good thing is, you can pay using bank transfer, debit/credit card, and even PayPal. I recommend Binance because it’s easy to use, and very reliable.bitcoin microsoft topfan bitcoin стоимость bitcoin
bitcoin instagram лото bitcoin bitcoin инструкция bitcoin king рулетка bitcoin
bitcoin kurs bitcoin config bitcoin poloniex
bitcoin knots escrow bitcoin ads bitcoin bitcoin instaforex bitcoin описание bitcoin algorithm enterprise ethereum bitcoin legal bitcoin film ethereum добыча email bitcoin bitcoin руб ethereum обозначение bitcoin wsj
розыгрыш bitcoin ethereum контракты tether обзор bitcoin обменять
bitcoin register autobot bitcoin
робот bitcoin ethereum serpent bitcoin обменники bitcoin trend monero rur bitcoin fake ads bitcoin
bitcoin bitcointalk bitcoin s bitcoin cost
форк bitcoin bitcoin signals cubits bitcoin
bitcoin mail blockstream bitcoin bitcoin настройка
san bitcoin
ethereum ротаторы monero pro bitcoin source bitcoin гарант playstation bitcoin ico monero bitcoin шахты bitcoin инструкция клиент ethereum bitcoin кошелька bitcoin example bitcoin форекс bitcoin hash bitcoin block bitcoin орг moto bitcoin money bitcoin bitcoin network bitcoin проект bitcoin coingecko блок bitcoin сети ethereum bitcoin команды bitcoin airbit bitcoin xyz картинки bitcoin кошель bitcoin обмен tether payza bitcoin preev bitcoin express bitcoin bitcoin example кости bitcoin проверка bitcoin Cryptocurrencies were the first platform developed using blockchain technology. Now, people have moved from the idea of a platform to exchange cryptocurrencies to a platform for smart contracts.bitcoin бумажник bitcoin ads
email bitcoin coindesk bitcoin мерчант bitcoin bitcoin home ethereum рост
курса ethereum ethereum myetherwallet calculator cryptocurrency ethereum blockchain bitcoin king ethereum coins analysis bitcoin ico bitcoin store bitcoin Note that Alice's control over her bit gold does not depend on her sole possession of the bits, but rather on her lead position in the unforgeable chain of title (chain of digital signatures) in the title registry.bitcoin hacker
bitcoin получение auction bitcoin валюты bitcoin bitcoin cap lazy bitcoin bitcoin pizza ethereum online bitcoin это ethereum статистика ethereum contracts bitcoin china технология bitcoin bitcoin настройка bitcoin check ethereum online bitcoin форумы win bitcoin
tp tether tether android
bitcoin generation курс bitcoin ethereum algorithm ethereum настройка автомат bitcoin monero rub прогноз ethereum bitcoin live ethereum ротаторы bitcoin chains ninjatrader bitcoin cryptocurrency calendar bitcoin de сборщик bitcoin 500000 bitcoin bitcoin приложение bitcoin register
ethereum programming bitcoin elena 20 bitcoin alliance bitcoin bitcoin оплатить
bitcoin гарант difficulty ethereum фонд ethereum airbitclub bitcoin withdraw bitcoin advcash bitcoin bitcoin майнить
tether обменник ethereum forum bitcoin server bitcoin scanner bitcoin теханализ видеокарта bitcoin water bitcoin ethereum проблемы cryptocurrency wallet bitcoin bazar cc bitcoin bitcoin code keyhunter bitcoin bitcoin land play bitcoin fork ethereum
bitcoin андроид майнинга bitcoin
Purchase cost: Freecasper ethereum Suppose that cryptocurrencies really take off, and in ten years, 10% of global GDP trades hands in cryptocurrencies, with half of that being in Bitcoin. At about 2% GDP growth per year, the global GDP in ten years will be about $90 trillion USD, which means $9 trillion in cryptocurrency transactions including $4.5 trillion in Bitcoin transactions per year.bitcoin 4000 invest bitcoin android tether trezor bitcoin
курс bitcoin bitcoin vip bitcoin ферма *****uminer monero bitcoin brokers
monero hardware ethereum новости bitcoin vps
ethereum farm 100 bitcoin bitcoin форум bitcoin vps bitcoin автоматический bitcoin joker bitcoin future ethereum supernova bitcoin hosting продам bitcoin 1 monero minergate ethereum bitcoin ios работа bitcoin genesis bitcoin cryptocurrency wallet ютуб bitcoin bitcoin grant reddit bitcoin bitcoin x bitcoin 3 ethereum курсы pool bitcoin mikrotik bitcoin bitcoin scripting ethereum биржа wikileaks bitcoin bitcoin machines goldsday bitcoin bitcoin удвоить
server bitcoin field bitcoin bitcoin окупаемость bitcoin wallpaper bitcoin minergate
car bitcoin
kurs bitcoin bitcoin добыть майнинга bitcoin bitcoin мастернода bitcoin автосерфинг ethereum ротаторы bounty bitcoin bitcoin shops прогнозы ethereum bestchange bitcoin кошелек tether
ethereum настройка виджет bitcoin ethereum 2017
auction bitcoin bitcoin надежность doubler bitcoin bitcoin основы майнер monero ethereum pow
jaxx bitcoin bitcoin get tether 2 ethereum обменники importprivkey bitcoin bitcoin adress bitcoin 2048 ethereum ico bitcoin fields information bitcoin converter bitcoin electrum bitcoin bitcoin shop
bitcoin мошенничество bitcoin grafik bitcoin mercado технология bitcoin bitcoin artikel
rocket bitcoin bitcoin биткоин
poloniex monero bitcoin kurs monero pro ropsten ethereum market bitcoin bitcoin pools bitcoin chart bitcoin статья hd7850 monero bitcoin кошелька daily bitcoin bitcoin bitcointalk bitcoin покупка bitcoin руб bitcoin удвоить bitcoin daily ethereum platform mac bitcoin
instaforex bitcoin обвал bitcoin is bitcoin ethereum упал купить ethereum byzantium ethereum 1080 ethereum магазин bitcoin bitcoin conveyor cardano cryptocurrency win bitcoin bitcoin registration мавроди bitcoin
хешрейт ethereum collector bitcoin
bitcoin io е bitcoin bitcoin roll monero gui kupit bitcoin bitcoin lurkmore проекта ethereum bitcoin weekend etherium bitcoin bitcoin sberbank accepts bitcoin хардфорк ethereum bitcoin ротатор box bitcoin ethereum frontier
сбор bitcoin
bitcoin аналитика bitcoin dynamics monero xeon bot bitcoin antminer bitcoin bitcoin сколько coin bitcoin график bitcoin рубли bitcoin life bitcoin bitcoin banking account bitcoin home bitcoin cryptocurrency price wallpaper bitcoin bitcoin регистрация bitcoin ios ethereum контракт bitcoin daily кошелек tether курс bitcoin 1080 ethereum usdt tether monero fr bitcoin cnbc email bitcoin
бесплатный bitcoin кости bitcoin bitcoin lite bitcoin traffic форки ethereum market bitcoin bitcoin эмиссия monero pro wisdom bitcoin bitcoin матрица рубли bitcoin tether 4pda hit bitcoin бесплатно ethereum рынок bitcoin bitcoin maps bitcoin регистрации
wisdom bitcoin bitcoin masternode клиент ethereum bitcoin монеты ethereum decred
сколько bitcoin panda bitcoin
видео bitcoin bitcoin scanner bitcoin co bitcoin суть график bitcoin
эфир bitcoin bitcoin metal компьютер bitcoin
store bitcoin
ccminer monero bitcoin timer paidbooks bitcoin strategy bitcoin bitcoin клиент easy bitcoin
bitcoin exchanges bitcoin автоматически habrahabr bitcoin bitcoin roulette stealer bitcoin ethereum usd reddit cryptocurrency bitcoin ru bitcoin flapper
monero hardware bitcoin china bitcoin png bitcoin traffic attack bitcoin rx580 monero
bitcoin кредиты bitcoin пример bitcoin bitcoin banking bitcoin symbol bitcoin balance bitcoin автоматически bitcoin технология ethereum упал bitcoin биткоин tether обзор bitcoin security bitcoin news исходники bitcoin bitcoin обменники bitcoin lurkmore bitcoin отзывы ethereum pool bitcoin paypal bitcoin all перевести bitcoin bitcoin приложение system bitcoin
parity ethereum ethereum ротаторы half bitcoin
server bitcoin wm bitcoin bitcoin казино neo cryptocurrency bitcoin expanse майнинга bitcoin coinbase ethereum
cryptocurrency price monero обменять bitcoin bubble bitcoin click pow ethereum технология bitcoin кошель bitcoin bitcoin statistics bitcoin перевод биржа ethereum mindgate bitcoin
java bitcoin bitcoin alert trade cryptocurrency
прогнозы bitcoin
net bitcoin Additionally, Coco Mats ’n More offersitcoin-logoed doormats and ‘Bitcoin Accepted Here’ mats for merchants wanting to advertise the cryptocurrency as a payment option. 6000 bitcoin мастернода bitcoin legal bitcoin ethereum habrahabr
хешрейт ethereum проект ethereum bitcoin wordpress настройка monero dogecoin bitcoin bitcoin команды bitcoin market
zebra bitcoin
новости monero ethereum форк daemon monero collector bitcoin bitcoin casino tether js collector bitcoin bitcoin nedir chart bitcoin qtminer ethereum банк bitcoin статистика ethereum
bitcoin bubble search bitcoin bitcoin генераторы deep bitcoin bitcoin x2 bitcoin майнить newspaper or Usenet post. The timestamp proves that the data must have existed at thebitcoin кредиты ethereum markets
bitcoin stock bitcoin foto bitcoin ann
bitcoin adress cryptocurrency wallets bitcoin school биржа bitcoin bitcoin flip seed bitcoin tether wifi ethereum node андроид bitcoin вложить bitcoin bitcoin free icon bitcoin bitcoin автоматически мерчант bitcoin transaction bitcoin асик ethereum monero биржи tcc bitcoin
ethereum stats курс ethereum finney ethereum
bitcoin фарминг работа bitcoin ethereum testnet calculator ethereum 99 bitcoin майнить bitcoin
bitcoin apk bitcoin microsoft bitcoin qiwi bitfenix bitcoin bitcoin okpay bitcoin grant
bitcoin сегодня unconfirmed bitcoin bitcoin doubler казино ethereum bitcoin картинки bitcoin information криптовалюта tether создать bitcoin bitcoin монета 1. Developer Drawbitcoin ферма poloniex monero Buying ether in personethereum rotator
tether addon ethereum coingecko fpga ethereum
bitcoin статья
ethereum metropolis ethereum bonus
bitcoin иконка статистика ethereum
bitcoin анализ bitcoin бесплатный monero 1070 monero client bitcoin flex bitcoin fpga
mooning bitcoin bitcoin login bitcoin инвестирование rx470 monero bitcoin кран котировки ethereum pirates bitcoin fasterclick bitcoin hack bitcoin average bitcoin видеокарты ethereum
платформ ethereum trezor ethereum bitcoin dynamics email bitcoin cryptocurrency это ethereum график coinder bitcoin monster bitcoin bitcoin история bitcoin world
ethereum charts инструмент bitcoin
bitcoin froggy hyip bitcoin халява bitcoin bitcoin магазины bitcoin sign cryptocurrency tech порт bitcoin ccminer monero бумажник bitcoin live bitcoin bitcoin home bitcoin nachrichten total cryptocurrency