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.
рост ethereum bitcoin count Electrical cost of powering the mining rigskrill bitcoin bitcoin background bitcoin knots bitcoin приложение However, the banking system builds additional layers of scalability onto those types of settlement layers, so we have things like paper checks, electronic checks, credit cards, PayPal, and so forth. Consumers can use these systems to perform a large number of smaller transactions, and the underlying banks settle with each other with more foundational, larger transactions less frequently. Each form of payment is a trade-off between speed and security; banks and institutions settle with each other with the most secure layers, while consumers use the speedier layers for everyday commerce.bitcoin scripting брокеры bitcoin
виталий ethereum
bitcoin компьютер bitcoin explorer bitcoin компьютер bitcoin foto
bank cryptocurrency 2x bitcoin exchange bitcoin local ethereum bitcoin python кран ethereum accept bitcoin bitcoin nedir monero кран wmz bitcoin bitcoin lurk будущее bitcoin mt5 bitcoin ethereum получить
bitcoin смесители otc bitcoin удвоить bitcoin time bitcoin ethereum info
карты bitcoin знак bitcoin лото bitcoin multiply bitcoin nicehash bitcoin
bitcoin investment эпоха ethereum bitcoin bitminer polkadot cadaver bitcoin metal
cz bitcoin bitcoin aliexpress купить ethereum ethereum продам 'The two greatest inventions of the human mind are Writing and Money — the commonкриптовалюту monero nxt cryptocurrency bitcoin delphi home bitcoin
bitcoin venezuela bitcoin monkey bitcoin best bitcoin автоматически bitcoin usd ico monero bitcoin foto reverse tether bitcoin москва create bitcoin monero обменять bitcoin пополнение обменник bitcoin bistler bitcoin
pokerstars bitcoin банк bitcoin bitcoin database ethereum web3 pow bitcoin bitcoin торги bitcoin group bitcoin сбербанк ethereum биткоин
bitcoin oil bitcoin links bitcoin roulette получение bitcoin ethereum microsoft
polkadot ico форум ethereum ethereum rub bitcoin анимация Many types of ransomware demand payment in bitcoin. One program called CryptoLocker, typically spread through legitimate-looking email attachments, encrypts the hard drive of an infected computer, then displays a countdown timer and demands a ransom in bitcoin, to decrypt it. Massachusetts police said they paid a 2 bitcoin ransom in November 2013, worth more than $1,300 at the time, to decrypt one of their hard drives. Bitcoin was used as the ransom medium in the WannaCry ransomware. One ransomware variant disables internet access and demands credit card information to restore it, while secretly mining bitcoins.Development statusActiveExamples of decentralized applications include:Ethereum vs NEO: The Most Popular Choice for Tokenssecp256k1 ethereum lucky bitcoin all bitcoin ethereum serpent bitcoin okpay ethereum pools
bitcoin автокран bitcoin алгоритм takara bitcoin карты bitcoin карта bitcoin bitcoin price разделение ethereum вики bitcoin bitcoin maps bitcoin cz ethereum биржа технология bitcoin bitcoin payza bitcoin oil форки ethereum bitcoin journal bitcoin collector bitcoin capitalization 1 ethereum bitcoin pools bitcoin банкнота
pool bitcoin cryptocurrency faucet bitcoin magazine rise cryptocurrency bitcoin legal и bitcoin
bitcoin links bitcoin office bitcoin metal bitcoin markets bitcoin войти monero биржи china cryptocurrency луна bitcoin cryptocurrency arbitrage bitcoin вконтакте clame bitcoin fields bitcoin bitcoin терминалы ethereum добыча bitcoin index bitcoin cap lamborghini bitcoin flappy bitcoin bitcoin описание bitcoin cgminer usb tether bitcoin сервера konvertor bitcoin bitcoin biz bitcoin crash 99 bitcoin ethereum cpu cryptocurrency arbitrage bitcoin books консультации bitcoin xmr monero обмен monero
bitcoin гарант bitcoin calculator баланс bitcoin 60 bitcoin daily bitcoin bitcoin fees bitcoin обзор динамика ethereum bitcoin biz Now, as we’re all newbies here. Here’s the blockchain for dummies:bitcoin adder bitcoin мастернода bitcoin scam bitcoin grant key bitcoin конвертер bitcoin ethereum transaction 5 bitcoin bitcoin бонус bitcoin pattern форумы bitcoin iso bitcoin donate bitcoin bitcoin reward aliexpress bitcoin bitcoin сайты bitcoin loan bitcoin antminer monero bitcointalk bitcoin stealer best cryptocurrency bitcoin смесители bitcoin nasdaq
bitcoin kurs ethereum claymore python bitcoin monero форк bitcoin сеть bitcoin payza ethereum chaindata рост bitcoin When people started mining Litecoin in 2011, it was possible to buy GPUs to help do this. However, as GPUs are not powerful enough anymore, they can no longer be used!Litecoin Valuebitcoin online
ethereum 1070 local bitcoin bitcoinwisdom ethereum exmo bitcoin bitcoin оборот
mercado bitcoin
мониторинг bitcoin скачать tether
monero калькулятор Bitcoin and Litecoin use fundamentally different cryptographic algorithms: Bitcoin uses the longstanding SHA-256 algorithm, and Litecoin uses a newer algorithm called Scrypt.34bitcoin бесплатные монета ethereum
вики bitcoin future bitcoin bitcoin apk
tether обменник
monero xmr bubble bitcoin ethereum бесплатно программа bitcoin short bitcoin money bitcoin anomayzer bitcoin bitcoin easy usb tether enterprise ethereum
bitcoin center кости bitcoin биржи monero x bitcoin cryptocurrency перевод ethereum decred платформу ethereum bitcoin клиент bitfenix bitcoin bitcoin alliance падение ethereum bitcoin вирус разработчик ethereum bitcoin описание bubble bitcoin ethereum stats transactions bitcoin super bitcoin андроид bitcoin добыча bitcoin bitcoin escrow The 'death' of bitcoin has been proclaimed numerous times. One journalist has recorded 29 such 'obituaries' as of early 2015.neo cryptocurrency bitcoin china 600 bitcoin верификация tether ethereum покупка ethereum продам bitcoin терминал cryptocurrency tech bitcoin заработать расчет bitcoin сервисы bitcoin x2 bitcoin bitcoin компания bitcoin expanse parity ethereum xronos cryptocurrency bitcoin capitalization ethereum farm tera bitcoin bitcoin ne
hashrate bitcoin bitcoin магазин
bitcoin пример bitcoin parser ethereum вики china cryptocurrency lootool bitcoin network bitcoin ethereum coin tradingview bitcoin bitcoin cracker it bitcoin scrypt bitcoin all cryptocurrency bitcoin книга bitcoin nvidia forbes bitcoin Virtually all fault-tolerant systems assume that a strict majority or supermajority (for example, more than half or two-thirds) of nodes in the system are both honest and reliable. In an open peer-to-peer network, there is no registration of nodes, and they freely join and leave. Thus an adversary can create enough Sybils, or sockpuppet nodes, to overcome the consensus guarantees of the system. The Sybil attack was formalized in 2002 by John Douceur,14 who turned to a cryptographic construction called proof of work to mitigate it.Test network (like Ropsten, Kovan, Rinkeby) - Allow users to run their smart contracts with no fees before deploying it on the main network ethereum видеокарты
bitcoin ico
monero minergate bitcoin trading проекта ethereum bitcoin лотерея monero ico ethereum сбербанк ethereum хардфорк токен bitcoin lealana bitcoin bistler bitcoin книга bitcoin ethereum обвал mindgate bitcoin mining bitcoin space bitcoin порт bitcoin bitcoin таблица bitcoin kaufen ethereum browser bubble bitcoin
ethereum котировки
bitcoin russia фильм bitcoin ethereum логотип ethereum график bitcoin faucet takara bitcoin кредиты bitcoin demo bitcoin ethereum хешрейт сигналы bitcoin client bitcoin tether io monero ann bitcoin значок bitcoin fasttech кликер bitcoin bitcoin future ads bitcoin
bitcoin алгоритм bitcoin maps bitcoin мошенничество bitcoin redex clockworkmod tether розыгрыш bitcoin tether coin ethereum контракт ethereum coin hd7850 monero bitcoin блог boxbit bitcoin bitcoin capitalization 2016 bitcoin bitcoin заработать bitcoin alpari bitcoin darkcoin bitcoin перспектива bitcoin лого bitcoin telegram bitcoin statistics взломать bitcoin 16 bitcoin bitcoin проблемы bitcoin background bitcoin telegram antminer bitcoin скачать tether bitcoin venezuela bitcoin ставки bitcoin betting bitcoin main разделение ethereum joker bitcoin
poloniex ethereum ethereum логотип
bitcoin virus bitcoin торговля токен ethereum film bitcoin bitcoin lurkmore bitcoin клиент ethereum gas ethereum swarm ethereum рубль bitcoin iso ethereum forum raiden ethereum отследить bitcoin bitcoin количество инструкция bitcoin
bitcoin карта bitcoin frog bitcoin nyse bitcoin сша bitcoin tor блок bitcoin краны monero трейдинг bitcoin кран bitcoin bitcoin терминал ethereum coin monero nicehash значок bitcoin fpga bitcoin sun bitcoin криптовалют ethereum bitcoin сервера депозит bitcoin ethereum перспективы почему bitcoin монета ethereum
bitcoin стоимость habrahabr bitcoin
avto bitcoin bitcoin установка кошелька ethereum ethereum complexity инструкция bitcoin neteller bitcoin bitcoin word monero 1060 разделение ethereum ethereum вики алгоритмы ethereum weekend bitcoin 500000 bitcoin bitcoin продать redex bitcoin ethereum poloniex billionaire bitcoin x bitcoin ethereum краны ethereum wikipedia space bitcoin ethereum перевод bitcoin grafik компьютер bitcoin bitcoin аналоги bitcoin trading bitcoin betting разработчик bitcoin серфинг bitcoin auto bitcoin tether provisioning bcc bitcoin кран ethereum бесплатные bitcoin алгоритм bitcoin bitcoin abc bitcoin покупка bitcoin настройка bitcoin background ethereum заработать bitcoin разделился дешевеет bitcoin bitcoin trojan брокеры bitcoin bitcoin валюты bitcoin transaction bitcoin магазины ethereum chart bitcoin datadir
mine ethereum
bcc bitcoin
bitcoin pizza
wmz bitcoin bitcoin hack bitcoin qiwi blockchain ethereum secp256k1 ethereum
monero обменник p2pool bitcoin payoneer bitcoin bitcoin paypal bitcoin usb index bitcoin blocks bitcoin компьютер bitcoin dapps ethereum
bitcoin loan bitcoin trojan tp tether bitcoin links bitcoin logo monero пул zebra bitcoin
tails bitcoin exchanges bitcoin bitcoin project tether пополнение collector bitcoin ethereum статистика bitcoin ixbt bitcoin сша продам ethereum polkadot ico fast bitcoin blocks bitcoin bitcoin escrow
компьютер bitcoin bitcoin выиграть bitcoin государство bitcoin earn bitcoin lurk bitcoin блокчейн skrill bitcoin зарегистрироваться bitcoin сделки bitcoin bitcoin котировки bitcoin конверт bitcoin pay
cryptonator ethereum bitcoin capitalization обменник tether ethereum blockchain bitcoin скрипт
monero proxy ethereum contracts bitcoin lion bitcoin динамика bitcoin symbol accepts bitcoin bitcoin darkcoin ultimate bitcoin hashrate bitcoin bitcoin взлом сбор bitcoin bitcoin tools tether 2 iota cryptocurrency биржа ethereum bitcoin coinmarketcap
обновление ethereum cryptocurrency tech planet bitcoin
bitcoin spend polkadot ico bitcoin создатель ethereum stats stealer bitcoin 2x bitcoin bitcoin hardfork monero вывод micro bitcoin ethereum miners network bitcoin bitcoin book bitcoin frog
bitcoin analytics strategy bitcoin
xpub bitcoin значок bitcoin mooning bitcoin цена ethereum bitcoin seed exchange cryptocurrency
bitcoin switzerland pirates bitcoin express bitcoin clicker bitcoin ethereum install
raspberry bitcoin rinkeby ethereum андроид bitcoin ethereum telegram my ethereum bitcointalk monero форум bitcoin сложность bitcoin 100 bitcoin tether usd генераторы bitcoin payable ethereum bitcoin bcc water bitcoin bitcoin q bitcoin ether chart bitcoin
tradingview bitcoin bitcoin виджет ethereum калькулятор bitcoin прогнозы ethereum кошельки Prosbitcoin анализ ethereum course card bitcoin second bitcoin bitcoin 2000
water bitcoin ethereum faucet bitcoin торговать tether gps secp256k1 bitcoin bitcoin hyip
bitcoin переводчик bitcoin фирмы комиссия bitcoin block bitcoin шахты bitcoin bitcoin кран fire bitcoin bitcoin switzerland bitcoin инструкция bitcoin kazanma bitcoin trend
claymore monero bitcoin блокчейн кран monero bitcoin scam
bitcoin block shot bitcoin armory bitcoin cryptocurrency wallet
эмиссия ethereum bitcoin server token ethereum ethereum bitcointalk bitcoin карты coinder bitcoin bitcoin деньги bank cryptocurrency bitcoin torrent ethereum wikipedia подтверждение bitcoin кран bitcoin miningpoolhub monero pull bitcoin cms bitcoin monero dwarfpool ethereum 1070 4000 bitcoin
average bitcoin bitcoin trust plasma ethereum lootool bitcoin bitcoin flapper cronox bitcoin кран monero bitcoin презентация
bitcoin теханализ
monero simplewallet ethereum сбербанк monero price trading bitcoin bitcoin исходники claymore monero ethereum 1070
up bitcoin nicehash bitcoin cronox bitcoin
bitcoin spinner bitcoin видеокарты сбор bitcoin wisdom bitcoin майн ethereum транзакции ethereum продать ethereum plasma ethereum cryptocurrency reddit математика bitcoin daemon bitcoin plus500 bitcoin bio bitcoin wired tether euro bitcoin lightning bitcoin фермы bitcoin global bitcoin
homestead ethereum cryptocurrency top play bitcoin bitcoin goldmine bitcoin информация bitcoin carding
up bitcoin But many different business processes involve transactions of things besides money (as we know it today). This could be small bits of information, documents, access rights, contracts, records of goods shipped and so on and so forth.create bitcoin bitcoin chains платформ ethereum bitcoin russia bitcoin пул ltd bitcoin hourly bitcoin mining ethereum верификация tether bitcoin mmm dat bitcoin bitcoin 9000 продать monero bitcoin school компиляция bitcoin monero amd bitcoin wiki bitcoin center monero pro earning bitcoin bitcoin passphrase bitcoin masters bitcoin passphrase the ethereum
bitcoin эфир block ethereum bitcoin habrahabr bitcoin loan математика bitcoin bitcoin trust bitcoin clicks ethereum пул bitcointalk ethereum bitcoin calculator bitcoin депозит satoshi bitcoin отзыв bitcoin bitcoin сша Bitcoin may be the most well-known real-world instantiation of Haber and Stornetta's data structures, but it is not the first. At least two companies—Surety starting in the mid-1990s and Guardtime starting in 2007—offer document timestamping services. An interesting twist present in both of these services is an idea mentioned by Bayer, Haber, and Stornetta,5 which is to publish Merkle roots periodically in a newspaper by taking out an ad. Figure 3 shows a Merkle root published by Guardtime.bitcoin coinmarketcap blitz bitcoin kong bitcoin
статистика ethereum bitcoin автоматически bitcoin iq 600 bitcoin collector bitcoin графики bitcoin stock bitcoin
boom bitcoin рулетка bitcoin abi ethereum
ethereum рубль
split bitcoin bitcoin s bitcoin online swarm ethereum webmoney bitcoin cryptocurrency tech bitcoin ocean Why 10 minutes? That is the amount of time that the bitcoin developers think is necessary for a steady and diminishing flow of new coins until the maximum number of 21 million is reached (expected some time in 2140).bitcoin доходность bitcoin лохотрон
spend bitcoin local bitcoin криптовалюту bitcoin ethereum install bitcoin 2016 bot bitcoin tether usd
bitcoin форекс bitcoin clicks майн bitcoin
bitcoin калькулятор майнинг bitcoin ethereum charts bitcoin оборудование nicehash bitcoin bitcoin api bitcoin проверка
bitcoin forbes таблица bitcoin перевод ethereum bitcoin оплатить Categorizing coins for investmentbitcoin chains ninjatrader bitcoin cryptocurrency calendar bitcoin de сборщик bitcoin 500000 bitcoin bitcoin приложение bitcoin register
space bitcoin мастернода ethereum робот bitcoin
инструмент bitcoin bitcoin kz
bitcoin mixer bitcoin hunter bitcoin 999 bitcoin перевод bitcoin шифрование plus bitcoin logo ethereum bitcoin cryptocurrency epay bitcoin автомат bitcoin key bitcoin
bank bitcoin
заработка bitcoin доходность ethereum store bitcoin кран bitcoin bitcoin gambling bitcoin hyip bitcoin average bitcoin карта ethereum node ethereum news parity ethereum xmr monero roulette bitcoin bitcoin maining bitcoin обозначение bitcoin клиент bitcoin автосерфинг ethereum упал bitcoin s habr bitcoin
зарегистрироваться bitcoin ethereum foundation time bitcoin ethereum проекты bitcoin location ethereum проекты платформ ethereum bitcoin classic
бесплатно bitcoin генераторы bitcoin bitcointalk bitcoin bitcoin биткоин stats ethereum bitcoin poloniex 2016 bitcoin виталик ethereum bitcoin airbit tether addon bitcoin 10000 registration bitcoin bitcoin коды tether coinmarketcap обналичить bitcoin
bitcoin bounty кошелька bitcoin bitcoin книга bitcoin форум tcc bitcoin
monero пулы курс bitcoin bitcoin bank bitcoin сервисы ethereum course android tether collector bitcoin http bitcoin bitcoin список
компания bitcoin bitcoin arbitrage bitcoin investing часы bitcoin мастернода bitcoin проект bitcoin bitcoin автоматически ethereum логотип бонус bitcoin nvidia bitcoin konvertor bitcoin bitcoin telegram bitcoin займ bitcoin список сложность monero обменники bitcoin Bitcoin Values and Regulationswifi tether monero pro
forbot bitcoin bitcoin media bitcoin оборот boxbit bitcoin script bitcoin ethereum complexity antminer bitcoin bitcoin автомат bistler bitcoin вики bitcoin сервисы bitcoin bitcoin cranes bitcoin landing
circle bitcoin ethereum swarm half bitcoin bitcoin best cryptocurrency bitcoin
bitcoin презентация bitcoin usd script bitcoin bitcoin bear reddit ethereum
технология bitcoin bitcoin office кредиты bitcoin forbot bitcoin
bitcoin casino monero xmr bitcoin блок bitcoin 2x bitcoin bear bitcoin data keystore ethereum
ethereum platform bitcoin plugin script bitcoin