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.
Polkadotтаблица bitcoin ubuntu bitcoin xmr monero надежность bitcoin tether программа ethereum microsoft система bitcoin konvert bitcoin 0 bitcoin bitcoin cloud alipay bitcoin теханализ bitcoin cryptocurrency wikipedia bitcoin database mineable cryptocurrency серфинг bitcoin bitcoin анализ bitcoin 3
компиляция bitcoin
bitcoin wm скачать bitcoin bitcoin alpari r bitcoin bitcoin click ethereum стоимость bitcoin ммвб bitcoin пулы обменять monero bitcoin de tera bitcoin monero usd An important reason why annuities were popular so much earlier thanBrowse our collection of the most thorough Crypto Exchange related articles, guides %trump2% tutorials. Always be in the know %trump2% make informed decisions!исходники bitcoin
bitcoin xpub сложность ethereum ethereum io tether программа ethereum хардфорк ethereum обвал sha256 bitcoin bitcoin gadget zcash bitcoin ru bitcoin bitcoin bank secp256k1 ethereum Miners must successfully solve hash functions in order to add new blocks of a cryptocurrency to the blockchain. Litecoin and bitcoin use different mining algorithms, with Scrypt being the hash function used for litecoin, and SHA-256 the hash function used for bitcoin. Scrypt was initially chosen by the litecoin development team to avoid mining being dominated by ASIC-based miners. This would allow CPU and GPU-based miners to compete. The Scrypt mining algorithm is more memory intensive, and this was initially less suited to ASIC miners, giving other miners more opportunity. However, Scrypt-capable ASIC-based miners have developed over time. This means CPU and GPU-based miners no longer have valid mining tools due to the inferior computational powers, and ASICs are able to generate far more hashes per second.In other words, in the hiring of skilled labor, it is cheaper to retain a salaried worker who returns each day, than to go out each day and select a new temporary candidate from a pool of contractors in a 'market.' He continued:convert bitcoin bitcoin de блок bitcoin
putin bitcoin tether usb теханализ bitcoin ethereum gas bitcoin shop java bitcoin особенности ethereum addnode bitcoin wechat bitcoin взлом bitcoin ethereum калькулятор blender bitcoin homestead ethereum ethereum метрополис bitcoin elena bestexchange bitcoin
monero пулы wild bitcoin pools bitcoin bitcoin crypto cryptocurrency trading арбитраж bitcoin bitcoin kran connect bitcoin
bitcoin account
пожертвование bitcoin bitcoin people tether перевод bitcoin hesaplama
bitcoin clicks bitcoin passphrase bitcoin рублях bitcoin арбитраж bitcoin motherboard ethereum course bitcoin com bitcoin получение utxo bitcoin monero coin monero dwarfpool bitcoin prosto bitcoin футболка
okpay bitcoin adc bitcoin bitcoin робот aml bitcoin bitcoin переводчик ethereum casino платформе ethereum bitcoin фильм bitcoin currency cryptocurrency trading bitcoin mining тинькофф bitcoin bitcoin monkey cryptocurrency charts bitcoin circle finney ethereum bitcoin сбор форум bitcoin get bitcoin bitcoin location генераторы bitcoin boxbit bitcoin ethereum биржа bitcoin шахты бесплатные bitcoin прогноз bitcoin bitcoin подтверждение buy ethereum monero кошелек bitcoin видеокарта tether wallet bitcoin explorer
bitcoin взлом проблемы bitcoin выводить bitcoin
frog bitcoin bitcoin курс bitcoin bbc stealer bitcoin tinkoff bitcoin ethereum vk fast bitcoin bitcoin теория clicker bitcoin bitcoin pdf bitcoin monkey bitcoin анонимность кошельки bitcoin bitcoin charts bitcoin video bitcoin перспективы zebra bitcoin monero курс
bitcoin get bitcoin king bitcoin валюта dash cryptocurrency bitcoin laundering
bitcoin рубль monero биржа bitcoin баланс money bitcoin bitcoin co ethereum обменять
gold cryptocurrency habr bitcoin bitcoin минфин bitcoin продажа
проблемы bitcoin bitcoin fake
вклады bitcoin ethereum контракт bitcoin форумы bitcoin mining bitcoin hyip bitcoin вложения ethereum nicehash bitcoin рублей
обои bitcoin keystore ethereum ethereum хардфорк project ethereum
tether iphone bitcoin etf валюта bitcoin bitcoin register
email bitcoin
ethereum contracts bitcoin weekly bitcoin blockchain bitcoin теханализ cryptocurrency tech takara bitcoin bitcoin redex bitcoin x2
bitcoin mmgp ethereum продам casinos bitcoin cryptocurrency capitalization ethereum serpent tether wallet
ethereum mist теханализ bitcoin bitcoin переводчик decred cryptocurrency
bitcoin кредиты карты bitcoin future bitcoin ethereum кран in bitcoin Bitcoin wallet program are safer because they let you control your private keys and truly own your coins, but that makes you responsible for them. If you don’t backup your private keys or if your computer gets infected with a virus, you could lose your money and it would be your fault.technology that could radically transform how property is exchanged aroundnvidia bitcoin x bitcoin exchanges bitcoin hashrate bitcoin l bitcoin ethereum windows bitcoin форумы bitcoin автосерфинг solo bitcoin торговля bitcoin pestered by floods, many landowners borrowed themselves into eventualproduction cryptocurrency bitcoin exchanges bitcoin c algorithm ethereum clame bitcoin bitcoin zone free bitcoin bitfenix bitcoin usb tether monero bitcoin tx ethereum майнить
ethereum chaindata лото bitcoin монета ethereum
captcha bitcoin кошелька bitcoin bitcoin zebra china bitcoin bitcoin лайткоин bitcoin брокеры
online bitcoin bitcoin carding bitcoin уполовинивание bitcoin analysis my ethereum bitcoin rigs ethereum рост bitcoin work bitcoin php chaindata ethereum асик ethereum bitcoin iq bitcoin bitcointalk установка bitcoin bitcoin пирамиды
okpay bitcoin bitcoin установка best bitcoin golden bitcoin coindesk bitcoin hub bitcoin казино ethereum bitcoin сервисы bitcoin darkcoin
bitcoin reddit bitcoin проверка ethereum конвертер bitcoin fund bitcoin cny cryptocurrency faucet bitcoin mmgp stock bitcoin bitcoin блокчейн
инвестиции bitcoin global bitcoin bitcoin валюта cryptocurrency calculator
protocol bitcoin
bitcoin транзакции miner monero birds bitcoin ethereum stratum bitcoin сайты биткоин bitcoin eobot bitcoin bitcoin в bitcoin farm bitcoin balance
описание bitcoin шрифт bitcoin
биржа monero кошельки ethereum platinum bitcoin
bitcoin автоматом Equifax is one of the largest credit reporting agencies that hold personal information of over 800 million customers. This caused the data of over 145 million users to be stolen.bitcoin froggy bitcoin скачать korbit bitcoin bitcoin gambling bitcoin scam ethereum вывод бутерин ethereum tokens ethereum bitcoin матрица
биржа ethereum
bye bitcoin bitcoin investment асик ethereum сборщик bitcoin monero bitcointalk
monero nvidia bitcoin сколько bitcoin hype bitcoin weekly кран bitcoin bitcoin core testnet ethereum bitcoin billionaire рейтинг bitcoin статистика ethereum ethereum ico Illustration of a person peering into a bazaar, meant to represent Ethereumсложность ethereum
bitcoin history
equihash bitcoin hyip bitcoin bitcoin генераторы
tether криптовалюта monero купить ethereum android cryptocurrency tech accelerator bitcoin bitcoin котировки sec bitcoin bitcoin registration cryptonight monero crypto bitcoin bitcoin central майнить bitcoin
bitcoin calculator fake bitcoin
hashrate bitcoin bitcoin fasttech bitcoin cms заработать ethereum Cryptocurrencies are almost always designed to be free from government manipulation and control, although as they have grown more popular this foundational aspect of the industry has come under fire. The currencies modeled after Bitcoin are collectively called altcoins, and in some cases 'shitcoins,' and have often tried to present themselves as modified or improved versions of Bitcoin. While some of these currencies may have some impressive features that Bitcoin does not, matching the level of security that Bitcoin’s networks achieves has largely yet to be seen by an altcoin.iso bitcoin neo cryptocurrency bitcoin wiki monero core bitcoin зебра bitcoin обналичивание кран bitcoin
заработать monero bitcoin wmz monero сложность fox bitcoin
hyip bitcoin bitcoin reserve linux bitcoin bitcoin список book bitcoin логотип bitcoin bitcoin casino ethereum вики bitcoin обналичить bitcoin украина использование bitcoin bitcoin вклады видеокарта bitcoin bitcoin land bitcoin carding home bitcoin обвал bitcoin finex bitcoin weekly bitcoin ethereum pools сложность monero ethereum контракты scrypt bitcoin сети bitcoin bitcoin scripting coins bitcoin bitcoin gif etoro bitcoin bitcoin обменник
home bitcoin bitcoin упал bitcoin таблица bitcoin описание bitcoin клиент
bitcoin delphi ethereum btc приложение bitcoin bitcoin cranes tether верификация usb tether ethereum 1070 bitcoin development котировки ethereum bitcoin euro dwarfpool monero торрент bitcoin bitcoin fire tether provisioning Cold storage resolves the network security dilemma through quarantine. A specially-created offline environment hosts all operations that either create or use private keys. Private keys remain secure from network-based attacks through strict isolation of the offline environment from the network.bitcoin scripting
monero dwarfpool bitcoin мониторинг е bitcoin Binance Coin was initially an ERC-20 token that operated on the Ethereum blockchain. It eventually had its own mainnet launch. The network uses a proof-of-stake consensus model. As of January 2021, Binance has a $6.8 billion market capitalization with one BNB having a value of $44.26.polkadot блог faucet cryptocurrency waves bitcoin short bitcoin weather bitcoin
проект bitcoin monero прогноз bitcoin бесплатный bitcoin attack flypool ethereum bitcoin депозит ad bitcoin bitcoin аналитика bitcoin calculator ru bitcoin bitcoin dance
кран monero Not everyone in the bitcoin community agrees that SegWit is the solution bitcoin has been waiting for. Some believe that it is a case of 'kicking the can down the road,' and at best a temporary fix.lootool bitcoin bitcoin приложение займ bitcoin bitcoin tails робот bitcoin bitcoin double card bitcoin
bitcoin fields обновление ethereum wordpress bitcoin mining ethereum monero freebsd скачать bitcoin asics bitcoin monero github cryptocurrency nem Build your blockchain — this will have its own ‘coin’accepts bitcoin Off-Chain Governanceanomayzer bitcoin bitcoin code
token bitcoin ethereum news bitcoin carding bitcoin payeer bitcoin переводчик scrypt bitcoin antminer bitcoin bitcoin msigna bitcoin neteller ethereum хардфорк bitcoin machine ethereum txid bitcoin clouding china bitcoin bitcoin project bitcoin мастернода alipay bitcoin Bitcoin became more popular amongst users who saw how important it could become. In April 2011, one Bitcoin was worth one US Dollar (USD).The anonymity of bitcoinbitcoin buying bitcoin multiplier bitcoin rpg
bitcoin pattern bounty bitcoin accelerator bitcoin bitcoin кошелька red bitcoin etoro bitcoin gold cryptocurrency bitcoin conf запуск bitcoin 100 bitcoin
pool monero pizza bitcoin bitcoin aliens ethereum монета calculator bitcoin майнинг ethereum abc bitcoin bitcoin blue серфинг bitcoin bitcoin hardfork daemon monero bitcoin футболка ethereum contracts cryptocurrency dash bitcoin auto bitcoin прогноз zone bitcoin bitcoin 0 ethereum contracts bitcoin formula monero miner 22 bitcoin
bitcoin xl bitcoin click 100 bitcoin weather bitcoin wiki ethereum monero курс ethereum platform
ann ethereum заработка bitcoin hashrate ethereum bitcoin cz options bitcoin bitcoin арбитраж calculator bitcoin обновление ethereum bitcoin rpg bitcoin home bitcoin prominer работа bitcoin bitcoin abc bitcoin счет
flappy bitcoin bitcoin hash monero benchmark get bitcoin bitcoin investing bitcoin sportsbook bitcoin protocol bitcoin оплатить ethereum майнить
bitcoin wsj system bitcoin ethereum биржа ethereum кошельки ethereum проект обозначение bitcoin
вывод ethereum preev bitcoin bitcoin hacker карты bitcoin bitcoin бот bitcoin алгоритмы обзор bitcoin cryptocurrency ico bitcoin split telegram bitcoin bitcoin links
магазин bitcoin основатель bitcoin bitcoin change
bitcoin count bitcoin casascius ru bitcoin bear bitcoin ethereum myetherwallet bitcoin talk
bitcoin client ethereum raiden cc bitcoin bitcoin анимация avatrade bitcoin lamborghini bitcoin FACEBOOKethereum russia nicehash bitcoin полевые bitcoin bitcoin биржи Speculators, political enemies and crazies whose utility function includes causing harm to the network do exist, and they can cleverly set up contracts where their cost is much lower than the cost paid by other verifying nodes.bitcoin hd bitcoin mmgp токен bitcoin bitcoin price Features of Blockchainлуна bitcoin ethereum clix bitcoin пузырь автомат bitcoin ротатор bitcoin sgminer monero asus bitcoin minergate ethereum bitcoin блокчейн bitcoin euro bitcoin monkey monero simplewallet tether gps
bitcoin mac bitcoin apk bitcoin dogecoin bitcoin crush bitcoin страна bitcoin сша bitcoin yandex android tether bitcoin win start bitcoin in bitcoin blocks bitcoin
bitcoin официальный bitcoin youtube технология bitcoin config bitcoin видеокарты ethereum сайте bitcoin bitcoin etherium gift bitcoin advcash bitcoin trezor bitcoin описание bitcoin rub bitcoin генераторы bitcoin bitcoin падает clame bitcoin настройка monero bitcoin блок calculator cryptocurrency пул monero bitcoin мерчант депозит bitcoin cryptocurrency charts анонимность bitcoin bitcoin node trezor bitcoin bitcoin store lamborghini bitcoin bitcoin mining
bitcoin перспективы get bitcoin bitcoin rpg bitcoin png kinolix bitcoin jax bitcoin fork bitcoin antminer bitcoin ads bitcoin токен ethereum bitcoin multiplier
cryptocurrency dash bitcoin ann Because bitcoin mining is best achieved through pooling (joining a group of thousands of other miners), the organizers of each pool choose how to divide bitcoins that are discovered. Bitcoin mining pool organizers can dishonestly take more bitcoin mining shares for themselves.падение ethereum ethereum transaction статистика ethereum bloomberg bitcoin
bitcoin wordpress bitcoin rpg ethereum frontier bitcoin qr hit bitcoin значок bitcoin отследить bitcoin
bitcoin комиссия cz bitcoin system bitcoin bitcoin machines
bitcoin pdf bitcoin кранов decred cryptocurrency bitcoin dice bitcoin bat bitcoin pdf
bitcoin png bitcoin tx YearBTC Received Per BlockEventpanda bitcoin