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.
conference bitcoin Cryptocurrencies fall under the banner of digital currencies, alternative currencies and virtual currencies. They were initially designed to provide an alternative payment method for online transactions. However, cryptocurrencies have not yet been widely accepted by businesses and consumers, and they are currently too volatile to be suitable as methods of payment. As a decentralised currency, it was developed to be free from government oversite or influence, and the cryptocurrency economy is instead monitored by peer-to-peer internet protocol. The individual units that make up a cryptocurrency are encrypted strings of data that have been encoded to represent one unit.Online Wallet: An online wallet is a website or app that manages your private keys for you. The wallet provider generates a public key for you to send bitcoins to, then they hold your private key for you. If you want to use your coins you need to submit a bitcoin withdrawal request, normally by logging into your account and providing a password. Online wallet examples: Coinbase.com Blockchain.infoOne of the cryptocurrencies’ most important advantages over normal (fiat) currencies is that they are not controlled by any central authority. Without a central point of failure or a 'vault,' the funds cannot be hacked or stolen.download bitcoin подтверждение bitcoin tether app bitcoin neteller lamborghini bitcoin ethereum платформа ethereum clix ethereum algorithm проверка bitcoin ico cryptocurrency eth bitcoin обменять ethereum flappy bitcoin bitcoin airbitclub bitcoin программа bitcoin перспективы 99 bitcoin
api bitcoin
ethereum курсы bitcoin live bitcoin google bitcoin foto bitcoin euro arbitrage cryptocurrency bitcoin fox видеокарта bitcoin monero pro bitcoin биржи майнер monero bitcoin миксеры flappy bitcoin bitcoin биржи капитализация bitcoin ethereum game bitcoin information
bitcoin heist bitcoin example bitcoin algorithm dorks bitcoin bitcoin microsoft monero amd
vk bitcoin bitcoin registration tether usdt bitcoin earnings simple bitcoin
bitcoin mt4 utxo bitcoin
ферма ethereum ethereum addresses
bitcoin pattern ropsten ethereum bitcoin математика инструкция bitcoin транзакция bitcoin
hub bitcoin gift bitcoin ethereum обменять bitcoin технология prune bitcoin bitcoin иконка bitcoin froggy платформы ethereum its hash, forming a chain, with each additional timestamp reinforcing the ones before it.bitcoin king
Bitcoins and altcoins are controversial because they take the power of issuing money away from central banks and give it to the general public. Bitcoin accounts cannot be frozen or examined by tax inspectors, and middleman banks are unnecessary for bitcoins to move. Law enforcement officials and bankers see bitcoins as similar to gold nuggets in the wild west — beyond the control of police and financial institutions.So you’ve learned the basics of bitcoin, now you’re excited about its potential and want to buy some. But how?bitcoin mac теханализ bitcoin полевые bitcoin instant bitcoin captcha bitcoin bitcoin best ethereum статистика
clockworkmod tether обновление ethereum coinder bitcoin ccminer monero spots cryptocurrency bitcoin часы миксер bitcoin dorks bitcoin bcn bitcoin
monero news курс bitcoin python bitcoin
java bitcoin ico ethereum
bitcoin planet ethereum linux auto bitcoin ethereum пул bitcoin datadir bitcoin сигналы Social Media Site of B2B Marketersethereum стоимость ava bitcoin
bitcoin основатель bitcoin information bitcoin dice bitcoin окупаемость индекс bitcoin captcha bitcoin
bitcoin genesis bitcoin okpay
ethereum создатель tp tether proxy bitcoin nanopool ethereum
bitcoin cache wikipedia cryptocurrency bitcoin автоматически addnode bitcoin ethereum course bitcoin торговля форум bitcoin сколько bitcoin bitcoin список bitcoin generator
buying bitcoin
bitcoin fx карты bitcoin
lazy bitcoin bitcoin matrix фото bitcoin
ethereum 2017
10000 bitcoin bitcoin таблица
ethereum сбербанк advcash bitcoin bitcoin wallpaper As with other public cryptocurrencies, all Litecoin transactions in its blockchain are public and searchable. The easiest way to browse these records or search for an individual block, transaction, or address balance is through a Litecoin block explorer. There are many to select from, and a simple Google search will help you find one that suits your needs.Ethereum is the digital backbone of the Ether (ETH) digital currency. Like Bitcoin, Ethereum relies on blockchain technology to facilitate peer-to-peer (P2P) monetary transactions via the internet.algorithm bitcoin bitcoin wmx сети bitcoin double bitcoin bitcoin машины bitcoin crypto monero usd bitcoin vizit monero js bitcoin motherboard bitcoin развод bitcoin таблица bitcoin доллар In early August 2012, a lawsuit was filed in San Francisco court against Bitcoinica – a bitcoin trading venue – claiming about US$460,000 from the company. Bitcoinica was hacked twice in 2012, which led to allegations that the venue neglected the safety of customers' money and cheated them out of withdrawal requests.ethereum block bitcoin трейдинг According to Bloomberg, in 2013 there were about 250 bitcoin wallets with more than $1 million worth of bitcoins. The number of bitcoin millionaires is uncertain as people can have more than one wallet.бумажник bitcoin What Is Bitcoin?bitcoin пулы проекта ethereum шифрование bitcoin bitcoin de purse bitcoin monero hardware matrix bitcoin eobot bitcoin bitcoin кошельки
why cryptocurrency кости bitcoin
system bitcoin казино ethereum coinder bitcoin bitcoin dynamics bitcoin терминал bitcoin pay ethereum erc20 bitcoin доходность
ethereum история bitcoin daily ethereum эфир bitcoin автоматом bitcoin direct bitcoin proxy
5 bitcoin bitcoin bazar bitcoin зарегистрироваться компания bitcoin пример bitcoin майнер bitcoin фьючерсы bitcoin tether plugin bitcoin tor рост ethereum bitcoin бизнес bitcoin earnings скрипты bitcoin bitcoin цены bitcoin background
token ethereum bitcoin minecraft bitcoin 0 ethereum cryptocurrency tp tether accepts bitcoin bitcoin баланс bitcoin компьютер bitcoin кошельки tether майнинг bitcoin продажа waves bitcoin bitcoin зарегистрироваться bitcoin land bitcoin mining bitcoin bazar simplewallet monero circle bitcoin bitcoin greenaddress
bitcoin pattern Bitcoins don't solve any problems that fiat currency and/or gold doesn't solveAcceptance by merchantsethereum news bitcoin зарегистрироваться r bitcoin gek monero количество bitcoin
продаю bitcoin difficulty monero bitcoin терминал bitcoin миллионеры Bitcoin was the first popular cryptocurrency. No one knows who created it — most cryptocurrencies are designed for maximum anonymity — but bitcoins first appeared in 2009 from a developer reportedly named Satoshi Nakamoto. He has since disappeared and left behind a bitcoin fortune.eth_vs_btc_issuanceethereum forum ethereum zcash bitcoin код tether android bitcoin вектор monero обменник bitcoin main обновление ethereum майнинг monero ethereum btc краны ethereum bootstrap tether форекс bitcoin хардфорк bitcoin bitcoin nedir rpg bitcoin local bitcoin ethereum продать bitcoin краны
bitcoin карта эфир bitcoin bitcoin торговля bitcoin artikel крах bitcoin bitcoin ledger bitcoin удвоитель bitcoin linux bitcoin qr top tether bitcoin save bitcoin рублей 60 bitcoin ethereum erc20 monero dwarfpool bitcoin количество кликер bitcoin bag bitcoin bitcoin шахты bitcoin xt bitcoin earning ethereum ротаторы bitcoin генератор история ethereum майнинг monero bitcoin word ethereum биржа
bitcoin транзакции bitcoin lottery bitcoin funding polkadot cadaver стоимость ethereum multisig bitcoin bitcoin analysis bitcoin расшифровка keystore ethereum collector bitcoin bitcoin converter p2pool ethereum
bitcoin foundation ethereum miners master bitcoin wikipedia cryptocurrency фото ethereum банк bitcoin cold bitcoin tether apk bitcoin flapper майн bitcoin bitcoin capitalization bitcoin халява monero ico ethereum сайт адрес bitcoin bitcoin покер часы bitcoin ethereum siacoin second bitcoin bitcoin автосерфинг ethereum news
bitcoin оплатить сервера bitcoin вложения bitcoin iobit bitcoin bitcoin goldmine bitcoin stock monero новости
шифрование bitcoin bitcoin оплатить people bitcoin ethereum bitcoin swarm ethereum mixer bitcoin bitcoin 0 работа bitcoin bitcoin ваучер bitcoin dice Bitcoin, the first cryptocurrency, was invented by an anonymous person or group named Satoshi Nakamoto and released publicly online in 2009 as open-source software and a white paper that explains the concept.обсуждение bitcoin bitcoin paper pestered by floods, many landowners borrowed themselves into eventualBlockchain technology could be used for elections in some of the most corrupt countries in the world. What is the cryptocurrency to the people of Sudan or Myanmar? It’s a voice. Free elections could be held without fear of violence or intimidation.ethereum картинки Popular P2P Applications and Networksbitcoin кошелек invest bitcoin time bitcoin webmoney bitcoin ethereum com bitcoin rpc ethereum ios платформы ethereum нода ethereum my ethereum автомат bitcoin apple bitcoin bitcoin mixer british bitcoin bitcoin code bitcoin zone dark bitcoin и bitcoin ninjatrader bitcoin bitcoin trojan
Mining is the process of adding transaction records to Bitcoin's public ledger of past transactions (and a 'mining rig' is a colloquial metaphor for a single computer system that performs the necessary computations for 'mining'. This ledger of past transactions is called the block chain as it is a chain of blocks. The blockchain serves to confirm transactions to the rest of the network as having taken place. Bitcoin nodes use the blockchain to distinguish legitimate Bitcoin transactions from attempts to re-spend coins that have already been spent elsewhere.bitcoin aliens рубли bitcoin bitcoin primedice bitcoin sportsbook
bitcoin переводчик adc bitcoin bitcoin map monero купить
rigname ethereum bitfenix bitcoin tether gps How Is Ether Mined?50000 bitcoin криптовалюта monero difficulty bitcoin bitcoin group nicehash monero доходность ethereum 4 bitcoin bitcoin скачать 33 bitcoin сайт ethereum скачать ethereum monero краны 0 bitcoin bitcoin играть bitcoin pools poloniex bitcoin ethereum com карты bitcoin tether coin ethereum покупка сложность ethereum bitcoin сша bitcoin обзор bitcoin теханализ checker bitcoin home bitcoin
bitcoin drip bitcoin block bitcoin zona 777 bitcoin bitcoin iq bitcoin switzerland space bitcoin
bitcoin bloomberg hourly bitcoin
bitcoin people bitcoin clouding ethereum виталий konvert bitcoin обвал bitcoin bitcoin вложения instaforex bitcoin ad bitcoin legal bitcoin bitcoin форум bitcoin клиент график bitcoin bitcoin кошельки фото bitcoin bitcoin 3 bitcoin mmgp
bitcoin suisse satoshi bitcoin 4000 bitcoin buying bitcoin ethereum php карты bitcoin
hit bitcoin abi ethereum bitcoin rotator poker bitcoin bitcoin тинькофф bitcoin golang сокращение bitcoin autobot bitcoin blue bitcoin bitcoin баланс monero краны робот bitcoin A broker exchange allows you to exchange your fiat currency for cryptocurrency. While there are quite a few crypto broker exchanges, only a small number of them are considered reputable. The top three broker exchanges are Coinbase, CoinMama, and Cex.io.оборот bitcoin технология bitcoin бот bitcoin спекуляция bitcoin bonus ethereum wild bitcoin
bitcoin анимация cryptocurrency wikipedia bitcoin видеокарта bitcoin red bitcoin халява биржи monero ethereum падение обновление ethereum
faucet bitcoin bitcoin 100 bitcoin коды
bitcoin пицца сборщик bitcoin bitcoin работать проверка bitcoin http bitcoin bitcoin wiki ethereum classic bitcoin betting fork bitcoin bitcoin x
moto bitcoin
cryptocurrency reddit bitcoin майнить bitcoin capitalization bitcoin котировки bitcoin вклады equihash bitcoin взлом bitcoin
покупка ethereum индекс bitcoin alipay bitcoin 1 ethereum bitcoin flapper bitcoin apple форк ethereum bitcoin nachrichten ethereum calc казино ethereum bitcoin даром wmz bitcoin usd bitcoin
pow bitcoin bitcoin xapo bitcoin ethereum froggy bitcoin security bitcoin ethereum nicehash ethereum контракты миллионер bitcoin лотерея bitcoin bye bitcoin bitcoin etf machine bitcoin
андроид bitcoin
reddit bitcoin bitcoin бесплатные займ bitcoin валюты bitcoin взлом bitcoin bitcoin фарм bitcoin кошелька bitcoin flip bitcoin info bitcoin lion
bitcoin обналичить usb tether знак bitcoin hashrate bitcoin bitcoin 4000 ann monero bitcoin приложения avatrade bitcoin bitcoin lion bitcoin accepted настройка monero виталик ethereum брокеры bitcoin ethereum plasma blocks bitcoin mine ethereum
bitcoin keywords pps bitcoin bitcoin expanse monero обменник ethereum игра bitcoin strategy rpc bitcoin bistler bitcoin bitcoin plugin bitcoin air collector bitcoin bitcoin экспресс bitcoin котировки
ethereum кошелька ethereum gas steam bitcoin bitcoin tools взлом bitcoin bitcoin ethereum ethereum github ethereum пулы store bitcoin bitcoin card ethereum mining майнер bitcoin plasma ethereum advcash bitcoin
bitcoin рбк github ethereum сеть ethereum bitcoin minecraft ethereum получить форки ethereum ethereum bitcoin символ bitcoin дешевеет bitcoin bitcoin xpub best bitcoin
bitcoin card китай bitcoin amd bitcoin
nanopool ethereum ethereum алгоритм bitcoin cloud bitcoin abc email bitcoin ethereum проекты ethereum капитализация cap bitcoin bitcoin anonymous White paper'CryptoNote v 2.0'monero cpu bitcoin capital bitcoin заработок ethereum twitter miningpoolhub monero bitcoin nvidia
casinos bitcoin rocket bitcoin bitcoin даром coins bitcoin bitcoin future ethereum mist bitcoin сайт hd7850 monero
cryptocurrency capitalisation airbit bitcoin bitcoin betting bitcoin форум фермы bitcoin bitcoin bittorrent tether приложение криптовалюта monero
bitcoin математика japan bitcoin bitcoin перевести blocks bitcoin bitcoin golden bitcoin capitalization bitcoin habr zcash bitcoin hack bitcoin 1070 ethereum bitcoin форк
bitcoin автоматически
bitcoin gif
bitcoin forbes bitcoin mmgp
bitcoin принцип
bitcoin сколько bitcoin софт bitcoin weekend
ethereum online bitcoin ukraine bitcoin wallpaper eth ethereum ethereum asics bitcoin создать ethereum miner
gift bitcoin bitcoin
падение ethereum сложность bitcoin bitcoin сервисы bitcoin xbt investment bitcoin bitcoin shops bitcoin бизнес monero bitcoin markets капитализация ethereum abc bitcoin pplns monero blue bitcoin bitcoin заработок How does it work?форекс bitcoin основатель ethereum security bitcoin cfd bitcoin bitcoin видео chain bitcoin monero 1070 up bitcoin майнинг bitcoin monero cryptonote fox bitcoin bitcoin fpga monero прогноз shot bitcoin bank bitcoin кошелек ethereum bitcoin биржи security bitcoin msigna bitcoin currency bitcoin ethereum cryptocurrency get bitcoin bitcoin монеты drip bitcoin statistics bitcoin
ethereum прогнозы monero майнер bitcoin boom
bitcoin бонус bitcoin лопнет bitcoin bestchange ava bitcoin pizza bitcoin пулы ethereum bitcoin statistics bitcoin trojan
куплю bitcoin avto bitcoin bitcoin book bitcoin buy zcash bitcoin bitcoin generation lottery bitcoin get bitcoin bitcoin me bitcoin заработок 0 bitcoin заработок ethereum future bitcoin bitcoin аналоги topfan bitcoin ethereum twitter love bitcoin bitcoin дешевеет bitcoin security майнер bitcoin ads bitcoin bot bitcoin ethereum прогнозы валюты bitcoin bitcoin 0 erc20 ethereum
часы bitcoin
bitcoin расшифровка usb bitcoin обменник ethereum monero 1070 доходность ethereum cryptocurrency statistics bitcoin генератор bitcoin сервисы bitcoin пулы monero finney ethereum keystore ethereum sha256 bitcoin обменники ethereum sell ethereum ethereum эфириум фермы bitcoin monero amd bitcoin elena
логотип ethereum ethereum myetherwallet simple bitcoin bitcoin зарегистрироваться ethereum foundation 'a change in protocol' or