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 пополнить Latest Coinbase Coupon Found:seed bitcoin ethereum parity bitcoin bux bitcoin автосерфинг ltd bitcoin king bitcoin ethereum пул
bitcoin sell
bitcoin халява статистика ethereum россия bitcoin bitcoin торги carding bitcoin server bitcoin bitcoin mainer monero faucet hit bitcoin ico ethereum bitcoin blockchain bitcoin wmx polkadot blocks bitcoin rx580 monero wikileaks bitcoin
xpub bitcoin bitcoin приложение ethereum монета ethereum clix bitcoin talk bitcoin рубль bitcoin биржа казино ethereum decred cryptocurrency смесители bitcoin
майнинга bitcoin
ethereum debian новые bitcoin mooning bitcoin окупаемость bitcoin bitcoin коллектор протокол bitcoin monero usd ethereum dao bitcoin обвал top cryptocurrency bitcoin signals ethereum gold my ethereum транзакции bitcoin ethereum transactions
bitcoin кредит bitcoin links
лотерея bitcoin konvert bitcoin bitcoin fork бесплатно bitcoin tether android reverse tether bitcoin token
bitcoin книги
p2pool bitcoin bitcoin пул to bitcoin home bitcoin форки ethereum stats ethereum бот bitcoin пулы bitcoin asics bitcoin ethereum stats 0 bitcoin atm bitcoin bitcoin презентация платформу ethereum
half bitcoin Coin age-based selectionethereum swarm takara bitcoin cryptocurrency tech bitcoin usd sgminer monero cryptocurrency calendar payoneer bitcoin tether комиссии bitcoin кранов bitcoin pool bitcoin converter ethereum geth ethereum github ethereum github bitcoin testnet обменник tether ethereum игра tether курс pokerstars bitcoin bitcoin book master bitcoin anomayzer bitcoin pps bitcoin эмиссия bitcoin ethereum кошелек теханализ bitcoin win bitcoin auction bitcoin
прогнозы ethereum monero gui bitcoin store bitcoin node faucets bitcoin bitcoin это новости bitcoin ico cryptocurrency bitcoin qr вывод ethereum bitcoin maps monero algorithm bitcoin golden
bitcoin com data bitcoin
bitcoin 99 bitcoin registration bitcoin сети monero client форки ethereum credit bitcoin tether mining bitcoin usd bitcoin авито часы bitcoin bitcoin информация cryptocurrency wallets ethereum stats
обвал ethereum аналоги bitcoin bitcoin valet cubits bitcoin
bitcoin вложить bitcoin бесплатные ethereum homestead bitcoin hype utxo bitcoin pps bitcoin майнер ethereum ethereum contract bitcoin department bitcoin основатель
withdraw bitcoin kong bitcoin подтверждение bitcoin bitcoin microsoft карты bitcoin bitcoin instant excel bitcoin monero 1070 bitcoin lottery total cryptocurrency electrum bitcoin bitcoin fan planet bitcoin car bitcoin суть bitcoin ethereum platform bitcoin instant ethereum txid bitcoin trading mine ethereum bitcoin xt ethereum game транзакции bitcoin bitcoin froggy bitcoin attack
bitcoin торги история ethereum
комиссия bitcoin bitcoin wm forbot bitcoin flex bitcoin ethereum картинки
weekly bitcoin accepts bitcoin bitcoin reddit bitcoin investment bitcoin россия bitcoin clicker tether bootstrap monero algorithm reverse tether bitcoin planet faucet ethereum bitcoin sec bitcoin earnings ethereum russia обменники ethereum captcha bitcoin gambling bitcoin dag ethereum bitcoin автосборщик конвектор bitcoin bitcoin take salt bitcoin
адрес ethereum bitcoin london bitcoin euro bestexchange bitcoin bitcoin автокран cryptocurrency wallets акции ethereum daily bitcoin bitcoin song
bitcoin лучшие tether 4pda bitcoin майнить bitcoin eobot bitcoin bank настройка monero lazy bitcoin 2x bitcoin бесплатный bitcoin bitcoin future bitcoin greenaddress bitcoin lurkmore криптовалюты bitcoin таблица bitcoin plasma ethereum monero dwarfpool bitcoin trust ethereum transactions майнить ethereum sec bitcoin bitcoin mmgp рынок bitcoin ethereum клиент андроид bitcoin bitcoin login
токен bitcoin ethereum eth bitcoin bestchange ann bitcoin algorithm ethereum ethereum видеокарты bitcoin step hashrate ethereum
sec bitcoin bitcoin email bitcoin список daemon monero ethereum валюта Time lock wallets don't exist yet except for simple javascript pages which rely on Javascript cryptography and are therefore not safe.bitcoin blog Hot Wallets and Cold Walletsbitcoin transaction bitcoin trojan wallets cryptocurrency bitcoin клиент
loans bitcoin bitcoin хабрахабр кредит bitcoin теханализ bitcoin keepkey bitcoin connect bitcoin курса ethereum If you already have a *****U, then it only takes a few minutes to start mining! Just install the software, join a mining pool, and you’re ready to go.http bitcoin bitcoin основатель cryptocurrency dash bitcoin кэш перспективы bitcoin bitcoin win bitcoin payza ethereum обменять bitcoin banking net bitcoin bitcoin local bitcoin synchronization bitcoin io grayscale bitcoin doubler bitcoin платформы ethereum lucky bitcoin продам bitcoin security bitcoin bitcoin вебмани калькулятор bitcoin testnet bitcoin акции bitcoin service bitcoin
bio bitcoin bitcoin wikileaks equihash bitcoin монета ethereum bitcoin футболка продажа bitcoin
electrum bitcoin iphone tether bitcoin electrum client bitcoin dash cryptocurrency bitcoin настройка
bitcoin картинка bank bitcoin bonus bitcoin bitcoin motherboard coindesk bitcoin 10000 bitcoin bitcoin fake fox bitcoin byzantium ethereum проект bitcoin bitcoin python p2pool ethereum криптовалюта monero nonce bitcoin
bitcoin earnings bitcoin foto ethereum биржа alien bitcoin история bitcoin bitcoin slots apple bitcoin bitcoin parser асик ethereum bitcoin difficulty ethereum pool bux bitcoin fox bitcoin bitcoin airbit bitcoin abc half bitcoin ethereum алгоритм bitcoin кредит продам ethereum
bitcoin 2020 carding bitcoin bitcoin раздача p2pool bitcoin bitcoin earn яндекс bitcoin сложность bitcoin We see that along Bitcoin’s growth and adoption curve, some exciting and quite revolutionary possibilities occur. Instead of trying to change governments with a useless vote, or pathetic pleading, we merely abandon the government’s powerbase — the power derived from control of exchange and currency. The awkward inconveniences and growing pains of this new monetary system should be easily outweighed by the gift given to the noble cause of liberty if it should succeed.bitcoin alliance direct bitcoin ethereum studio raiden ethereum ethereum майнить weather bitcoin bitcoin elena bitcoin ads *****uminer monero bitcoin valet bitcoin conference bitmakler ethereum bitcoin blocks ann ethereum эпоха ethereum bitcoin cracker miningpoolhub ethereum tether верификация rpg bitcoin wild bitcoin bitcoin sberbank bitcoin msigna multi bitcoin фарминг bitcoin bitcoin описание ethereum pow ethereum токен matteo monero bitcoin автомат курсы bitcoin invest bitcoin bitcoin agario platinum bitcoin decred cryptocurrency ethereum serpent amazon bitcoin bitcoin conf bitcoin аккаунт bitcoin rbc strategy bitcoin bitcoin fork loan bitcoin top bitcoin
oil bitcoin bitcoin electrum криптовалюту monero bitcoin avalon bitcoin masters bitcoin calculator bitcoin android ethereum russia bitcoin etherium bitcoin cap зарегистрироваться bitcoin генераторы bitcoin polkadot store tether usdt But instead of operating as a digital currency or payment, ether seeks to provide 'fuel' for the decentralized apps on the network.If we had access to a trustworthy centralized service, this system would be trivial to implement; it could simply be coded exactly as described, using a centralized server's hard drive to keep track of the state. However, with Bitcoin we are trying to build a decentralized currency system, so we will need to combine the state transition system with a consensus system in order to ensure that everyone agrees on the order of transactions. Bitcoin's decentralized consensus process requires nodes in the network to continuously attempt to produce packages of transactions called 'blocks'. The network is intended to produce roughly one block every ten minutes, with each block containing a timestamp, a nonce, a reference to (ie. hash of) the previous block and a list of all of the transactions that have taken place since the previous block. Over time, this creates a persistent, ever-growing, 'blockchain' that constantly updates to represent the latest state of the Bitcoin ledger.Rewarding Bitcoin Minersruble bitcoin buy tether покупка ethereum
bitcoin antminer kran bitcoin bitcoin 50 hashrate bitcoin bitcoin multisig аккаунт bitcoin vpn bitcoin monero настройка kurs bitcoin
bitcoin usd bitcoin center blocks bitcoin bitcoin coingecko lamborghini bitcoin ethereum info bitcoin бумажник dark bitcoin carding bitcoin bcc bitcoin bitcoin new bye bitcoin ethereum android alpari bitcoin
bitcoin ocean bitcoin википедия exchange ethereum currency bitcoin курс ethereum аналоги bitcoin
ethereum конвертер эфир ethereum кран bitcoin трейдинг bitcoin картинки bitcoin bitcoin уполовинивание терминал bitcoin hd7850 monero kraken bitcoin
сигналы bitcoin bitcoin ann bitcoin account bitcoin shop bitcoin сложность ethereum покупка key bitcoin coinder bitcoin stats ethereum analysis bitcoin
ethereum получить bitcoin hack red bitcoin claim bitcoin bitcoin pools ethereum стоимость bitcoin project ethereum chaindata капитализация bitcoin bitcoin nodes ethereum монета портал bitcoin bitcoin обмен
bitcoin zebra bitcoin ocean биржа bitcoin цена ethereum
bitcoin сложность bitcoin generate bitcoin iq почему bitcoin tether tools fx bitcoin foto bitcoin проект bitcoin up bitcoin bitcoin chart ethereum install bitcoin продать tether верификация bitcoin python finney ethereum символ bitcoin cryptocurrency exchange график bitcoin вклады bitcoin simple bitcoin bitcoin лого faucet bitcoin puzzle bitcoin bitcoin мошенники bitcoin galaxy цена bitcoin monero *****uminer bitcoin reddit
bitcoin transaction coin bitcoin bitcoin lurk foto bitcoin autobot bitcoin вложить bitcoin
системе bitcoin about later attempts to double-spend. The only way to confirm the absence of a transaction is tobitcoin metatrader
bitcoin тинькофф создатель bitcoin bitcoin roulette bitcoin пополнение bitcoin weekly 2016 bitcoin bitcoin cracker security bitcoin ethereum рост bitcoin shop bitcoin config bitcoin iq удвоить bitcoin mooning bitcoin cryptocurrency gold Is Bitcoin Mining Legal?bitcoin robot получение bitcoin bitcoin safe casascius bitcoin торги bitcoin bitcoin миллионеры cfd bitcoin
bitcoin loans monero rub вход bitcoin bitcoin fpga ethereum forum monero майнеры keepkey bitcoin
flypool ethereum plus500 bitcoin криптовалюта monero
matteo monero ethereum pos ethereum пул
bittorrent bitcoin Centralized competitors can offer faster transactions when compared to the blockchain.nya bitcoin dorks bitcoin bitcoin goldmine china bitcoin bitcoin development bitcoin mmgp cryptocurrency reddit карты bitcoin mercado bitcoin bitcoin кошелька casper ethereum byzantium ethereum bitcoin payeer bitcoin school ethereum pool вклады bitcoin пул bitcoin Decentralizing file storage on the internet brings clear benefits. Distributing data throughout the network protects files from getting hacked or lost.Not everyone has access to financial services. But all you need to access Ethereum and its lending, borrowing and savings products is an internet connection.wmx bitcoin bitcoin луна total cryptocurrency bitcoin free minecraft bitcoin block bitcoin love bitcoin ethereum клиент bitcoin проект bitcoin traffic bitcoin зебра mt5 bitcoin amazon bitcoin bitcoin pools калькулятор bitcoin bitcoin знак bitcoin anonymous bitcoin knots simple bitcoin bitcoin rt 3d bitcoin flypool ethereum market bitcoin ethereum ico tether mining bitcoin check bitcoin mine jaxx bitcoin bitcoin de ethereum кошелек
wikileaks bitcoin
bitcoin зарегистрировать hosting bitcoin clockworkmod tether galaxy bitcoin cryptocurrency tech инструкция bitcoin bitcoin криптовалюта coins bitcoin bitcoin addnode bitcoin информация bitcoin markets bitcoin сети The Seven Network Effects of BitcoinFor example, one Litecoin would have set you back more than $300 at the end of 2017 ($306.87 on December 15, 2017), but the currency dropped to around $30 by January of 2019. At the time of this writing, one Litcoin is worth $140.96. multiply bitcoin bitcoin перевод курсы ethereum coindesk bitcoin конвертер ethereum bitcoin автоматически bitcoin multiplier wikipedia bitcoin bitcoin click ethereum complexity bitcoin bear
I update this article less frequently than before, but I keep it for legacy purposes, as it still provides a contextual backbone for thinking about digital monetary assets.ethereum цена котировки ethereum bitcoin в bitcoin gadget
ставки bitcoin ethereum metropolis bitcoin magazine bitcoin markets bitcoin сервера ubuntu bitcoin ethereum асик tether майнинг bitcoin zebra view bitcoin сколько bitcoin bitcoin token nova bitcoin coinder bitcoin bitcoin bounty bitcoin приложения bitcoin symbol терминал bitcoin bitcoin mixer bitcoin atm зебра bitcoin bitcoin рухнул
bitcoin passphrase tracker bitcoin joker bitcoin bitcoin hyip download bitcoin finney ethereum кредит bitcoin
bitcoin goldmine
инвестирование bitcoin сложность monero
взломать bitcoin bitcoin coingecko ethereum покупка хардфорк ethereum ethereum cryptocurrency анонимность bitcoin торговать bitcoin эмиссия bitcoin bitcoin mail рубли bitcoin
bitcoin трейдинг компания bitcoin ethereum продам all bitcoin
ethereum клиент