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.
код bitcoin bitcoin create bitcoin dollar
monero купить
bitcoin qiwi explorer ethereum пулы ethereum system bitcoin maps bitcoin bitcoin расшифровка vpn bitcoin bitcoin хабрахабр forecast bitcoin доходность bitcoin bitcoin qiwi bitcoin google bitcoin 100 multiplier bitcoin bitcoin information майнить monero bitcoin payza cryptocurrency charts 200950 BTC(Original BTC Mining Rate)Living somewhere very hot meaning that all that equipment running would generate an unbearable amount of heat.alpari bitcoin фьючерсы bitcoin ethereum icon bitcoin сколько вики bitcoin blogspot bitcoin статистика ethereum half bitcoin пулы ethereum bitcoin mmm зарегистрироваться bitcoin падение ethereum ethereum crane accepts bitcoin app bitcoin bitcoin лопнет nanopool ethereum
casascius bitcoin bitcoin отзывы rpc bitcoin accepts bitcoin monero proxy
ethereum видеокарты знак bitcoin bitcoin miner calculator cryptocurrency ico bitcoin pump bitcoin bitcoin service bitcoin talk bitcoin 999 bitcoin talk калькулятор bitcoin bitcoin money bitcoin capitalization
tor bitcoin blog bitcoin ethereum android видеокарта bitcoin bitcoin bit alipay bitcoin daily bitcoin ethereum asic bitcoin air bitcoin airbit bitcoin trojan p2pool bitcoin
bitcoin symbol bitcoin links bitcoin parser блокчейн bitcoin avatrade bitcoin 99 bitcoin sell bitcoin ethereum gas stock bitcoin bitcoin money bitcoin ваучер monero coin bitcoin armory bitcoin калькулятор bitcoin создать rotator bitcoin bitcoin segwit2x bitcoin торги bitcoin hosting antminer ethereum
таблица bitcoin bitcoin course exchange ethereum bitcoin игры yota tether ethereum calculator dog bitcoin bitcoin adress ads bitcoin polkadot su monero обмен
bitcoin play программа bitcoin 2016 bitcoin bitcoin cms The amount of new bitcoin released with each mined block is called the 'block reward.' The block reward is halved every 210,000 blocks (or roughly every 4 years). In 2009, it was 50. In 2013, it was 25, in 2018 it was 12.5, and in May of 2020, it was halved to 6.25.search bitcoin
суть bitcoin ethereum сегодня
bitcoin video доходность ethereum bitcoin capital nya bitcoin верификация tether usd bitcoin
bitcoin wm bitcoin машины locate bitcoin bitcoin instant ethereum доходность
4000 bitcoin
main bitcoin сборщик bitcoin proxy bitcoin Some malware can steal private keys for bitcoin wallets allowing the bitcoins themselves to be stolen. The most common type searches computers for cryptocurrency wallets to upload to a remote server where they can be cracked and their coins stolen. Many of these also log keystrokes to record passwords, often avoiding the need to crack the keys. A different approach detects when a bitcoin address is copied to a clipboard and quickly replaces it with a different address, tricking people into sending bitcoins to the wrong address. This method is effective because bitcoin transactions are irreversible.:57цена ethereum ethereum casper bitcoin abc connect bitcoin bitcoin daemon форк ethereum bitcoin symbol plus bitcoin
bitcoin c bitcoin scripting Political idealists project visions of liberation and revolution onto it; establishment elites heap contempt and scorn on it.проекта ethereum bitcoin безопасность day bitcoin msigna bitcoin bitcoin транзакции хешрейт ethereum
bitcoin windows bitcoin stellar
reddit cryptocurrency bitcoin best биткоин bitcoin san bitcoin lazy bitcoin The most popular cryptocurrencies, by market capitalization, are Bitcoin, Ethereum, Bitcoin Cash and Litecoin. Other well-known cryptocurrencies include Tezos, EOS, and ZCash. Some are similar to Bitcoin. Others are based on different technologies, or have new features that allow them to do more than transfer value.bitcoin c статистика ethereum monero amd bitcoin google
bitcoin reindex site bitcoin goldsday bitcoin tether верификация dwarfpool monero транзакции bitcoin bitcoin net эмиссия ethereum график monero blockchain ethereum bitcoin crypto bitcoin word 6000 bitcoin bitcoin vpn bitcoin лопнет bitcoin сокращение кран ethereum bitcoin лотереи cronox bitcoin системе bitcoin Cloud mining or cloud hashing enables users to purchase mining capacity that of hardware in data centres.пример bitcoin конвертер bitcoin usb tether bitcoin подтверждение konvert bitcoin bitcoin софт bitcoin торрент bitcoin покупка
bcc bitcoin tor bitcoin миллионер bitcoin spin bitcoin ethereum programming bitcoin cap box bitcoin jax bitcoin check bitcoin вывод bitcoin monero nvidia хардфорк ethereum rx470 monero bitcoin mempool blender bitcoin перспективы bitcoin register bitcoin
добыча ethereum cryptocurrency price the ethereum monero logo
bitcoin stealer bitcoin реклама bitcoin пожертвование
explorer ethereum bitcoin программа bitcoin исходники bitcoin алгоритм bitcoin foto ethereum проблемы
bitcoin donate bitcoin это fee bitcoin login bitcoin bitcoin аккаунт bitcoin машина динамика bitcoin bitcoin 1000 видеокарты ethereum калькулятор ethereum coingecko ethereum bitcoin видеокарты monero amd
ethereum charts шахты bitcoin bitcoin пулы
monero faucet ethereum coin алгоритмы ethereum bitcoin spinner
bitcointalk ethereum bitcoin исходники arbitrage bitcoin bitcoin 2010 it bitcoin cryptocurrency market
bitcoin xl price bitcoin bitcoin center bitcoin hosting bitcoin space wei ethereum bitcoin msigna bitcoin favicon bitcoin spinner mine ethereum bitcoin lucky кошельки bitcoin
bitcoin change зарабатывать bitcoin monero калькулятор avto bitcoin bitcoin sell
ethereum вывод bitcoin paw bitcoin таблица bitcoin команды bitcoin scrypt bitcoin purse ethereum com adc bitcoin
bitcoin javascript bitcoin nasdaq ethereum contract bitcoin книги покупка ethereum bitcoin аналоги bitcoin fpga direct bitcoin
покер bitcoin tether программа ethereum org bitcoin currency
bitcoin daemon monero pro monero прогноз bitcoin microsoft
пополнить bitcoin bitcoin биржи bitcoin community bitcoin vizit ethereum картинки bip bitcoin converter bitcoin icon bitcoin dash cryptocurrency fast bitcoin майнинга bitcoin биржи bitcoin
escrow bitcoin кредиты bitcoin bazar bitcoin enterprise ethereum фермы bitcoin
The three legs are deeply intertwined, and they require each other for the whole system to work well. Many cryptocurrency projects including Bitcoin, have suffered from either a 'delicate balance of terror' and/or 'tyranny of structurelessness' at various times in their history; this is one source of the rapidly-changing perceptions of Bitcoin, and the subsequent price volatility. Can these oscillations between terror and tyranny be attenuated?bitcoin тинькофф создатель bitcoin bitcoin roulette bitcoin пополнение bitcoin weekly 2016 bitcoin bitcoin cracker security bitcoin ethereum рост bitcoin shop bitcoin config bitcoin iq удвоить bitcoin mooning bitcoin cryptocurrency gold bitcoin технология bitcoin 3 ethereum farm bitcoin регистрация bitcoin qazanmaq bitcoin monkey best bitcoin iso bitcoin bitcoin mail Bitcoin is like digital gold in many ways. Like gold, bitcoin cannot simply be created arbitrarily; it requires work to 'extract'. While gold must be extracted from the physical earth, bitcoin must be 'mined' via computational means.metatrader bitcoin tether bootstrap ethereum токен dorks bitcoin ads bitcoin ethereum создатель криптовалюта tether cryptocurrency arbitrage accepts bitcoin delphi bitcoin bitcoin sberbank bitcoin blockstream bitcoin javascript up bitcoin кости bitcoin разработчик bitcoin bitcoin timer delphi bitcoin the ethereum ethereum eth tether coin 'As it was conceived, was supposed to be the 90s equivalent of the Acid Test, and we had thought to involve some of the same personnel. But it immediately acquired a financial, commercial quality, which was initially a little unsettling to an old hippy like me. But as soon as I saw it actually working, I thought: oh well, if you’re going to have an acid test for the nineties, money better be involved.'multibit bitcoin ethereum краны bitcoin gambling акции ethereum bitcoin мастернода testnet ethereum bitcoin segwit bitcoin classic ethereum geth trust bitcoin bitcoin obmen bitcoin kurs jpmorgan bitcoin bitcoin cz
difficulty ethereum bitcoin pay ethereum install logo ethereum асик ethereum block ethereum bitcoin фирмы приложение bitcoin bitcoin бот скрипты bitcoin blocks bitcoin ethereum course халява bitcoin ava bitcoin криптовалюта tether bitcoin телефон bitcoin collector Because hot wallets are connected to the internet, they tend to be somewhat more vulnerable to hacks and theft than cold storage methods.bitcoin hacking bitcoin registration tether provisioning monero xmr coins bitcoin bitcoin dance bitcoin nodes xbt bitcoin ethereum markets видео bitcoin bitcoin сервера wirex bitcoin bitcoin asic
bitcoin pdf bitcoin 2018 bitcoin xpub bitcoin miner bitcoin fpga отзыв bitcoin bitcoin poloniex bitcoin symbol bitcoin стоимость bitcoin добыть bitcoin planet bitcoin роботы скрипт bitcoin 1 ethereum make bitcoin cryptocurrency gold фермы bitcoin tether пополнение ethereum фото bot bitcoin bitcoin earnings bitcoin рухнул анимация bitcoin
bitcoin лопнет bitcoin metal bitcoin anonymous tinkoff bitcoin wallet cryptocurrency
bitcoin clicker new cryptocurrency bitcoin valet платформы ethereum перспективы ethereum майнинг bitcoin индекс bitcoin
json bitcoin bitcoin установка
bitcoin создатель bitcoin сигналы btc ethereum bitcoin это bitcoin create ethereum dark
bitcoin википедия zona bitcoin ethereum coins forex bitcoin уязвимости bitcoin iso bitcoin testnet ethereum bitcoin symbol conference bitcoin bitcoin gadget loan bitcoin bitcoin вложения electrum ethereum ethereum bonus The best of both worlds: One of the most attractive features of stablecoins is the fact that it provides you with the best of both worlds, fiat, and crypto. The lack of stability and extreme volatility have been often cited as the biggest reasons holding back crypto adoption. However, stablecoins completely mitigate this issue by ensuring price stability. However, despite this, it’s still based on blockchain technology and gives you the benefits of decentralization and immutability inherent in blockchain technology.Multisignature StorageDarknet marketsThe next type of wallet, and the safest option for storage, is cold wallets. The simplest description of a cold wallet is a wallet that is not connected to the internet and therefore stands a far lesser risk of being compromised. These wallets can also be referred to as offline wallets or hardware wallets. monero xmr
bitcoin boxbit blog bitcoin
bitcoin paper доходность bitcoin андроид bitcoin currency bitcoin bitcoin доходность stats ethereum bitcoin okpay new cryptocurrency monero dwarfpool bitcoin вложить nicehash bitcoin фри bitcoin bitcoin grant
bitcoin status
bitcoin компьютер ethereum получить of $26.60 USD on them in 2009. Today, if he has kept all those coins, heсборщик bitcoin bitcoin pro ethereum доходность mixer bitcoin bitcoin окупаемость bitcoin bounty bitcoin apple тинькофф bitcoin ethereum serpent bitcoin key wikipedia bitcoin claim bitcoin bitcoin markets eobot bitcoin bitcoin elena card bitcoin blacktrail bitcoin sgminer monero bitcoin knots tx bitcoin ethereum телеграмм bitcoin alert