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.
cryptocurrency mining аналоги bitcoin bitcoin doge автомат bitcoin bitcoin mercado ethereum calculator tether приложения network bitcoin иконка bitcoin bitcoin weekend bitcoin терминал rus bitcoin bitcoin cny flash bitcoin bitcoin перевести bitcoin funding golden bitcoin 100 bitcoin bitcoin currency ethereum майнить bitcoin сети основатель bitcoin account is similar in many exchanges and usually requires a passport copyвход bitcoin ios bitcoin ethereum studio gemini bitcoin monero xmr 4pda tether win bitcoin bitcoin удвоитель loco bitcoin
box bitcoin
bitcoin habr bitcoin php играть bitcoin bitcoin pools ethereum добыча теханализ bitcoin андроид bitcoin стратегия bitcoin iphone tether скачать bitcoin masternode bitcoin портал bitcoin moneybox bitcoin bitcoin ethereum ethereum токен bitcoin co bitcoin weekly
bootstrap tether monero blockchain bitcointalk bitcoin криптовалюты bitcoin master bitcoin количество bitcoin
кошельки ethereum se*****256k1 bitcoin bitcoin blockstream робот bitcoin iso bitcoin
ethereum course bitcoin india bitcoin film keyhunter bitcoin 0 bitcoin bitcoin weekly bitcoin hacking ethereum stats удвоитель bitcoin форк bitcoin bitcoin проект прогнозы bitcoin epay bitcoin
bitcoin crush криптовалют ethereum tp tether ethereum investing ethereum покупка mac bitcoin coinder bitcoin bloomberg bitcoin pull bitcoin ethereum online nxt cryptocurrency bio bitcoin описание ethereum bitcoin конвертер
bitcoin eth bitcoin суть Jobs4Bitcoins, part of reddit.combitcoin exchanges bitcoin nvidia робот bitcoin bitcoin vpn
bitcoin matrix fpga bitcoin
bitcoin favicon платформа bitcoin bitcoin игры click bitcoin взлом bitcoin sell bitcoin bitcoin россия
By JOHN P. KELLEHERnanopool ethereum android tether стоимость monero Blockchain records transaction (history, timestamp, date, etc.) of a product in a decentralized distributed ledger bitcoin poloniex
bitcoin инструкция
bitcoin goldmine настройка monero bitcoin бесплатные
bitcoin bcn
play bitcoin bitcoin 2017 bitcoin установка купить ethereum bitcoin тинькофф dice bitcoin bitcoin сигналы monero валюта Installing Ethereum softwarebitcoin monero bitcoin теханализ bitcoin рбк bitcoin оборот p2p bitcoin dwarfpool monero ethereum биткоин ethereum сайт bitcoin lottery pool bitcoin bitcoin neteller bitcoin wmz In contrast, academia has difficulty selling its inventions. For example, it's unfortunate that the original proof-of-work researchers get no credit for bitcoin, possibly because the work was not well known outside academic circles. Activities such as releasing code and working with practitioners are not adequately rewarded in academia. In fact, the original branch of the academic proof-of-work literature continues today without acknowledging the existence of bitcoin! Engaging with the real world not only helps get credit, but will also reduce reinvention and is a source of fresh ideas.cryptocurrency calculator torrent bitcoin community bitcoin bitcoin mmm bitcoin рейтинг coins bitcoin hosting bitcoin ethereum продам bitcoin dance bitcoin loto зарабатывать bitcoin nicehash bitcoin coinder bitcoin tera bitcoin bitcoin гарант casinos bitcoin bitcoin стоимость кошель bitcoin bitcoin скачать контракты ethereum monster bitcoin bitcoin сегодня биржи monero биржа ethereum bitcoin aliexpress bitcoin update cc bitcoin bitcoin смесители
tether coin ethereum токены 8 bitcoin monaco cryptocurrency While the system eventually catches the double-spending and negates the dishonest second transaction, if the second recipient transfers goods to the dishonest buyer before receiving confirmation of the dishonest transaction, then the second recipient loses the payment and the goods.bitcoin уязвимости bitcoin аналоги вывод ethereum air bitcoin cryptocurrency nem 2) You have to be the first miner to arrive at the right answer, or closest answer, to a numeric problem. This process is also known as proof of work. ethereum сложность metal bitcoin bitcoin reserve
ethereum block бесплатно bitcoin bitcoin оборот ethereum faucet wisdom bitcoin торги bitcoin bitcoin cnbc обменять ethereum bitcoin монеты
bitcoin конвертер monero bitcointalk блок bitcoin bitcoin bitcointalk statistics bitcoin отследить bitcoin bitcoin фирмы javascript bitcoin siiz bitcoin контракты ethereum ethereum pow ethereum ios будущее bitcoin лотерея bitcoin local ethereum bitcoin приложение bloomberg bitcoin satoshi bitcoin bitcoin legal bitcoin kurs
рулетка bitcoin играть bitcoin
monero сложность bitcoin neteller bitcoin investment 10000 bitcoin future bitcoin credit bitcoin bitcoin forbes ethereum видеокарты bitcoin stealer invest bitcoin
bitcoin video monero pro bitcoin коллектор difficulty bitcoin bitcoin зарегистрироваться bitcoin инструкция buy ethereum майнить ethereum bitcoin froggy bitcoin безопасность cran bitcoin spots cryptocurrency сколько bitcoin alpari bitcoin bitcoin lurk bitcoin играть bitcoin miner bitcoin вывод bitcoin sberbank bitcoin рухнул ethereum coins invest bitcoin bitcoin block mempool bitcoin
расшифровка bitcoin KEY TAKEAWAYSbitcoin rub bitcoin block
bitcoin markets mac bitcoin bitcoin express monero free cryptocurrency prices monero fr check bitcoin bitcoin price bitcoin development
The accounting layer in a money system implemented in financial cryptography is responsible for reliably holding and reporting the numbers for every transaction and producing an overall balance sheet of an issue.They also offer fraud protection that Bitcoin does not.перспективы bitcoin japan bitcoin аналитика bitcoin скрипты bitcoin flash bitcoin хардфорк monero redex bitcoin bitcoin clicks bitcoin получить trust bitcoin cryptocurrency calendar Mainstream computer scientists say Bitcoin is a step forward in their field, bringing together 30 years of prior work on anti-spam and timestamping systems. There remains no 'killer app' in sight, but the SEC has subpoenaed no fewer than 17 cryptocurrency sellers, issuers, and exchanges since 2013 for using the technology to defraud investors.bitcoin dollar
bitcoin usd bitcoin de bitcoin de bitcoin москва bitcoin calculator monero proxy bitcoin motherboard machines bitcoin tracker bitcoin bitcoin завести краны monero ethereum калькулятор car bitcoin king bitcoin gift bitcoin mindgate bitcoin
bio bitcoin bitcoin converter clame bitcoin dance bitcoin transactions bitcoin grayscale bitcoin bitcoin world coingecko ethereum bistler bitcoin cryptocurrency capitalisation shot bitcoin pokerstars bitcoin korbit bitcoin майнер monero
Ethereum allows users to build dApps and set up smart contracts. Smart contracts can guide lots of different types of transactions, including cryptocurrency trading. They could also be used to guide a company’s payroll, the rent agreement on your car, or even the purchase of a house.продам ethereum linux ethereum monero transaction bitcoin send trinity bitcoin bitcoin create компьютер bitcoin bitcoin location шахта bitcoin bitcoin coinmarketcap programming bitcoin курс ethereum bitcoin hacker asus bitcoin bitcoin simple bitcoin programming bitcoin сервисы copay bitcoin bitcoin calculator bittorrent bitcoin bitcoin кошелька *****p ethereum
tether limited monero xmr отзывы ethereum создатель bitcoin prune bitcoin падение ethereum использование bitcoin price bitcoin fasterclick bitcoin автосборщик bitcoin bitcoin сети microsoft bitcoin monero core bitcoin fpga
bitcoin onecoin bitcoin stock bitcoin javascript bitcoin сбербанк mining bitcoin bitcoin ebay bitcoin cz cryptocurrency trading трейдинг bitcoin bitcoin 100 location bitcoin ethereum bitcoin bitcoin вход bitcoin kran monero dwarfpool fork bitcoin monero ico bitcoin simple
криптовалюту bitcoin bitcoin asic майнер ethereum eID walletelectrum ethereum bitcoin mine биржа ethereum bitcoin trade 2018 bitcoin продам ethereum bitcoin suisse ethereum addresses account bitcoin
bitcoin кошелька free bitcoin ethereum прогнозы monero usd bitcoin магазины новые bitcoin заработать ethereum bitcoin удвоить ethereum coin bitcoin биржи tether usb
ethereum обозначение bitcoin игры up bitcoin bitcoin registration ethereum supernova 4pda tether
flypool monero plasma ethereum bitcoin buying bitcoin инвестирование bitcoin рубль bitcoin bcc bitcoin algorithm swarm ethereum bitcoin sha256 php bitcoin bitcoin co вклады bitcoin ethereum investing ethereum telegram bitcoin novosti bitcoin комиссия monero btc monero сложность bitcoin значок 3d bitcoin monero прогноз bitcoin msigna bitcoin etf bitcoin переводчик it bitcoin bitcoin cryptocurrency бесплатно ethereum подтверждение bitcoin bitcoin habr ethereum coin
bitcoin hashrate
ethereum акции multiply bitcoin cryptocurrency bitcoin new cryptocurrency майнинг monero bitcoin x bitcoin electrum bitcoin check bitcoin png токены ethereum raiden ethereum bitcoin rt платформа bitcoin bitcoin криптовалюта bitcoin genesis nvidia monero bitcoin ruble love bitcoin окупаемость bitcoin bitcoin алгоритм курса ethereum bitcoin значок bitcoin plus dance bitcoin аналоги bitcoin bitcoin 99 alliance bitcoin сбербанк bitcoin Multisignature walletqiwi bitcoin bitcoin компания токен bitcoin mt5 bitcoin bitcoin ваучер bitcoin зебра эмиссия ethereum bitcoin surf bitcoin rbc monero прогноз polkadot stingray bitcoin get ethereum charts bitcoin doubler matrix bitcoin ava bitcoin компания bitcoin
bitcoin rus доходность ethereum monero logo cardano cryptocurrency bitcoin phoenix бесплатный bitcoin bitcoin trezor bitcoin investment bitcoin fpga casino bitcoin bitcoin sberbank miner monero майнить ethereum reklama bitcoin эмиссия bitcoin ethereum покупка
ethereum прогнозы миксер bitcoin проект bitcoin bitcoin фермы legal bitcoin cryptocurrency market bitcoin видеокарты Travel the world: Because cryptocurrency isn’t tied to a specific country, traveling with crypto can cut down on money exchange fees. There’s already a small but thriving community of self-titled 'crypto nomads' who primarily, or in some cases exclusively, spend crypto when they travel.wei ethereum ethereum mist tether верификация If the sender sent some amount of Ether as value with the transaction, setting the account balance to that valuemonero mining
ethereum обменять падение ethereum ethereum bitcoin ethereum miners bitcoin sportsbook bitcoin ads bitcoin boxbit wallet cryptocurrency создатель bitcoin
bitcoin gif bitcoin slots валюты bitcoin разработчик bitcoin
эпоха ethereum bitcoin genesis monero address bitcoin cnbc accepts bitcoin bitcoin project monero rur trade cryptocurrency bitcoin paw
платформу ethereum bitcoin официальный bitcoin принцип bitcoin all пулы bitcoin
ethereum nicehash bitcoin frog ethereum complexity лучшие bitcoin
bitcoin p2p взлом bitcoin bitcoin bloomberg blue bitcoin часы bitcoin алгоритм ethereum bitcoin cash weekly bitcoin laundering bitcoin создатель bitcoin Tax Treatment Lifts Volatilitybitcoin калькулятор символ bitcoin tether addon
логотип bitcoin bitcoin купить analysis bitcoin ethereum dark ферма ethereum bitcoin рублей новый bitcoin bitcoin puzzle майнить bitcoin calculator ethereum eos cryptocurrency ethereum клиент 1000 bitcoin pay bitcoin Given the dynamic nature of the market, the emerging legal and regulatory climate, and the sheer volatility of crypto assets, it can be a daunting task to define the space or even understand the strategic rationale of introducing a cryptocurrency into an organization. This is especially true for directors and executives who may not be well versed in cryptocurrencies, their limitations, or even the underlying technology—not to mention the regulatory, risk, accounting, data security, and tax considerations that arise when dealing with a new asset class or service offering.ethereum бесплатно zcash bitcoin ethereum асик bitcoin security вложить bitcoin
monero биржи bitcoin poker bitcoin golden фильм bitcoin bitcoin bat se*****256k1 ethereum the ethereum bitcoin список bitcoin prune bitcoin видеокарта ethereum shares bitcoin multiplier ферма ethereum bitcoin заработок bitcoin wmx programming bitcoin monero client cfd bitcoin tether кошелек bitcoin box инвестиции bitcoin alpari bitcoin ethereum course *****ko Wilcox-O’Hearn: DigiCash developer, Founder of Zcashдобыча bitcoin