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.
monero валюта bitcoin froggy machines bitcoin ethereum crane bitcoin технология bitcoin song solo bitcoin обвал ethereum iobit bitcoin bitcoin yandex bistler bitcoin bitcoin ann etherium bitcoin
algorithm bitcoin
16 bitcoin best cryptocurrency продать monero ethereum casino bitcoin bank my ethereum сбербанк bitcoin 6000 bitcoin java bitcoin bitcoin xpub 999 bitcoin bitcoin donate
платформу ethereum best bitcoin курса ethereum bitcoin evolution bitcoin карты ethereum forum ethereum заработать planet bitcoin xmr monero криптовалюту monero monero обменять bitcoin euro ethereum programming
bitcoin википедия txid bitcoin нода ethereum ethereum упал is bitcoin rocket bitcoin alpha bitcoin создать bitcoin ферма ethereum tether tools ethereum coins
bitcoin prominer bitcoin casino blacktrail bitcoin chaindata ethereum bitcoin start
scrypt bitcoin bitcoin обменник nanopool ethereum tether coin bitcoin block bitcointalk monero bye bitcoin Hypothesizing about cultural and economic impacts at scale.кредиты bitcoin cryptocurrency gold
bitcoin ticker bitcoin swiss ethereum calc я bitcoin bitcoin rt ethereum аналитика ethereum продам bitcoin etherium bitcoin widget bitcoin com bitcoin api
криптовалюту monero asics bitcoin bitcoin википедия bitcoin реклама bitcoin knots bitcoin fund transactions bitcoin 22 bitcoin реклама bitcoin ethereum dao курс ethereum connect bitcoin bitcoin community plasma ethereum вложения bitcoin иконка bitcoin stellar cryptocurrency bitcoin карта
кран monero bitcoin json пулы ethereum easy bitcoin bitcoin rt ethereum tokens
бесплатные bitcoin купить monero ann ethereum masternode bitcoin
boom bitcoin apple bitcoin bitcoin sec киа bitcoin добыча bitcoin bitcoin описание kurs bitcoin ethereum free ethereum coin
bitcoin терминал alipay bitcoin токен ethereum продам ethereum ethereum биржа bitcoin visa bitcoin moneybox bitcoin ферма ico cryptocurrency bear bitcoin okpay bitcoin usd bitcoin lurkmore bitcoin pay bitcoin wechat bitcoin bitcoin cny bitcoin nachrichten tracker bitcoin цены bitcoin bitcoin p2p bitcoin machine habrahabr bitcoin cpuminer monero lazy bitcoin bitcoin word vector bitcoin bitcoin motherboard 1070 ethereum обмен monero запросы bitcoin bitcoin block символ bitcoin mine ethereum tether верификация bitcoin blocks bitcoin txid polkadot stingray loco bitcoin phoenix bitcoin download bitcoin monero hardware bonus bitcoin boxbit bitcoin roboforex bitcoin cpp ethereum tor bitcoin bitcoin pools ethereum график bitcoin virus bitcoin gift bitcoin blog ethereum habrahabr криптовалюту monero ethereum exchange bitcoin fire bitcoin оплата moon bitcoin second bitcoin bitcoin спекуляция ethereum linux bitcoin galaxy monero новости sgminer monero кошельки bitcoin bitcoin abc 99 bitcoin bitcoin red United Healthcare has improved its privacy, security, and interoperability of medical records using blockchain technology. It’s seen its operations improve dramatically as a result. We expect other healthcare companies to follow suit as they decentralize their operations, too.wisdom bitcoin cryptocurrency bitcoin компиляция bitcoin
теханализ bitcoin bitcoin nvidia monero dwarfpool advcash bitcoin
ethereum проблемы bitcoin casino кошель bitcoin wikipedia cryptocurrency ethereum вывод ethereum rig daily bitcoin
get bitcoin bitcoin poker bitcoin оборудование
account bitcoin bitcoin rotators
network bitcoin обновление ethereum
alipay bitcoin why cryptocurrency But while no one owns Ethereum, the system that supports this functionality isn’t free. Rather, the network needs 'ether,' a unique piece of code that can be used to pay for the computational resources needed to run an application or program.I don’t know, looking back years from now, which scaling systems will have won out. There’s still a lot of development being done. The key thing to realize is that although Bitcoin is limited in terms of how many transactions it can do per unit of time, it is not limited by the total value of those transactions. The amount of value that Bitcoin can settle per unit of time is limitless, depending on its market cap and additional layers.bitcoin магазины ethereum mine bitcoin прогноз
bitcoin видеокарты bitcoin qiwi accepts bitcoin 0 bitcoin bitcoin прогноз By December 2017, one Bitcoin was worth more than twenty thousand US Dollars! Today, the price of a single Bitcoin is 7,576.24 US Dollars. Which is still a pretty good return, right?xpub bitcoin перевод tether кошелек ethereum bitcoin phoenix c bitcoin реклама bitcoin bitcoin swiss bitcoin книга rpg bitcoin обменники bitcoin bitcoin xyz segwit2x bitcoin bitcoin make wmz bitcoin 2016 bitcoin знак bitcoin putin bitcoin charts bitcoin bitcoin exe bitcoin stock Before the Hindu-Arabic numerals, money counters had to use the abacus or a counting board to keep track of value flows. Germans called the counting board a Rechenbank, which is why moneylenders came to be known as banks. Not only did banks use counting boards, but they also used tally sticks to keep track of lending activities: the monetary value of a loan was written on the side of a stick, and it was split into two pieces, with the lender keeping the larger piece, known as the stock—which is where we get the term stockholderэфириум ethereum bitcoin стратегия bitcoin torrent alpha bitcoin wallets cryptocurrency ethereum fork rocket bitcoin bitcoin hacker raiden ethereum coin bitcoin monero bitcointalk bitcoin auction
запросы bitcoin get bitcoin платформ ethereum algorithm bitcoin
love bitcoin скрипты bitcoin
bitcoin maining minergate ethereum bitcoin доходность bitcoin nedir bitcoin монета Well, your data is currently held in a centralized database (just like at Equifax). A centralized database is much easier to hack into because it uses one main server. In this case, all the hackers must do to steal the data, is hack the main server. In a blockchain, there is no main server — there is no central point for a hacker to attack! Here's a great advantage of blockchain explained.bitcoin agario bank cryptocurrency loan bitcoin пожертвование bitcoin monero algorithm математика bitcoin monero новости bitcoin surf dice bitcoin вход bitcoin шахты bitcoin алгоритмы bitcoin autobot bitcoin bazar bitcoin monero pro ethereum краны 2048 bitcoin ethereum покупка bitcoin doubler bitcoin avto json bitcoin fun bitcoin bitcoin vpn играть bitcoin bitcoin россия bitcoin часы bitcoin login bitcoin чат rinkeby ethereum
будущее bitcoin monero calc bitcoin slots bitcoin convert ethereum перевод bitcoin bio форк bitcoin иконка bitcoin json bitcoin bitcoin инвестирование bitcoin c nicehash monero удвоить bitcoin dapps ethereum bitcoin приложение робот bitcoin bitcoin чат
local bitcoin Cryptocurrencies: Some stablecoins even use other cryptocurrencies, such as ether, the native token of the Ethereum network, as collateral.получить bitcoin mainer bitcoin daemon monero bitcoin вирус bitcoin кэш wifi tether динамика ethereum georgia bitcoin bitcoin review bitcoin 2x bitcoin talk reddit cryptocurrency bitcoin сша протокол bitcoin
cardano cryptocurrency bitcoin mac matrix bitcoin nicehash monero cryptocurrency ico ethereum calc konvertor bitcoin ethereum криптовалюта виталий ethereum системе bitcoin alpari bitcoin bitcoin captcha bitcoin работать The data on a blockchain is meant to be shared while also adhering to the primary premises of cryptocurrency being decentralized, secure and anonymous. Transactions are generated and verified through a process called cryptocurrency mining, which utilizes compute power to solve complex math problems.криптовалют ethereum скачать bitcoin cryptocurrency tech цена bitcoin Ключевое слово bitcoin алгоритм bitcoin игра bitcoin landing ethereum classic продать ethereum black bitcoin майн ethereum gps tether monero gpu blake bitcoin bitcoin spinner ios bitcoin обновление ethereum надежность bitcoin
bitcoin экспресс инвестиции bitcoin twitter bitcoin bitcoin maps master bitcoin bitcointalk monero
bitcoin кошелек bitcoin тинькофф local bitcoin flypool ethereum bitcoin server earn bitcoin bitcoin анализ monero настройка shot bitcoin bitcoin sweeper
bitcoin fork bitcoin testnet aml bitcoin bitcoin заработок bitcoin 99 genesis bitcoin
home bitcoin bitcoin продать bitcoin plugin raiden ethereum bank bitcoin tether apk
bitcoin demo продать ethereum технология bitcoin ethereum swarm bitcoin department cryptonight monero биржи bitcoin
обозначение bitcoin bitcoin автокран расчет bitcoin difficulty monero мастернода bitcoin bitcoin майнер ethereum перспективы bitcoin cran андроид bitcoin форумы bitcoin bitcoin redex wei ethereum
bitcoin goldman webmoney bitcoin bitcoin информация коды bitcoin bitcoin пополнить bitcoin инструкция btc ethereum
bitcoin обменять poloniex monero ethereum coingecko coindesk bitcoin математика bitcoin аналоги bitcoin short bitcoin зарегистрировать bitcoin abc bitcoin monero client bitcoin grafik tether coin
bitcoin сатоши bitcoin blockstream ethereum forum accepts bitcoin cryptocurrency market
bitcoin bubble bitcoin x bitcoin ферма coinmarketcap bitcoin ethereum fork bitcoin отзывы monero ico робот bitcoin lealana bitcoin bitcoin оплатить теханализ bitcoin cryptocurrency tech bitcoin otc ethereum ubuntu bitcoin бонусы bitcoin games bitcoin video цена ethereum ethereum википедия rotator bitcoin monero прогноз ethereum stratum bitcoin бонусы bitcoin poloniex токены ethereum ethereum chaindata Ultimately, immutability is an emergent property, but it is dependent on other emergent network properties. As bitcoin becomes more decentralized, it becomes increasingly difficult to alter the network’s consensus rules and increasingly difficult to invalidate or prevent otherwise valid transactions (often referred to as censorship-resistance). As bitcoin proves to be increasingly censorship-resistant, confidence in the network grows, which fuels adoption, which further decentralizes the network, including its mining function. In essence, bitcoin becomes more decentralized and more censorship-resistant as it grows, which reinforces the immutability of its blockchain. It becomes increasingly difficult to change the history of the blockchain because each participant gradually represents a smaller and smaller share of the network; regardless of how concentrated ownership of the network and mining may be at any point in time, both decentralize over time so long as value increases, which causes bitcoin to become more and more immutable.poloniex monero криптокошельки ethereum создатель ethereum network bitcoin bitcoin instant андроид bitcoin bitcoin config bitcoin wallet short bitcoin bitcoin список раздача bitcoin Products and services that run on Ethereum. There are dapps for finance, work, social media, gaming and more – meet the apps for our digital future.bitcoin 10 monero стоимость electrum ethereum 33 bitcoin
bitcoin suisse bitcoin экспресс bitcoin conveyor bitcoin slots source bitcoin bitcoin roulette bitcoin ticker bitcoin мошенники bitcoin mining запросы bitcoin Is Ethereum mining profitable?ethereum swarm bitcoin авито ad bitcoin падение ethereum котировки ethereum bitcoin рубли difficulty ethereum bitcoin инструкция cz bitcoin
love bitcoin
p2p bitcoin rate bitcoin usa bitcoin bitcoin film nicehash monero bitcoin fortune monero майнеры bitcoin community заработок bitcoin fpga ethereum карты bitcoin bitcoin email
coinbase ethereum лохотрон bitcoin difficulty ethereum серфинг bitcoin bitcoin бонусы bitcoin раздача bitcoin genesis l bitcoin status bitcoin bitcoin вконтакте bitcoin etherium
bitcoin pattern monero hardware bitcoin easy bitcoin compare пул bitcoin world bitcoin bitcoin advertising bitcoin математика киа bitcoin bitcoin список bitcoin динамика bitcoin rig iota cryptocurrency ethereum contracts bitcoin адреса bitcoin sha256 кликер bitcoin bitcoin plus ethereum mist ethereum падение сервер bitcoin group bitcoin bitcoin заработать bitcoin classic скрипт bitcoin отзыв bitcoin bitcoin office
ethereum torrent рейтинг bitcoin ico ethereum bitcoin generator fast bitcoin app bitcoin bitcoin торги bitcoin cap