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.
monero nvidia bitcoin sec Bitcoin Transactionsbitcoin billionaire titan bitcoin monero poloniex bitcoin visa rotator bitcoin hacking bitcoin
курс monero
usdt tether visa bitcoin monero сложность фермы bitcoin использование bitcoin bitcoin play bitcoin алгоритм
bitcoin formula usd bitcoin bitcoin скачать bitcoin start bitcoin ocean bitcoin passphrase invest bitcoin надежность bitcoin short bitcoin direct bitcoin bitcoin зарегистрироваться chaindata ethereum cryptocurrency это bitcoin haqida ethereum forks etoro bitcoin bitcoin co bitcoin компьютер bitcoin conveyor
faucet ethereum исходники bitcoin wechat bitcoin
zona bitcoin bazar bitcoin eth ethereum cudaminer bitcoin bitcoin новости de bitcoin monero форк
primedice bitcoin
bitcoin смесители monero продать cryptonight monero bitcoin сегодня доходность ethereum cpa bitcoin tor bitcoin
настройка ethereum asic monero
bitcoin click bitcoin options bitcoin добыть bitcoin super рост ethereum loan bitcoin 100 bitcoin будущее bitcoin удвоитель bitcoin bitcoin girls
coingecko ethereum bitcoin онлайн ethereum bitcointalk компьютер bitcoin проекта ethereum cryptocurrency wikipedia dwarfpool monero bitcoin txid bitcoin genesis avto bitcoin bitcoin вики bitcoin лучшие tether wallet kupit bitcoin bubble bitcoin bitcoin eobot byzantium ethereum ethereum скачать Earning cryptocurrencies is not only about mining Bitcoin (BTC) anymore. Bitcoin is a proof-of-work (PoW) blockchain where new BTC are generated through an energy-intensive process of solving mathematical tasks, known as 'mining.' Many newer blockchains instead use proof-of-stake (PoS) algorithms which require significantly less energy. The correctness of transactions in PoS blockchains is attested to by people who lock up a certain amount of the cryptocurrency in the protocol. This process, called 'staking' allows the cryptocurrency owners to earn a staking reward for their participation in the network.In 1602 merchants from the Netherlands merged together six small companies and pooled 64 tonnes of gold to form the Dutch East India Companyethereum linux coinmarketcap bitcoin bitcoin мошенничество
Ethereum also allows for the creation of decentralized organizations, which are run entirely by code on the blockchain. In 2019, one such app, known as the DAO (Decentralized Autonomous Organization) was hacked, resulting in a loss of 50 million U.S. dollars in Ether.cudaminer bitcoin Do not click links without knowing where they lead, and be careful about visiting unfamiliar websites.transaction bitcoin monero amd accepts bitcoin bitcoin registration block bitcoin bitcoin wordpress bitcoin store обмен tether вики bitcoin bitcoin antminer кошельки bitcoin service bitcoin captcha bitcoin bitcoin json котировки ethereum bitcoin etf seed bitcoin пулы monero kong bitcoin monero free bitcoin heist спекуляция bitcoin bitcoin символ ico monero
ethereum explorer
bitcoin обменник forbot bitcoin bitcoin s life bitcoin bitcoin серфинг credit bitcoin bitcoin loan bitcoin халява bitcoin википедия bitcoin is
bitcoin 2018 cnbc bitcoin network bitcoin nicehash bitcoin 999 bitcoin bitcoin s bitcoin capital bitcoin спекуляция
bitcoin видеокарта erc20 ethereum bitcoin casinos
blocks bitcoin bitcoin rpg алгоритм monero bitcoin apple rpg bitcoin
расчет bitcoin валюты bitcoin delphi bitcoin bitcoin billionaire bitcoin создать seed bitcoin bitcoin check андроид bitcoin txid bitcoin
bitcoin пул bitcoin png bitcoin pools bitcoin книга bitcoin update 22 bitcoin bitcoin mt4 бесплатно bitcoin x2 bitcoin neo bitcoin сайт ethereum вложения bitcoin
bitcoin clicker hack bitcoin bitcoin money rinkeby ethereum ethereum swarm ethereum аналитика bitcoin login world bitcoin bitcoin терминал bitcoin wm динамика ethereum bitcoin nachrichten биржа monero bitcoin котировки bitcoin daemon account bitcoin bitcoin update bitcoin atm cudaminer bitcoin приложение tether ethereum бесплатно magic bitcoin stake bitcoin ethereum crane bitcoin school
bitcoin приложение habrahabr bitcoin bitcoin hardfork bitcoin кранов bitcoin hd
fast bitcoin bitcoin hardware top cryptocurrency chain bitcoin putin bitcoin ethereum supernova ethereum акции matteo monero mac bitcoin bitcoin antminer bitcoin кредиты ethereum заработок balance bitcoin bitrix bitcoin
валюты bitcoin bitcoin конвектор
bitcoin payeer получение bitcoin cz bitcoin china bitcoin ethereum википедия After the Depression, a class of professionals emerged to take major business decisions away from the business owners. Industry would be run by professional managers, who would execute plans in the best interest of both the owners and the employees. They derived their positions and power from their competence, not their percentage of ownership. The greedy shareholders could be held at bay in this new structure. John Kenneth Galbraith, the Harvard economics professor, studied this phenomenon at the time:dark bitcoin Many groups have created flowcharts to help a person or entity decide between a blockchain or master copy, client-server database. The following factors are a distillation of much of what has been previously done:genesis bitcoin
mindgate bitcoin фермы bitcoin bitcoin автоматом bitcoin reserve зебра bitcoin
bitcoin cran loan bitcoin monero amd bitcoin акции wallet cryptocurrency bitcoin рубль bitcoin instant security bitcoin currency bitcoin The Best Litecoin Mining Hardwareфорумы bitcoin асик ethereum майнер ethereum доходность ethereum терминал bitcoin nicehash bitcoin claim bitcoin bitcoin fpga wikipedia ethereum programming bitcoin bitcoin accepted
okpay bitcoin windows bitcoin 6000 bitcoin forecast bitcoin bitcoin инструкция bitcoin kran bitcoin fun icons bitcoin rpg bitcoin rates bitcoin monero купить china bitcoin japan bitcoin monero пул ethereum обвал connect bitcoin bitcoin drip
airbitclub bitcoin ethereum forum компиляция bitcoin puzzle bitcoin
accepts bitcoin chain bitcoin bitcoin 2000 monero gpu
bitcoin mail bitcoin коллектор bitcoin demo Online and available 24 hours a day, 365 days per year.app bitcoin ava bitcoin bitcoin tx bitcoin заработок
Litecoin has since proven a valuable test ground for more experimental cryptocurrency features.bitcoin etherium график bitcoin asics bitcoin These ideas would come to crystallize the hacker approach to building software.In theory, anyone can set their computers to focus on these cryptographic puzzles as a way to win rewards. The catch is that mining on major public blockchains tends to require more and more power over time. As more people invest in more powerful hardware to mine cryptocurrency, the calculations get harder. Miners using regular computers are very, very unlikely to win.android tether 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 cpa 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 bitcoin asic ethereum контракты forbot bitcoin car bitcoin tether android особенности ethereum bitcoin описание bitcoin free криптовалюты ethereum сервера bitcoin ico monero monero cpu ethereum blockchain ethereum miner bitcoin arbitrage FACEBOOKethereum продам сбербанк ethereum система bitcoin видеокарты bitcoin ethereum contract ethereum обменять продажа bitcoin
bitcoin auto cryptocurrency calendar bitcoin мастернода bitcoin flex bitcoin ads ethereum contracts
cryptocurrency faucet payable ethereum bitcoin москва fun bitcoin second bitcoin Let’s look at value a little further, because it’s a contentious issue with Bitcoin. There are many (including Paul Krugman) who believe Bitcoin isn’t worth anything and is no more than a speculative bubble fad.bitcoin 4000
ecdsa bitcoin эфир bitcoin casper ethereum ledger bitcoin shot bitcoin bittorrent bitcoin bitcoin redex bitcoin инструкция перевести bitcoin ethereum github стоимость ethereum blake bitcoin bitcoin accelerator принимаем bitcoin
ethereum ann
bitcoin фарм mine ethereum sha256 bitcoin flex bitcoin tradingview bitcoin abi ethereum cryptocurrency это bitcoin вклады bitcoin игры ethereum график bitcoin kran bitcoin lurkmore lite bitcoin
консультации bitcoin майнинг tether bitcoin 100 buy ethereum ethereum com hashrate bitcoin satoshi bitcoin bitcoin email token ethereum майн ethereum ethereum ферма hit bitcoin скрипты bitcoin bitcoin mmm bitcoin выиграть bitcoin blockstream курс ethereum multisig bitcoin bitcoin safe ethereum доллар cryptocurrency fork bitcoin
bitcoin stealer кран bitcoin bitcoin доходность usb tether ethereum script
mining monero monero ann bitcoin iq reddit cryptocurrency monero новости bitcoin валюта monero miner bitcoin nvidia bootstrap tether miningpoolhub ethereum rbc bitcoin bitcoin покупка electrum ethereum plus500 bitcoin bitcoin network bitcoin cracker пополнить bitcoin ethereum homestead bitcoin planet
monero пул adc bitcoin ethereum wikipedia ios bitcoin казино ethereum joker bitcoin collector bitcoin solo bitcoin лото bitcoin bitcoin project bitcoin биткоин
казино ethereum chaindata ethereum bitcoin пополнить monero pro forecast bitcoin bitcoin bitcointalk валюта tether
шахта bitcoin clicker bitcoin оплата bitcoin bitcoin proxy ethereum bitcoin legal bitcoin проверка сложность ethereum magic bitcoin skrill bitcoin mining ethereum global network of Bitcoin is accessible from anywhere on the planet.bitcoin markets bitcoin переводчик surf bitcoin ssl bitcoin займ bitcoin сложность bitcoin ethereum btc bitcoin развод monero cpu The other way to buy Ethereum with fiat currency is to go through a peer-to-peer (P2P) exchange. Through a P2P exchange, you can anonymously buy ETH without any ID requirements. Buyers and sellers can connect and mutually decide on price and payment methods.frontier ethereum xbt bitcoin кошель bitcoin bitcoin artikel эмиссия ethereum кошелек bitcoin bitcoin сша
reklama bitcoin generator bitcoin
шифрование bitcoin ethereum статистика bitcoin loan poloniex ethereum bitcoin development полевые bitcoin nxt cryptocurrency bitcoin суть super bitcoin форк bitcoin mine ethereum phoenix bitcoin настройка monero bitcoin wmx bitcoin автоматически прогнозы ethereum fpga bitcoin bitcoin магазины bitcoin investing bitcoin проблемы elysium bitcoin ethereum telegram solo bitcoin bitcoin автоматом bitcoin fees bitcoin программа putin bitcoin foto bitcoin video bitcoin ethereum testnet nanopool monero instaforex bitcoin ethereum акции kong bitcoin ethereum cpu bitcoin рухнул ethereum проблемы bitcoin mmgp bitcoin dump bitcoin пул bitcoin monkey рынок bitcoin bitcoin crash client ethereum