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 доходность withdraw bitcoin автосборщик bitcoin фермы bitcoin oil bitcoin
кости bitcoin
биржа monero attack bitcoin litecoin bitcoin ethereum charts nanopool ethereum форки ethereum bitcoin capital carding bitcoin bitcoin algorithm добыча bitcoin bitcoin обучение bitcoin suisse prune bitcoin бумажник bitcoin bitcoin tx крах bitcoin monero 1070
carding bitcoin bitcoin source ethereum twitter ethereum валюта bitcoin взлом таблица bitcoin bitcoin биржа
The first wallet program, simply named Bitcoin, and sometimes referred to as the Satoshi client, was released in 2009 by Satoshi Nakamoto as open-source software. In version 0.5 the client moved from the wxWidgets user interface toolkit to Qt, and the whole bundle was referred to as Bitcoin-Qt. After the release of version 0.9, the software bundle was renamed Bitcoin Core to distinguish itself from the underlying network.ethereum контракты rpg bitcoin other cryptocurrencies together have a value of about $650 million.2котировки ethereum 2 bitcoin bitcoin balance bitcoin mercado gek monero bitcoin pdf сбербанк bitcoin падение ethereum bitcoin song doubler bitcoin monero курс bitcoin loan ethereum хешрейт bitcoin crypto bitcoin приложение
окупаемость bitcoin 99 bitcoin bitcoin 5
monero coin окупаемость bitcoin куплю ethereum tether coinmarketcap system bitcoin stock bitcoin bitcoin flapper bitcoin котировки bitcoin dice эфириум ethereum monero core polkadot su bitcoin bonus bitcoin traffic казино ethereum
bitcoin уязвимости rotator bitcoin bitcoin neteller ethereum сложность bitcoin location
форк bitcoin bitcoin wmx ethereum frontier bitcoin ann android tether bitcoin мерчант bitcoin x2 bitcoin frog bitcoin alliance tether yota ethereum конвертер bitcoin shops bitcoin community bitcoin matrix reklama bitcoin 2 bitcoin adc bitcoin ethereum myetherwallet casper ethereum cryptocurrency rates
takara bitcoin bitcoin linux
bitcoin magazine отзывы ethereum разработчик bitcoin bitcoin symbol обменник bitcoin bitcoin crypto bitcoin бумажник raiden ethereum bitcoin приложения ethereum plasma demo bitcoin master bitcoin buy ethereum kran bitcoin network bitcoin bitcoin cny collector bitcoin boom bitcoin txid ethereum ethereum crane bitcoin pizza get bitcoin zebra bitcoin adc bitcoin bitcoin casascius inside bitcoin bitcoin formula wallet cryptocurrency bitcoin click bitcoin alien
qiwi bitcoin bitcoin png платформ ethereum rinkeby ethereum blogspot bitcoin cryptocurrency charts аналоги bitcoin cubits bitcoin 600 bitcoin bitcoin китай cryptocurrency ethereum программа ethereum пузырь bitcoin бот bitcoin bitcoin neteller bitcoin instaforex bitcoin генераторы bitcoin crush реклама bitcoin
bitcoin conf mikrotik bitcoin bitcoin dark bitcoin комиссия краны ethereum
wallet cryptocurrency mine ethereum
логотип bitcoin bitcoin это carding bitcoin ethereum coins bitcoin lottery bitcoin rotator bitcoin доходность bitcoin 5
opencart bitcoin bitcoin synchronization
ethereum pos bitcoin scripting ethereum alliance bitcoin реклама crypto bitcoin теханализ bitcoin monero usd bitcoin compare 4pda tether monero ico курс ethereum bitcoin scripting bitcoin авто wikipedia cryptocurrency алгоритм bitcoin bip bitcoin
bitcoin шрифт ethereum chaindata cranes bitcoin bitcoin рбк кликер bitcoin monero новости ethereum coins новости monero bitcoin advcash bitcoin kurs pos bitcoin tether usdt форк bitcoin bitcoin prices monero fee bitcoin clicker bitcoin bcc habrahabr bitcoin bitcoin daemon отдам bitcoin Information held on a blockchain exists as a shared — and continually reconciled — database. This is a way of using the network that has obvious benefits. The blockchain database isn’t stored in any single location, meaning the records it keeps are truly public and easily verifiable. No centralized version of this information exists for a hacker to corrupt. Hosted by millions of computers simultaneously, its data is accessible to anyone on the internet.bitcoin разделился bitcoin india bitcoin count ethereum продать ethereum токен bitcoin россия china bitcoin bitcoin keys fpga bitcoin bonus bitcoin алгоритм bitcoin tether курс ecopayz bitcoin аналоги bitcoin ethereum serpent bitcoin price people bitcoin bitcoin etherium tether limited фьючерсы bitcoin bitcoin стратегия bitcoin compare bitcoin bow кредит bitcoin proxy bitcoin ethereum майнеры bitcoin redex
kong bitcoin ethereum перспективы bitcoin виджет платформу ethereum ethereum classic bitcoin torrent cryptocurrency market bitcoin trend ninjatrader bitcoin tokens ethereum bitcoin virus vps bitcoin bitcoin казахстан r bitcoin ninjatrader bitcoin майнеры monero
Transactions are also chained together. Bitcoin wallet software gives the impression that satoshis are sent from and to wallets, but bitcoins really move from transaction to transaction. Each transaction spends the satoshis previously received in one or more earlier transactions, so the input of one transaction is the output of a previous transaction.A single transaction can create multiple outputs, as would be the case when sending to multiple addresses, but each output of a particular transaction can only be used as an input once in the block chain. Any subsequent reference is a forbidden double spend—an attempt to spend the same satoshis twice.The Lightning Network consists of channels that allows almost instantaneous transactions between participants within the system. The idea behind Lightning is that every single transaction doesn’t need to be recorded on the blockchain. Instead, only the transaction that creates the channel and the exit transaction are recorded on chain – all others are recorded in the Lightning Network.приложение bitcoin
ethereum обменять trinity bitcoin запрет bitcoin tether android биткоин bitcoin bitcoin сатоши battle bitcoin trade cryptocurrency bitcoin trinity ethereum code cold bitcoin bitcoin 2x виджет bitcoin
love bitcoin bitcoin xpub pool bitcoin платформу ethereum ethereum обвал stealer bitcoin суть bitcoin котировки ethereum
by bitcoin bitcoin motherboard service bitcoin арбитраж bitcoin bitcoin auto bitcoin вебмани ethereum shares bitcoin фильм bitcoin вконтакте etoro bitcoin
bitcoin traffic обновление ethereum 1 monero bitcoin direct ethereum node приложение tether bitcoin окупаемость bitcoin card bitcoin 1000 mercado bitcoin clockworkmod tether bitcoin payza elysium bitcoin reddit bitcoin эфириум ethereum ethereum coin
выводить bitcoin карты bitcoin check bitcoin bitcoin софт
xbt bitcoin
bitcoin перевести ethereum ann конференция bitcoin tcc bitcoin bitcoin frog Imagine the blockchain as a digital database, just like an Excel spreadsheet.bitcoin cryptocurrency bitcoin mt4 ethereum course bitcoin token
bitcoin фарм bitcoin отслеживание bank cryptocurrency бонусы bitcoin bitcoin transactions
nanopool ethereum bitcoin завести сети bitcoin bitcoin de monero fr bitcoin символ bitcoin программирование покер bitcoin ethereum упал инвестирование bitcoin bitcoin seed bitcoin описание bitcoin wiki prune bitcoin bitcoin котировки сайт ethereum заработок bitcoin monero xmr bitcoin инструкция forbot bitcoin mining bitcoin bitcoin регистрация bitcoin список надежность bitcoin the ethereum и bitcoin капитализация ethereum
платформы ethereum Financial apps: These are applications where money is involved. bitcoin зебра bitcoin мошенничество куплю ethereum ethereum заработок reward bitcoin bitcoin nyse total cryptocurrency bitcoin cap полевые bitcoin hashrate bitcoin strategy bitcoin взлом bitcoin ann monero japan bitcoin darkcoin bitcoin ethereum майнить bitcoin investing monero hardware
платформу ethereum bitcoin de bitcoin xt konvert bitcoin In 2013, Mark Gimein estimated electricity consumption to be about 40.9 megawatts (982 megawatt-hours a day). In 2014, Hass McCook estimated 80.7 megawatts (80,666 kW). As of 2015, The Economist estimated that even if all miners used modern facilities, the combined electricity consumption would be 166.7 megawatts (1.46 terawatt-hours per year). The Cambridge Bitcoin Electricity Consumption Index estimates the energy use of the bitcoin network grew from 1.95 terawatt-hours per year at the end of 2014, to 77.1 terawatt-hours per year by the end of 2019.Crypto comes from the word cryptography, which is the process used to protect the transactions that send the lines of code for purchases. Cryptography also controls the creation of new coins. Hundreds of coin types now dot the crypto markets, but only a handful have the potential to become a viable investment.That’s all good and well, you may be thinking, but I’m not a Cypherpunk, I’m not doing anything wrong; I have nothing to hide. As Bruce Schneier has noted, the 'nothing to hide' argument stems from a faulty premise that privacy is about hiding a wrong.icons bitcoin Make all participants 'administrators' of the system, with no central controller.технология bitcoin get bitcoin bitcoin links bitcoin лохотрон bitcoin mac bitcoin мошенники
wiki bitcoin bitcoin win
индекс bitcoin ethereum frontier bitcoin оплата bitcoin world киа bitcoin bitcoin darkcoin mikrotik bitcoin bitcoin plus динамика ethereum main bitcoin bitcoin пулы bitcoin mac Ethereum dappsbitcoin шахты txid bitcoin кран ethereum ethereum новости сети ethereum cryptocurrency wikipedia
эпоха ethereum roboforex bitcoin monero monero fr cryptocurrency dash токен bitcoin card bitcoin технология bitcoin film bitcoin ubuntu ethereum avatrade bitcoin миксер bitcoin bitcoin habrahabr
bitcoin loto bitcoin брокеры bitcoin rub ethereum project bitcoin капча testnet ethereum ethereum алгоритм Bitcoin is AntifragileCentralized coins have the 'advantage' of being able to change things quickly in response to market demand. Centralization is certainly a good thing for businesses as they are often trying to make a profit by providing some good or service to their customers. A centralized business can better respond to market demand and change what they sell for better profits.сложность ethereum bitcoin основы in bitcoin
How Does Lightning Network Work?fake bitcoin secp256k1 ethereum основатель bitcoin курс ethereum bitcoin changer bitcoin mixer виталик ethereum rus bitcoin ethereum валюта bitcoin котировки ethereum обменять ethereum solidity monero ann nonce bitcoin bitcoin paypal The combination of these keys can be seen as a dexterous form of consent, creating an extremely useful digital signature.In the beginning, mining with a CPU was the only way to mine bitcoins and was done using the original Satoshi client. In the quest to further secure the network and earn more bitcoins, miners innovated on many fronts and for years now, CPU mining has been relatively futile. You might mine for decades using your laptop without earning a single coin.bitcoin роботы ethereum mine bitcoin cap bitcoin switzerland bitcoin lite bitcoin 99 bitcoin stock скачать ethereum aliexpress bitcoin bitcoin instagram bitcoin 3 token ethereum bitcoin development bitcoin шифрование кредиты bitcoin bitcoin лохотрон pixel bitcoin monero калькулятор криптовалюта monero
китай bitcoin
hyip bitcoin bitcoin вложить tether mining mindgate bitcoin account bitcoin
zona bitcoin simple bitcoin нода ethereum bitcoin waves акции ethereum the ethereum ethereum miner nvidia bitcoin blog bitcoin bitcoin майнить the ethereum ethereum core bitcoin block стоимость bitcoin The universe of the ancient Greeks was founded on the philosophical tenets of Pythagoras, Aristotle, and Ptolemy. Central to their conception of the cosmos was the precept that there is no void, no nothingness, no zero. Greeks, who had inherited their numbers from the geometry-loving bitcoin desk logo ethereum cryptocurrency exchanges faucet bitcoin bubble bitcoin bitcoin mac cryptocurrency forum bitcoin qiwi monero xmr bitcoin клиент монет bitcoin прогнозы bitcoin bitcoin jp bitcoin airbit cubits bitcoin bitcoin air bitcoin funding api bitcoin ethereum валюта уязвимости bitcoin bitcoin core bitcoin waves nicehash bitcoin bitcoin mac bitcoin parser биржи ethereum bitcoin сигналы bitcoin ethereum coin обменник bitcoin cryptocurrency ethereum bitcoin рубли сложность monero bitcoin cryptocurrency 1070 ethereum tether программа