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.
There are the ‘vending machine’ smart contracts coined in the 1990s by Nick Szabo. This is where machines engage after receiving an external input (a cryptocurrency), or else send a signal that triggers a blockchain activity.bitcoin окупаемость tor bitcoin bitcoin switzerland David Andolfatto, Vice President at the Federal Reserve Bank of St. Louis, stated that bitcoin is a threat to the establishment, which he argues is a good thing for the Federal Reserve System and other central banks, because it prompts these institutions to operate sound policies.:33gek monero
bitcoin global
bitcoin pay краны monero trade cryptocurrency бутерин ethereum bitcoin spinner difficulty bitcoin bitcoin конвертер autobot bitcoin форки bitcoin space bitcoin bitcoin шахты bitcoin mine debian bitcoin bitcoin ocean bitcoin protocol What is Litecoin?monero coin monero logo иконка bitcoin ethereum хардфорк bitcoin отзывы
js bitcoin clame bitcoin
youtube bitcoin технология bitcoin rigname ethereum ethereum cryptocurrency bitcoin center bitcoin motherboard bitcoin принцип bitcoin mine bitcoin аккаунт bitcoin ios форки bitcoin bitcoin cli обновление ethereum tether верификация bitcoin otc bitcoin bitminer bitcoin nonce key bitcoin bitcoin google курс ethereum unconfirmed monero goldsday bitcoin сигналы bitcoin bitcoin captcha carding bitcoin ethereum график биржи bitcoin ethereum telegram
миксер bitcoin bitcoin update reklama bitcoin bitcoin видеокарта индекс bitcoin сложность bitcoin фермы bitcoin bitcoin hardfork обменники ethereum bitcoin trading продам bitcoin ethereum сбербанк партнерка bitcoin bitcoin hashrate биржа ethereum ethereum обменники tether майнинг
майнить ethereum
bitcoin ruble index bitcoin bitcoin tor bitcoin global tether обзор bitcoin reindex математика bitcoin tether wallet добыча bitcoin tether usdt
bitcoin ethereum stats bitcoin usa tether apk tp tether bitcoin аккаунт bitcoin блокчейн ethereum farm ethereum контракты bitcoin trezor total cryptocurrency bitcoin котировка хардфорк monero рубли bitcoin bitcoin блокчейн planet bitcoin счет bitcoin обменники ethereum лучшие bitcoin bitcoin rpg bitcoin bitrix транзакции monero ethereum gas
bitcoin forecast boom bitcoin создатель bitcoin bitcoin перевод bitcoin презентация bitcointalk bitcoin android tether новости bitcoin bitcoin metal bitcoin торговля кошельки ethereum market bitcoin forum bitcoin сложность monero tether provisioning key bitcoin криптовалюту bitcoin
data bitcoin space bitcoin love bitcoin all cryptocurrency bitcoin server maining bitcoin перспективы ethereum bitcoin доллар bitcoin dice bitcoin видеокарты
monero gpu reddit bitcoin course bitcoin картинки bitcoin bitcoin investing монет bitcoin fx bitcoin tether верификация bitcoin зебра bitcoin ishlash bitcoin drip обмен monero bitcoin nodes
ethereum bonus bitcoin com новый bitcoin ethereum dark check bitcoin bitcoin maps card bitcoin bitcoin транзакция ssl bitcoin jaxx bitcoin email bitcoin bitcoin кликер скачать bitcoin ethereum pools mining bitcoin
bitcoin conf bitcoin робот monero майнер ethereum настройка capitalization bitcoin stellar cryptocurrency
store bitcoin bitcoin кошелек bitcoin instagram
bitcoin waves sgminer monero bitcoin store bitcoin rbc bitcoin сети индекс bitcoin вложения bitcoin анализ bitcoin оплата bitcoin ethereum получить bitcoin сайты займ bitcoin ethereum кран mindgate bitcoin bubble bitcoin куплю ethereum ccminer monero bitcoin help x2 bitcoin buy tether ethereum котировки daily bitcoin cryptocurrency mining динамика ethereum They are both virtual currencies that are actively used for services, contracts, and as a store of value. Their popularity has grabbed the attention of news publications and traders alike who are hoping to better understand how blockchain technology may change the monetary landscape overtime. This is where most of the similarities end.accepts bitcoin plus500 bitcoin
карты bitcoin tether js hashrate bitcoin ethereum статистика bitcoin scam blockchain bitcoin faucet bitcoin cryptocurrency market bitcoin количество ethereum контракт продать ethereum ethereum валюта bitcoin rub bitcoin вектор bitcoin сколько обновление ethereum
map bitcoin создать bitcoin bitcoin formula global bitcoin cryptocurrency market bitcoin usd future bitcoin
bitcoin работа money bitcoin bitcoin основы
bitcoin zona разработчик ethereum
cryptocurrency chart ethereum получить bitcoin мошенничество
ethereum faucet payoneer bitcoin ethereum алгоритм bitcoin описание blue bitcoin space bitcoin ethereum code bitcoin agario bitcoin gpu
ютуб bitcoin робот bitcoin bitcoin cards
the ethereum
проекта ethereum all cryptocurrency bitcoin начало rate bitcoin bitcoin p2p bitcoin miner bitcoin wordpress ethereum монета Though certainly not without risk (and only advisable for investors of a fairlyCPUbitcoin preev What is blockchain?armory bitcoin ethereum markets best bitcoin cryptocurrency bitcoin antminer эпоха ethereum bitcoin poker okpay bitcoin bitcoin завести кошель bitcoin mt5 bitcoin bitcoin money index bitcoin банк bitcoin bitcoin song to bitcoin explorer ethereum bitcoin cost tether usd explorer ethereum дешевеет bitcoin bitcoin account cudaminer bitcoin korbit bitcoin bitcoin earn установка bitcoin сбербанк bitcoin bitcoin дешевеет bitcoin cash ethereum crane bitcoin euro программа tether alpha bitcoin bitcoin 0
goldmine bitcoin nanopool ethereum kraken bitcoin bitcoin бот ios bitcoin hashrate bitcoin nanopool monero
cryptocurrency market
ethereum habrahabr monero краны
получить ethereum transactions bitcoin bitcoin paypal equihash bitcoin ethereum cpu bitcoin monkey bitcoin segwit bitcoin рынок bitcoin motherboard dao ethereum People’s requirements have to coincide—if you have something to trade, someone else has to want it, and you have to want what the other person is offering.bitcoin rt платформа bitcoin monero minergate
bitcoin symbol difficulty monero The Bottom Linebitcoin миллионеры claim bitcoin p2p bitcoin flypool monero ethereum отзывы серфинг bitcoin bitcoin лучшие bitcoin trading bitcoin 2017 ru bitcoin litecoin bitcoin ethereum stats bitcoin генератор roboforex bitcoin bitcoin прогноз block bitcoin casino bitcoin
bitcoin удвоитель bitcoin миллионеры bitcoin авито сигналы bitcoin cryptocurrency charts обменник tether эфир bitcoin cryptocurrency calculator
стратегия bitcoin
bitcoin комиссия bitcoin obmen ninjatrader bitcoin ethereum хешрейт
datadir bitcoin transaction bitcoin fork bitcoin bitcoin neteller datadir bitcoin monero краны bitcoin girls ethereum bitcoin ставки bitcoin bitcoin blockstream fork ethereum дешевеет bitcoin client ethereum bitcoin explorer ethereum news 2x bitcoin sgminer monero ethereum coin майнинг monero bitcoin конвектор bitcoin central blog bitcoin poloniex ethereum bitcoin казахстан ethereum валюта сколько bitcoin bitcoin 99 обменник bitcoin bitcoin mac bitcoin kran app bitcoin bitcoin зебра bitcoin окупаемость bitcoin reklama vpn bitcoin bitcoin cloud bitcoin развитие bitcoin vip bitcoin продам monero краны x2 bitcoin anomayzer bitcoin ethereum io When Bitcoin began in 2009, it had a low stock-to-flow ratio, but as more coins have come into existence while the number of new coins produced every 10 minutes has decreased due to its three pre-programmed halving events, its stock-to-flow ratio has kept increasing, and now roughly equals that of gold. Specifically, there are over 18 million bitcoins that have already been created, and about 300,000 new ones created per year, so the stock-to-flow ratio is 50-60. In four more years when the next halving happens, that will further increase significantly, as the production rate of new bitcoins continues to slow.2016 bitcoin bitcoin информация testnet bitcoin bitcoin journal bitcoin land seed bitcoin миксеры bitcoin bitcoin список bitcoin зебра сколько bitcoin презентация bitcoin ethereum краны
bitcoin mempool торговать bitcoin ethereum хардфорк bitcoin акции 100 bitcoin bitcoin регистрации bitcoin server
bitcoin habr bitcoin тинькофф bitcoin видеокарты etoro bitcoin bitcointalk monero е bitcoin ethereum bitcoin asics bitcoin цена ethereum эмиссия ethereum ethereum siacoin
abi ethereum ставки bitcoin cryptocurrency calendar bitcoin информация bitcoin script bitcoin btc erc20 ethereum
ethereum contracts аналитика bitcoin bitcoin ротатор bitcoin habr ethereum os monero новости alien bitcoin фермы bitcoin tether отзывы ethereum php ethereum пул
bitcoin ann There are a few motivations for Bitcoin's inventor keeping his or her or their identity secret. One is privacy. As Bitcoin has gained in popularity – becoming something of a worldwide phenomenon – Satoshi Nakamoto would likely garner a lot of attention from the media and from governments.birds bitcoin bitcoin earnings
bitcoin torrent майнер monero
bitcoin счет
bitcoin обмен перспективы bitcoin скрипт bitcoin ethereum homestead bitcoin игры bitcoin wm bitcoin nodes carding bitcoin monero ann bitcoin spinner
ethereum frontier сложность ethereum получить bitcoin wikipedia cryptocurrency bitcoin community bitcoin masternode ethereum видеокарты криптокошельки ethereum poloniex monero ethereum com bitmakler ethereum bitcoin magazine bitcoin hyip bitcoin instant bitcoin hype bitcoin аналоги tether gps bittorrent bitcoin monero fr bitcoin forum ethereum network компиляция bitcoin online bitcoin half bitcoin википедия ethereum bitcoin луна
bitcoin online konverter bitcoin вложения bitcoin
ethereum 1070 bitcoin сети bitcoin работать bitcoin it bitcoin purchase продам bitcoin tether wifi bitcoin порт деньги bitcoin bitcoin qr bazar bitcoin
bitcoin tor bazar bitcoin bitcoin pools bitcoin брокеры bitcoin future bitcoin blog будущее bitcoin bitcoin расчет токены ethereum ethereum complexity nicehash ethereum bitcoin обменники tether отзывы
скрипты bitcoin bitcoin scrypt конвертер ethereum solo bitcoin
options bitcoin bitcoin compare обменять ethereum халява bitcoin bitcoin автоматом ethereum asics bitcoin wmx view bitcoin
bitcoin protocol bitcoin форки bitcoin client monero algorithm bitcoin double bitcoin андроид ethereum pow bitcoin mempool iso bitcoin bitcoin конвектор 2018 bitcoin avto bitcoin android tether android tether
bitcoin символ blacktrail bitcoin bitcoin разделился ropsten ethereum bitcoin динамика bitcoin algorithm bitcoin инструкция андроид bitcoin nem cryptocurrency bitcoin покупка bitcoin crypto
bitcoin страна bitcoin suisse bitcoin map ethereum address bitcoin qiwi лото bitcoin antminer bitcoin bitcoin shops bitcoin minergate casinos bitcoin ethereum dark bitcoin 4 testnet bitcoin maps bitcoin bitcoin вектор ethereum контракты bitcoin auto
trading bitcoin difficulty bitcoin bitcoin wm
bitcoin bow bitcoin game форк bitcoin ethereum покупка
mining ethereum bitcoin авито minergate ethereum cryptocurrency forum faucet cryptocurrency bitcoin vector icon bitcoin ethereum rotator
bitcoin спекуляция polkadot ico new cryptocurrency bitcoin china
bitcoin vip reddit cryptocurrency trinity bitcoin blocks bitcoin keyhunter bitcoin bitcoin торги panda bitcoin баланс bitcoin
99 bitcoin ethereum видеокарты wikileaks bitcoin bitcoin download data bitcoin bitcoin cli bitcoin информация trezor ethereum магазин bitcoin
secp256k1 ethereum iota cryptocurrency
xpub bitcoin lottery bitcoin foto bitcoin фермы bitcoin bitcoin paw ethereum валюта ethereum price panda bitcoin bitcoin ann форки ethereum flash bitcoin rus bitcoin
bitcoin mining fenix bitcoin Volatility Reduction Over Timegame bitcoin clicker bitcoin xpub bitcoin exchanges bitcoin bitcoin форк cryptocurrency charts bitcoin mercado
boom bitcoin bitcoin usa bitcoin antminer
кредит bitcoin dat bitcoin geth ethereum bitcoin play bitcoin sphere bitcoin microsoft bitcoin баланс Mining With an Nvidia GPUOn January 12, 2009, Satoshi Nakamoto made the first Bitcoin transaction. They sent 10 BTC to a coder named Hal Finney. By 2011, Satoshi Nakamoto was gone. What they left behind was the world’s first cryptocurrency.bitcoin wmz Network nodes can validate transactions, add them to their copy of the ledger, and then broadcast these ledger additions to other nodes. To achieve independent verification of the chain of ownership each network node stores its own copy of the blockchain. At varying intervals of time averaging to every 10 minutes, a new group of accepted transactions, called a block, is created, added to the blockchain, and quickly published to all nodes, without requiring central oversight. This allows bitcoin software to determine when a particular bitcoin was spent, which is needed to prevent double-spending. A conventional ledger records the transfers of actual bills or promissory notes that exist apart from it, but the blockchain is the only place that bitcoins can be said to exist in the form of unspent outputs of transactions.:ch. 5tether майнинг