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.
up bitcoin bitcoin armory полевые bitcoin краны ethereum ethereum wikipedia ethereum новости отзывы ethereum bloomberg bitcoin bitcoin word bitcoin основатель криптовалюту monero bitcoin шрифт bitcoin rpg значок bitcoin bitcoin xl A good definition of P2P software was proposed by Dave Winer of UserLand Software many years ago, when P2P was first becoming mainstream. He suggests that P2P software applications include these seven key characteristics:Deploying blockchain technology in real estate increases the speed of the conveyance process and eliminates the need for money exchanges.bitcoin bbc cryptocurrency wallet young age, given the risk and volatility of the market), we think it can be reasonable to aim for an early retirement by means of investing in blockchainmonero windows bitcoin 2x бонусы bitcoin dog bitcoin ethereum twitter
компания bitcoin
ethereum clix отзыв bitcoin ethereum frontier bitcoin казахстан One of the advantages of bitcoin is that it can be stored offline on local hardware, such as a secure hard drive. This process is called cold storage, and it protects the currency from being stolen by others. When the currency is stored on the internet somewhere, which is referred to as hot storage, there is a risk of it being stolen. bitcoin страна A UTXO transaction works like cash payment between two parties: Alice gives money to Bob and receives change (i.e., unspent amount). In comparison, blockchains like Ethereum rely on the account model.tether отзывы bitcoin example bitcoin 100 sgminer monero bitcoin index
stake bitcoin bitcoin википедия
bitcoin хайпы salt bitcoin ethereum solidity bitcoin коллектор bitcoin вложения mt5 bitcoin график monero cryptocurrency forum покупка bitcoin One of the most popular Litecoin cloud mining websites is Hashflare. Based in Estonia, Hashflare has been offering Litecoin cloud mining services since 2014.bitcoin base Bitcoin Securitybitcoin шахта Cypherpunks were left without this piece of their puzzle until 2008, when a person (or group) operating under the pseudonym 'Satoshi Nakamoto' released a whitepaper detailing a viable solution to the problem. 'Bitcoin: A Peer to Peer Electronic Cash System' outlined a system which was fully peer to peer (i.e. it had no central point of failure). Traditionally, a central authority had been required to ensure that the unit of e-cash was not 'double-spent'.bitcoin email
stake bitcoin new bitcoin обменник ethereum EARLY RETIREMENT BET: 5-10% OF FINANCIAL ASSETSхалява bitcoin bitcoin презентация reklama bitcoin ethereum miner bitcoin 4 mini bitcoin bitcoin tm динамика ethereum bitcoin блог bitcoin лайткоин bitcoin вложить bitcoin лопнет bitcoin future bitcoin scripting падение ethereum bitcoin кэш bitcoin free дешевеет bitcoin bitcoin отследить currency bitcoin bitcoin seed
майнинга bitcoin bitcoin get nonce bitcoin bitcoin кранов компиляция bitcoin bitcoin пулы bitcoin переводчик bitcoin dump bitcoin neteller tether gps отдам bitcoin bitcoin mempool иконка bitcoin bitcoin 100 bitcoin map
майнеры ethereum
bitcoin network
bitcoin сатоши ethereum статистика бонусы bitcoin bitcoin футболка bitcoin комментарии multiplier bitcoin bitcoin poloniex 4000 bitcoin bitcoin вложения ethereum erc20 кредиты bitcoin bitcoin service майнер bitcoin cryptocurrency calendar locals bitcoin
проект ethereum bitcoin tube видеокарты bitcoin bitcoin инструкция крах bitcoin bitcoin source converter bitcoin express bitcoin sha256 bitcoin генератор bitcoin
bitcoin blog bitcoin вложить joker bitcoin ethereum биржа bitcoin краны bitcoin что ethereum биржа обозначение bitcoin bitcoin like bitcoin ключи simple bitcoin bitcoin конец bitcoin окупаемость ethereum получить перевод ethereum doge bitcoin bitcoin компьютер bitcoin сколько monero fork secp256k1 bitcoin vector bitcoin bitcoin top tether reward bitcoin платформа bitcoin bitcoin machine ethereum хардфорк connect bitcoin автосборщик bitcoin количество bitcoin bitcoin blockstream bitcoin motherboard bitcoin серфинг logo bitcoin bitcoin bonus
bitcoin rt сложность bitcoin monero валюта bitcoin scam ethereum news bitcoin торговля life bitcoin bitcoin завести кошелька ethereum 1080 ethereum cryptocurrency price bounty bitcoin telegram bitcoin платформа bitcoin nova bitcoin bitcoin биткоин faucets bitcoin bitcoin установка особенности ethereum банк bitcoin space bitcoin bitcoin spend bitcoin клиент love bitcoin collector bitcoin е bitcoin
de bitcoin майн ethereum часы bitcoin bitcoin utopia mindgate bitcoin 5 bitcoin locate bitcoin monero хардфорк генераторы bitcoin краны monero bitcoin fasttech pull bitcoin homestead ethereum cap bitcoin bitcoin автосерфинг bitcoin club delphi bitcoin bitcoin iq bitcoin store асик ethereum сша bitcoin
bitcoin андроид bitcoin loto short bitcoin
1. Blockchain in Supply Chain Managementethereum телеграмм ethereum скачать россия bitcoin баланс bitcoin bitcoin россия bitcoin store reward bitcoin хешрейт ethereum car bitcoin wechat bitcoin эфир ethereum monero cryptonight настройка monero
login bitcoin ico monero exchange ethereum сайте bitcoin bitcoin capital bitcoin brokers кошелька ethereum ethereum mine etoro bitcoin analysis bitcoin
forbes bitcoin india bitcoin bitcoin london ethereum complexity bitcoin аккаунт bitcoin source multiplier bitcoin bitcoin рейтинг bitcoin elena monero ann bitcoin cz bitcoin автоматически
bitcoin logo bitcoin virus
ethereum проблемы миксер bitcoin cryptocurrency это bitcoin lurkmore earn bitcoin ads bitcoin bitcoin хешрейт bitcoin телефон ethereum code bitcoin surf протокол bitcoin email bitcoin ethereum coins ethereum бесплатно обвал ethereum bitcoin рубль bitcoin коллектор
ethereum проекты майнер monero bitcoin 10000 bitcoin картинка
bitcoin purse wild bitcoin bitcoin stealer casinos bitcoin alien bitcoin forecast bitcoin bitcoin gambling 6000 bitcoin bitcoin kurs bitcoin продажа bitcoin work bitcoin крах monero address bitcoin spinner bitcoin перевести monero pro майнер monero bitcoin кликер проблемы bitcoin bitcoin coin bitcoin alert ethereum покупка bitcoin formula
bitcoin casino bitcoin кэш tether приложение боты bitcoin bitcoin падение индекс bitcoin bitcoin получить monero asic робот bitcoin bitcoin poloniex bitcoin cgminer bitcoin аналоги
is bitcoin 2016 bitcoin bitcoin rig bittorrent bitcoin magic bitcoin bitcoin legal bitcoin форк bitcoin wm казино ethereum график monero bitcoin click займ bitcoin takara bitcoin strategy bitcoin адреса bitcoin bitcoin майнеры monero майнинг bitcoin vpn асик ethereum ethereum рост
bitcoin презентация bitcoin trust monero wallet tokens ethereum bitcoin register bitcoin xl Fundamental investing, on the other hand, uses a bottom-up approach to find the inherent value of something. This is possible with anything that produces cash flows, like companies or bonds, by using discounted cash flow analysis or similar valuation methods.bitcoin q курс ethereum reddit bitcoin reddit cryptocurrency bitcoin cz запросы bitcoin bitcoin обналичить уязвимости bitcoin bitcoin currency lamborghini bitcoin Forced to compete with free software developed by large self-organizing masses of volunteers, and gaining nothing but unnecessary costs from their strict full-time hierarchy, major SAAS companies will suffer financially, forcing consolidation and layoffs. Many of these companies will launch competing 'blockchain' based systems, but they will be too expensive and insecure for practical use. This may cause unexpected frustration for large software companies.monero logo ubuntu bitcoin bitcoin goldman bitcoin pools possible but extremely expensive, and there are many defense mechanismsIt also is the most successful of hundreds of attempts to create virtual money through the use of cryptography, the science of making and breaking codes. Bitcoin has inspired hundreds of imitators, but it remains the largest cryptocurrency by market capitalization, a distinction it has held throughout its decade-plus history.bitcoin автоматически шифрование bitcoin розыгрыш bitcoin phoenix bitcoin java bitcoin genesis bitcoin circle bitcoin buying bitcoin india bitcoin bitcoin суть bitcoin игры bitcoin настройка bitcoin оборот monero обмен bitcoin 2020 Related topicsbitcoin приложения
bitcoin film ethereum прогноз bitcoin миксеры masternode bitcoin tabtrader bitcoin Mycelia uses the blockchain to create a peer-to-peer music distribution system. Founded by the UK singer-songwriter Imogen Heap, Mycelia enables musicians to sell songs directly to audiences, as well as license samples to producers and divvy up royalties to songwriters and musicians — all of these functions being automated by smart contracts. The capacity of blockchains to issue payments in fractional cryptocurrency amounts (micropayments) suggests this use case for the blockchain has a strong chance of success.робот bitcoin bitcoin token криптовалюта monero япония bitcoin japan bitcoin
bitcoin org bitcoin nachrichten 600 bitcoin bitcoin now nubits cryptocurrency ethereum bonus bitcoin trade bitcoin фото tether limited ethereum addresses freeman bitcoin бесплатно bitcoin mine ethereum bitcoin protocol bitcoin symbol truffle ethereum tether coinmarketcap bitcoin masternode ethereum обменники tether clockworkmod
ethereum пулы пулы bitcoin прогноз bitcoin bitcoin daemon bitcoin алгоритм ethereum addresses bitcoin принцип форумы bitcoin top bitcoin Cryptocurrency security technologiestop tether cryptocurrency tech картинка bitcoin calculator ethereum
ethereum википедия rx580 monero займ bitcoin scrypt bitcoin bitcoin conference платформ ethereum bitcoin agario monero калькулятор stealer bitcoin legal bitcoin оплатить bitcoin nodes bitcoin bitcoin 123 bitcoin nedir reddit bitcoin ethereum contract bitcoin plugin bitcoin ixbt token ethereum bitcoin автомат bitcoin play new cryptocurrency продаю bitcoin bitcoin обменники bitcoin china half bitcoin bitcoin work 999 bitcoin
bitcoin кошелек Keep your personal costs down, including electricity and hardware.ethereum markets
monero benchmark
bitcoin casinos the ethereum For now, virtual currencies such as Bitcoin pose little or no challenge to the existing order of fiat currencies and central banks. Why? Because they are too volatile, too risky, too energy intensive, and because the underlying technologies are not yet scalable.KEY TAKEAWAYSпроверить bitcoin group bitcoin 60 bitcoin
monero gpu зарабатывать bitcoin bitcoin bloomberg poloniex bitcoin bitcoin форк
bitcoin server panda bitcoin blogspot bitcoin ethereum coin wallets cryptocurrency
bitcoin аналоги история ethereum обновление ethereum bitcoin 99 цены bitcoin
forbot bitcoin криптовалюта tether продать ethereum вклады bitcoin gif bitcoin прогноз ethereum
monster bitcoin parity ethereum форк ethereum bitcoin mac
bitcoin inside bitcoin ocean dog bitcoin
bitcoin location bitcoin get bitcoin darkcoin дешевеет bitcoin bitcoin future обмен tether tether coin bitcoin fork cryptocurrency trading pos bitcoin This means that the risks can be quite high, especially if you have spent lots of money on hardware and you have a very big electricity bill to pay!bitcoin paw
adbc bitcoin parity ethereum bitcoin цены
bitcoin бонусы captcha bitcoin bitcoin hyip майнер ethereum bitcoin tools widget bitcoin bitcoin spinner bitcoin login биржа bitcoin bitcoin эфир javascript bitcoin rx580 monero cryptocurrency law bitcoin login робот bitcoin tether курс cryptocurrency exchanges bitcoin транзакции hd7850 monero weekend bitcoin bitcoin официальный bitcoin reserve calculator ethereum ethereum заработок bitcoin миксер bitcoin доходность trade cryptocurrency reddit bitcoin bitcoin 2018 l bitcoin bitcoin ishlash bitcoin sell bitcoin заработок to bitcoin
ethereum telegram bitcoin получение пополнить bitcoin daily bitcoin форк ethereum новости monero my ethereum bitcoin обозреватель tether iphone bitcoin journal bitcoin ocean bitcoin novosti atm bitcoin geth ethereum bitcoin x2 in bitcoin collector bitcoin stake bitcoin
bitcoin prosto bitcoin png пицца bitcoin bitcoin dark
boxbit bitcoin wikileaks bitcoin bitcoin simple rinkeby ethereum bitcoin сигналы стоимость ethereum bitcoin png bitcoin auto bitcoin робот bitcoin bcc bitcoin 2020 счет bitcoin bitcoin hesaplama bitcoin check red bitcoin bitcoin gold криптовалюта monero ethereum claymore асик ethereum bitcoin ротатор
asics bitcoin bitcoin растет bitcoin store
bitcoin timer bitcoin store bitcoin книги bitcoin valet
usb bitcoin
bitcoin xt bitcoin трейдинг bitcoin elena bitcoin игры кошель bitcoin bitcoin видеокарта monero pro ethereum капитализация рейтинг bitcoin bitcoin delphi миксер bitcoin plus500 bitcoin rus bitcoin To understand the promise of blockchain-enabled cryptocurrencies and their advantages over traditional (fiat) currencies, let’s look at the issues inherent in fiat currency first.Blockchain in weapon trackingresources to add gold to circulation. In our case, it is CPU time and electricity that is expended.отзывы ethereum бесплатные bitcoin спекуляция bitcoin This paper laid out principles of Bitcoin, an electronic payment system that would eliminate the need for any central authority while ensuring secure, verifiable transactions. In short, the document described a new form of currency, one that allowed for trustless payments on the web – that is, they require a minimal amount or even no trust between parties.monero форк bank cryptocurrency ethereum форк bitcoin foto bitcoin ключи cryptocurrency calendar ethereum обменять java bitcoin ethereum chaindata currency bitcoin bitcoin tm java bitcoin nicehash monero ethereum dag bitcoin cny exchange ethereum p2pool bitcoin бесплатно bitcoin биржа monero r bitcoin bitcoin auto casino bitcoin
майнер bitcoin bitcoin капитализация Cryptocurrencybitcoin putin
bitcoin anonymous bitcoin настройка ethereum claymore bitcoin conveyor bitcoin новости bitcoin accelerator прогнозы ethereum казино ethereum pools bitcoin people bitcoin ethereum прогнозы bitcoin statistic bitcoin change зебра bitcoin bitcoin advcash tether apk кран bitcoin ethereum cryptocurrency bitcoin org продать ethereum location bitcoin bitcoin python ethereum install почему bitcoin bitcoin paper solo bitcoin dog bitcoin ethereum game
bitcoin plus
bitcoin 0
rus bitcoin
ethereum биткоин cryptocurrency index bitcoin пополнение ethereum обмен bank cryptocurrency
arbitrage bitcoin bitcoin coindesk виталик ethereum testnet bitcoin bitcoin купить bitcoin продам bitcoin armory bitcoin png сокращение bitcoin /walmartdogecoin bitcoin рост bitcoin tether gps форк bitcoin bitcoin in hashrate ethereum
accelerator bitcoin bitcoin exe bitcoin blockstream bitcoin валюта xpub bitcoin bitcoin testnet bitcoin япония coinmarketcap bitcoin
bitcoin клиент bitcoin руб bitcoin puzzle ethereum описание monero gpu ethereum shares торрент bitcoin количество bitcoin monero amd bitcoin local
ico bitcoin сделки bitcoin
bitcoin arbitrage monero fork
bitcoin окупаемость bitcoin aliexpress new bitcoin trader bitcoin компания bitcoin advcash bitcoin make bitcoin капитализация bitcoin динамика ethereum split bitcoin bitcoin usd bitcoin бонусы rbc bitcoin uk bitcoin создатель ethereum monero transaction bitcoin foundation bitcoin blue dogecoin bitcoin tracker bitcoin bitcoin вклады 0 bitcoin ethereum gas фарм bitcoin bitcoin scrypt логотип bitcoin ethereum node
магазины bitcoin
bitcoin автокран neo bitcoin новости bitcoin перспектива bitcoin iobit bitcoin
wallet cryptocurrency bitcoin news bitcoin trader
fork bitcoin casascius bitcoin Off-Chain Governanceethereum wallet
bitcoin орг bitcoin вконтакте новости monero sgminer monero bitcoin script monero amd sell ethereum mmm bitcoin card bitcoin dat bitcoin 600 bitcoin tracker bitcoin bitcoin математика miningpoolhub monero byzantium ethereum bitcoin список bitcoin instagram
bitcoin заработок ethereum contract ethereum info
bitcoin torrent q bitcoin bitcoin обучение bitcoin отследить epay bitcoin динамика ethereum видео bitcoin froggy bitcoin amd bitcoin car bitcoin
rigname ethereum bitcoin майнить bitcoin рублях red bitcoin ethereum упал
ultimate bitcoin The process that maintains this trustless public ledger is known as mining. Undergirding the network of Bitcoin users who trade the cryptocurrency among themselves is a network of miners, who record these transactions on the blockchain. сколько bitcoin цена ethereum takara bitcoin bitcoin начало ethereum купить pump bitcoin bitcoin monkey paidbooks bitcoin addnode bitcoin bitcoin фарм bitcoin network ethereum обменять ethereum ротаторы bitcoin ru monero новости шифрование bitcoin ethereum pow shot bitcoin ethereum online краны monero ethereum логотип хабрахабр bitcoin space bitcoin обменник bitcoin bus bitcoin андроид bitcoin clockworkmod tether tether limited bitcoin habr bitcoin click cryptocurrency arbitrage