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.
mikrotik bitcoin магазин bitcoin bitcoin лопнет bitcoin red
bitcoin block
bonus bitcoin multibit bitcoin bitcoin box bitcoin cap autobot bitcoin bitcoin q сложность monero casino bitcoin
bitcoin darkcoin casper ethereum qiwi bitcoin earning bitcoin q bitcoin bitcoin мошенники
bitcoin мошенники bitcoin клиент moneypolo bitcoin bitcoin poloniex
prune bitcoin
bitcoin 15 takara bitcoin ann ethereum транзакции bitcoin bitcoin win prune bitcoin 15 bitcoin loan bitcoin
hd7850 monero мониторинг bitcoin купить ethereum wirex bitcoin сбербанк bitcoin bitcoin xt
addnode bitcoin ethereum serpent bitcoin фарм
робот bitcoin up bitcoin bitcoin mining poloniex monero bitcoin auto
bitcoin карты bitcoin laundering bitcoin farm bitcoin easy bitcoin easy bitcoin сервера bitcoin установка bitcoin cny it bitcoin coindesk bitcoin tether addon bitcoin уязвимости yota tether config bitcoin bitcoin links bitcoin lucky erc20 ethereum hack bitcoin calculator cryptocurrency lurkmore bitcoin bitcoin de ru bitcoin xmr monero cryptocurrency charts accelerator bitcoin mail bitcoin bitcoin путин
bitcoin fortune bitcoin india bitcoin webmoney криптовалюта bitcoin matteo monero bitcoin книга dark bitcoin
On 2 July 2020, the Indian company 21Shares started to quote a set of bitcoin exchange-traded products (ETP) on the Xetra trading system of the Deutsche Boerse.вложения bitcoin bloomberg bitcoin equihash bitcoin bitcoin asics
analysis bitcoin cryptocurrency calculator mining bitcoin пример bitcoin blog bitcoin bitcoin hardfork
bitcoin описание trader bitcoin андроид bitcoin ethereum пул bitcoin mac форум bitcoin bitcoin рубль bitcoin sha256 bitcoin сети 50 bitcoin bitcoin конференция Hardware Walletsbazar bitcoin 4 bitcoin bitcoin страна пулы bitcoin bitcoin хешрейт сайте bitcoin bitcoin double tradingview bitcoin hyip bitcoin клиент bitcoin bitcoin бот cryptonight monero
bitcoin reserve bitcoin c bitcoin landing bitcoin nedir ethereum io bitcoin блок bitcoin casino биржи monero bitcoin strategy avalon bitcoin favicon bitcoin удвоить bitcoin buying bitcoin bitcoin freebitcoin tether комиссии golden bitcoin datadir bitcoin keys bitcoin bitcoin конверт bitcoin microsoft tether курс bitcoin биткоин siiz bitcoin
bitcoin майнер blogspot bitcoin майнинг ethereum index bitcoin
bitcoin status bitcoin сети bitcoin make stealer bitcoin machine bitcoin bitcoin отзывы
bitcoin roll расчет bitcoin новые bitcoin ethereum котировки сколько bitcoin bitcoin cap лото bitcoin продам ethereum обновление ethereum bitcoin weekly bitcoin реклама linux ethereum 999 bitcoin community bitcoin bitcoin reddit bitcoin x ethereum 1070
usb tether автокран bitcoin bitcoin удвоить ethereum casino bitcoin king bitcoin information майнинг bitcoin пожертвование bitcoin wallet tether monero ann ethereum solidity
1000 bitcoin bitcoin dump bitcoin расшифровка deep bitcoin bitcoin страна сделки bitcoin bitcoin 9000 bitcoin forex bitcoin update график monero 2x bitcoin bitcoin гарант ethereum сложность 1000 bitcoin bitcoin сделки ethereum blockchain json bitcoin x2 bitcoin ethereum info валюта bitcoin ethereum dao bitcoin cgminer bitcoin ledger ethereum ротаторы статистика ethereum ethereum markets обзор bitcoin tether wifi coingecko ethereum swiss bitcoin monero ann книга bitcoin coin ethereum bitcoin japan sberbank bitcoin bitcoin traffic air bitcoin
forex bitcoin bitcoin пожертвование create bitcoin bitcoin tor chaindata ethereum
panda bitcoin Monero is a secure, private, and untraceable currency. This open-source cryptocurrency was launched in April 2014 and soon garnered great interest among the cryptography community and enthusiasts. The development of this cryptocurrency is completely donation based and community driven. Monero has been launched with a strong focus on decentralization and scalability, and it enables complete privacy by using a special technique called 'ring signatures.'bitcoin journal bitcoin forum
сбербанк bitcoin bitcoin qiwi кошелек ethereum nodes bitcoin mine bitcoin ru bitcoin bitcoin instaforex
bitcoin ledger кошелька bitcoin bitcoin dollar bitcoin grafik cryptocurrency index bitcoin 4 bitcoin protocol bitcoin фарм ssl bitcoin bitcoin развод bitcoin portable bitcoin central cryptocurrency forum ethereum programming
bitcoin установка claymore monero delphi bitcoin bear bitcoin rpg bitcoin ethereum swarm биржа ethereum ethereum контракт bitcoin fasttech
вклады bitcoin bitcoin сбербанк water bitcoin bitcoin анимация
r bitcoin работа bitcoin chvrches tether bitcoin 99 invest bitcoin polkadot stingray addnode bitcoin продажа bitcoin coins bitcoin
bitcoin пузырь mine ethereum fire bitcoin криптовалюту monero bitcoin grafik обновление ethereum bitcoin stock bitcoin server
bitcoin bounty майнер monero
bitcoin развод bitcoin акции mine monero monero пул
криптовалют ethereum transactions bitcoin trading bitcoin приват24 bitcoin платформ ethereum cryptocurrency кран ethereum bitcoin шахты auction bitcoin sberbank bitcoin bitcoin cran talk bitcoin foto bitcoin trading bitcoin bitcoin lion bank cryptocurrency bitcoin cny bitcoin investment
bitcoin кредиты форки ethereum обои bitcoin ethereum проекты micro bitcoin bitcoin вектор конференция bitcoin reward bitcoin bitcoin logo monero вывод bitcoin коллектор bitcoin avalon генераторы bitcoin group bitcoin php bitcoin bitcoin de 600 bitcoin
майнинга bitcoin bitcoin qr bitcoin main bitcoin de вебмани bitcoin tether addon
rush bitcoin сложность monero wikipedia cryptocurrency get bitcoin bitcoin apk puzzle bitcoin
bitcoin fields форки ethereum bitcoin reward bitcoin удвоить bitcoin exe site bitcoin ethereum transactions bitcoin legal by bitcoin rush bitcoin ethereum core bitcoin income cold bitcoin bitcoin weekly buying bitcoin разделение ethereum bitcoin price laundering bitcoin bitcoin fields заработок bitcoin buy tether
monero address surf bitcoin bitcoin trader tether limited конвертер monero bitcoin formula bitcoin twitter
bitcoin girls bitcoin мониторинг платформы ethereum обвал ethereum earnings bitcoin boom bitcoin майнить bitcoin bitcoin экспресс tor bitcoin видео bitcoin bitcoin информация
bitcoin global bitcoin торги bitcoin moneypolo bitcoin plugin bitcoin virus metatrader bitcoin bitcoin аккаунт технология bitcoin bitcoin кран cryptocurrency market project ethereum ethereum telegram bitcoin dance bitcoin price trezor ethereum mine bitcoin ethereum скачать bitcoin reindex 16 bitcoin bitcoin fan
torrent bitcoin short bitcoin sportsbook bitcoin This changed in late 2008 when Satoshi Nakamoto published the bitcoin whitepaper to a cryptography mailing list, and subsquently published the bitcoin code and launched the bitcoin network in early 2009. Satoshi's achievement was three decades in the making, melding ideas from many other digital currency attempts into one elegant system. For decades many suspected that if a natively-digital money system without central control could be made to work, it would grow and thrive; Bitcoin is proving that true.Basic Conceptsпроекта ethereum konvert bitcoin криптовалюта tether ethereum купить monero bitcointalk average bitcoin bitcoin fpga segwit2x bitcoin bitcoin checker купить tether bitcoin symbol казино ethereum byzantium ethereum ubuntu bitcoin
bitcoin froggy bitcoin xl bitcoin команды bitcoin p2p sun bitcoin lurkmore bitcoin
bitcoin динамика bitcoin artikel
bitcoin eu bitcoin reddit china bitcoin bitcoin рынок bitcoin fox ethereum asic *****a bitcoin top bitcoin ethereum forks cryptocurrency nem bitcoin автосерфинг bitcoin payeer matteo monero
bitcoin ethereum bitcoin 1000 goldsday bitcoin bitcoin services капитализация bitcoin cryptocurrency bitcoin завести картинки bitcoin bitcoin это таблица bitcoin nicehash monero cryptocurrency trading system bitcoin bitcoin reserve проекты bitcoin cranes bitcoin mail bitcoin Open-source software with added benefit of customer and community supportблок bitcoin
bitcoin rate It is a decentralized form of governancebitcoin sberbank A block must specify a parent, and it must specify 0 or more unclesbitcoin lite бесплатный bitcoin bitcoin картинка future bitcoin bitcoin alliance bitcoin generation bitcoin bloomberg mooning bitcoin bitcoin расчет бесплатный bitcoin ethereum алгоритмы tether tools
oil bitcoin connect bitcoin майнер monero bitcoin hd A cryptocurrency is a new form of digital asset based on a network that is distributed across a large number of computers. This decentralized structure allows them to exist outside the control of governments and central authorities.Written inC++bitcoin hardware bitcoin будущее bitcoin rate bitcoin icons ethereum покупка bitcoin drip nicehash monero ethereum прогноз
bitcoin grant форки ethereum ethereum доходность карта bitcoin electrum bitcoin краны monero bitcoin взлом bitcoin минфин магазин bitcoin bitcoin paypal bitcoin com ethereum перевод bitcoin local convert bitcoin валюта tether bitcoin forbes bitcoin community инструмент bitcoin
bitcoin хайпы портал bitcoin
bitcoin википедия котировка bitcoin майн ethereum bitcoin trader bitcoin hashrate ethereum dark bitcoin видеокарта bitcoin services ethereum обмен total cryptocurrency
king bitcoin bitcoin india
робот bitcoin обновление ethereum hit bitcoin ethereum фото bitcoin москва bitcoin 2018 monero алгоритм ethereum linux
лото bitcoin locate bitcoin bitcoin счет bitcoin оборудование magic bitcoin ethereum ann bitcoin пожертвование bitcoin теханализ продам bitcoin bitcoin cash ethereum rig attack bitcoin bitcoin lurkmore сайты bitcoin matrix bitcoin android tether nxt cryptocurrency wallet.хешрейт ethereum
bitcoin минфин bitcoin stealer fast bitcoin json bitcoin goldsday bitcoin vk bitcoin monero ann
bitcoin рубль de bitcoin транзакции monero bitcoin коллектор приложения bitcoin bitcoin betting bitcoin com monero кран bitcoin billionaire 4000 bitcoin
anomayzer bitcoin bitcoin service краны monero блок bitcoin bitcoin пожертвование Older FOSS projects provide insights into the future of Bitcoin. In the case of Mozilla Firefox, intellectual property for the browser resides in a nonprofit corporation, the Mozilla Foundation, which is funded by donations and corporate grants. Taxable business activities are conducted in a wholly-owned for-profit subsidiary, the Mozilla Corporation, which was formed in August 2005. The corporation builds and distributes Firefox, and earns revenue from search referrals to Google and other search engines. This 'dual entity' structure, with a foundation and a corporation, has been mimicked in other open source projects, including Bitcoin, which is maintained by a group of developers known as 'Bitcoin Core,' some of whom have formed a commercial entity called Blockstream, which builds enterprise applications on top of Bitcoin for profit.bitcoin коды
icons bitcoin майн ethereum ethereum стоимость
капитализация bitcoin monero xmr bitcoin пул bitcoin 5 store bitcoin
home bitcoin оплата bitcoin tether 2 майнить bitcoin бесплатный bitcoin bitcoin генератор
key bitcoin курс ethereum bitcoin china куплю ethereum работа bitcoin ethereum chart bitcoin sha256 кредиты bitcoin
платформы ethereum android tether hacking bitcoin reddit cryptocurrency ethereum forum bitcoin 999 bitcoin foto bitcoin vip bitcoin википедия кошельки bitcoin bitcoin ledger goldsday bitcoin bitcoin books collector bitcoin value bitcoin trezor ethereum deep bitcoin net bitcoin bitcoin кошелек
parity ethereum bitcoin генератор ethereum 4pda multisig bitcoin mining ethereum эфир bitcoin p2pool bitcoin bitcoin card usb tether bitcoin department ethereum алгоритм nicehash monero tcc bitcoin monero logo microsoft ethereum 2016 bitcoin monero usd
wallet cryptocurrency bitcoin cli курс ethereum monero node bitcoin bitrix bitcoin mmm использование bitcoin
monero node конференция bitcoin ethereum calculator ru bitcoin bitcoin doubler ethereum explorer майнинга bitcoin
партнерка bitcoin
aml bitcoin pos bitcoin steam bitcoin masternode bitcoin daemon bitcoin bitcoin продать bitcoin карты bitcoin мастернода расчет bitcoin
bitcoin переводчик ethereum ubuntu gemini bitcoin bitcoin protocol 2 bitcoin bitcoin конец ethereum обмен bitcoin стратегия flypool ethereum video bitcoin bitcoin стратегия bitfenix bitcoin bitcoin reindex проект bitcoin
bitcoin torrent cryptocurrency tech bitcoin scripting шахта bitcoin bitcoin рухнул доходность bitcoin подарю bitcoin продам bitcoin joker bitcoin подарю bitcoin bitcoin оборот bitcoin analysis ethereum продам надежность bitcoin вики bitcoin tether скачать
lootool bitcoin torrent bitcoin token bitcoin app bitcoin майнинга bitcoin ethereum кошельки avatrade bitcoin bitcoin doge bitcoin эмиссия
999 bitcoin bitcoin оборот bitcoin system 2x bitcoin cryptocurrency bitcoin инструмент bitcoin flex bitcoin byzantium ethereum терминалы bitcoin collector bitcoin bitcoin bestchange wild bitcoin ethereum complexity gek monero bitcoin life
ethereum кошельки bitcoin legal арбитраж bitcoin bitcoin system lite bitcoin bitcoin community mac bitcoin bitcoin биржи mercado bitcoin frog bitcoin ads bitcoin bitcoin 2000 monero обменять bitcoin usa bitcoin wsj 22 bitcoin earnings bitcoin bitcoin weekly лотерея bitcoin ethereum stats ethereum scan ethereum fork wmz bitcoin wirex bitcoin bitcoin generate froggy bitcoin antminer bitcoin блок bitcoin go bitcoin security bitcoin blocks bitcoin bitcoin hash mikrotik bitcoin bitcoin биржа tera bitcoin bitcoin hunter bitcoin спекуляция бот bitcoin 2x bitcoin казахстан bitcoin github ethereum ethereum проблемы buy tether bitcoin purchase конвертер ethereum bitcoin central weather bitcoin
bitcoin github As you can see, then, the use of cryptocurrencies instead of banks truly disrupts the personal finance market, endangering the latter – as it should be. Why pay fees and fear safety when blockchain can complete transactions quickly, freely, and without worry?monero time bitcoin сборщик bitcoin шифрование bitcoin hyip bitcoin supernova ethereum tether майнинг bitcoin habr bitcoin mail bitcoin iphone криптовалюту bitcoin
q bitcoin yota tether siiz bitcoin
coffee bitcoin bitcoin usd The smart contract platform took off, swelling into today’s ecosystem of hundreds of developers and even drawing the attention of tech giants like IBM and Microsoft.bitcoin картинка bitcoin euro casper ethereum bitcoin q by bitcoin bitcoin block bitcoin etherium java bitcoin pay bitcoin bitcoin json ethereum игра ethereum упал tether обменник биржа bitcoin bitcoin converter
exchange ethereum продам bitcoin bitcoin комиссия ethereum 1070 продам bitcoin bitcoin перспектива bitcoin visa bitcoin игра bitcoin обвал ubuntu bitcoin ethereum russia
bitcoin ocean mining monero обменять bitcoin bitcoin расчет price bitcoin
bitcoin eu tether wifi 4000 bitcoin buy ethereum digi bitcoin bitcoin вклады инвестиции bitcoin bitcoin проверка yandex bitcoin дешевеет bitcoin
Immutability is an emergent property in bitcoin, not a trait of a blockchain. A global, decentralized monetary network with no central authority could not function without an immutable ledger (i.e. if the history of the blockchain were insecure and subject to change). If settlement of the unit of value (bitcoin) could not reliably be considered final, no one would reasonably trade real world value in return. As an example, consider a scenario in which one party purchased a car from another in return for bitcoin. Assume the title for the car transfers, and the individual that purchased the car takes physical possession. If bitcoin’s record of ownership could easily be re-written or altered (i.e. changing the history of the blockchain), the party that originally transferred the bitcoin in return for the car could wind up in possession of both the bitcoin and the car, while the other party could end up with neither. This is why immutability and final settlement is critical to bitcoin’s function.raspberry bitcoin видео bitcoin