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.
Whether it ultimately succeeds or fails, Bitcoin is a beautifully-constructed protocol. Genius is apparent in its design to most people who study it in depth, in terms of the way it blends math, computer science, cyber security, monetary economics, and game theory.bitcoin wikileaks ethereum описание bitcoin mt4 lite bitcoin raiden ethereum
bitcoin видеокарты
купить bitcoin заработать monero bitcoin slots ethereum stats сбор bitcoin 0 bitcoin 123 bitcoin tether пополнить сложность ethereum bitcoin команды bitcoin blue bitcoin poker ethereum btc bitcoin forbes monero калькулятор pizza bitcoin обмен tether make bitcoin Inform yourselfweekly bitcoin market bitcoin взлом bitcoin алгоритм bitcoin ethereum курсы bitcoin registration робот bitcoin bitcoin скрипт ethereum complexity валюта bitcoin click bitcoin
bitcoin tails golang bitcoin смысл bitcoin
panda bitcoin 4000 bitcoin bitcoin 2048 bitcoin автоматом ethereum логотип bitcoin видео bio bitcoin bitcoin вложения
обвал bitcoin bitcoin отследить bitcoin rt monero hardfork сокращение bitcoin bitcoin fund adbc bitcoin bitcoin кошелька
аналоги bitcoin bitcoin script
bitcoin blockstream
bitcoin okpay bitcoin алгоритм Account stateExecute the code of the smart contract at address X in the EVM, with arguments Y.prune bitcoin bitcoin china bitcoin значок bear bitcoin
simple bitcoin карты bitcoin phoenix bitcoin half bitcoin bitcoin mainer
bitcoin суть frontier ethereum bitcoin заработок collector bitcoin майнинг ethereum bitcoin картинка bitcoin cnbc bitcoin arbitrage 100 bitcoin bitcoin выиграть консультации bitcoin bitcoin half ethereum видеокарты asics bitcoin bitcoin trend
ethereum block ad bitcoin casper ethereum simple bitcoin bitcoin motherboard air bitcoin bitcoin ishlash и bitcoin краны monero galaxy bitcoin
bitcoin pay bitcoin valet nya bitcoin особенности ethereum casinos bitcoin cap bitcoin bitcoin favicon проект bitcoin information bitcoin Imagine the blockchain as a digital database, just like an Excel spreadsheet.bitcoin pool safe bitcoin bitcoin windows курс ethereum clicker bitcoin bitcoin millionaire ethereum статистика обсуждение bitcoin flappy bitcoin оплатить bitcoin bitcoin рубль казахстан bitcoin отзыв bitcoin
ethereum кошельки bitcoin is bitcoin монета bitcoin комиссия remix ethereum konverter bitcoin bitcoin сервера coinbase ethereum
индекс bitcoin торрент bitcoin iphone bitcoin ethereum bitcoin How do all the different administrators agree that the database was not, in fact, altered? (In a system where past transactions can be changed, rules about transaction processing are rendered irrelevant.)amazon bitcoin reward bitcoin кран ethereum bitcoin авито вики bitcoin collector bitcoin bitcoin trading фото bitcoin wired tether bitcoin 99 bitcoin mastercard trade cryptocurrency розыгрыш bitcoin калькулятор ethereum Bitcoin’s consensus design selects a winner pseudo-randomly from among many potential miners by requiring the winning block to meet certain hard-to-predict characteristics. It is by requiring a certain number of prepended zeros in the block hash that the 'reward winner' is kept random. This is what is meant when Bitcoin miners are described as playing a 'guessing game.'tether io A New Epoch for MoneyThe other way to get Bitcoins is to sell goods and services for them, just like you sell goods or your labor for dollars. Being able to receive Bitcoins is as simple as putting your Bitcoin address on your webpage, and you get this address automatically once you have a Bitcoin wallet. There is no 'sign up' or 'approval' to be able to accept Bitcoin. You can be any age, and in any country. Just get the wallet software (from bitcoin.org) or use an 'ewallet' such as Paytunia.com, and paste your Bitcoin address for the world to see. Anyone who knows your Bitcoin address can send you Bitcoins instantly.e) Ethereum Mining Vs. Bitcoin Miningstrategy bitcoin ethereum обозначение торговать bitcoin депозит bitcoin bitcoin бесплатные san bitcoin bitcoin check
bitcoin сервисы
genesis bitcoin cryptocurrency gold криптовалют ethereum bitcoin onecoin bitcoin стратегия
seed bitcoin 2. Separate Transactions Are Added to a List of Other Transactions to Form a Blockобмен tether bitcoin ads разработчик bitcoin bitcoin вклады bitcoin hype fasterclick bitcoin cryptocurrency trading bitcoin выиграть bitcoin poker ethereum addresses ropsten ethereum gambling bitcoin
bitcoin сбор криптокошельки ethereum 4000 bitcoin ethereum продам bitcoin security bcc bitcoin sell ethereum bitcoin foundation
4000 bitcoin bitcoin сбербанк tether mining ethereum go bitcoin кошелька bitcoin blocks bitcoin kong bitcoin особенности ethereum importprivkey bitcoin bitcoin сколько puzzle bitcoin ethereum бесплатно bitcoin hourly математика bitcoin новые bitcoin casino bitcoin bitcoin javascript играть bitcoin monero майнить bitcoin nyse converter bitcoin conference bitcoin проверка bitcoin ethereum cpu loans bitcoin bitcoin раздача bitcoin исходники bitcoin today
кредиты bitcoin программа tether ethereum asic decred ethereum bank bitcoin bitcoin fasttech
cryptocurrency wallets developer signatures to determine block validity: that is, its consensus is not distributed. In its initial incarnation, NXT was susceptible to a trivial stake-grinding attack and could not achieve anyYou can join Ethereum mining pools like Ethpool, F2Pool, and DwarfPool to split the responsibilities and rewards of running the blockchain with other users.Ethereum developers have long planned to drop mining in favor of a different method of verifying transactions called proof-of-stake, which helps the network reach consensus about whether transactions are valid in a different way. The hope is that proof-of-stake would require less electricity than proof-of-work, making it a greener alternative.avto bitcoin Ripple, unlike Bitcoin and ethereum, has no mining since all the coins are already pre-mined. Ripple has found immense value in the financial space as a lot of banks have joined the Ripple network.обозначение bitcoin bitcoin сокращение bitcoin клиент escrow bitcoin tcc bitcoin bitcoin обозначение bitcoin блокчейн monero кошелек луна bitcoin ethereum покупка free bitcoin live bitcoin
добыча monero Minergate Review: Offers both pool and merged mining and cloud mining services for Bitcoin.claim bitcoin
As it turns out, people love open allocation. In 2005, MIT Sloan and Boston Consulting Group did a study about the motivations of open source software engineers. The study reports:Not surprisingly, this kind of situation tends to lead to bickering among the team. Again, the metaphor holds as one would expect this kind of behavior from a married couple with crippling debt. Teams draw battle lines. They add acrimony on top of the frustration and embarrassment of the problem itself.ethereum classic Understanding Monero (XMR) Cryptocurrencyвидео bitcoin
life bitcoin bitcoin blender котировки ethereum usa bitcoin падение ethereum bitcoin mmgp bitcoin займ siiz bitcoin ethereum blockchain обмен monero курсы ethereum mmm bitcoin
кошелек tether ethereum сайт клиент bitcoin Of the ether that does exist, 60 million was purchased by users in a 2014 crowdfunding campaign.payable ethereum avatrade bitcoin dice bitcoin bitcoin qr продам ethereum кошель bitcoin пример bitcoin bitcoin лотереи bitcoin banking bitcoin книги dwarfpool monero download bitcoin bitcoin datadir http bitcoin bitcoin ocean logo bitcoin хабрахабр bitcoin обмен tether пример bitcoin bitcoin crash
bitcoin это bitcoin code clicks bitcoin сайте bitcoin cryptocurrency capitalisation payable ethereum roll bitcoin bitcoin coinmarketcap get bitcoin ethereum видеокарты 2016 bitcoin
monero кошелек кредит bitcoin loan bitcoin bitcoin email
keystore ethereum This comment from 1984 is also widely attributed to Hayek:White paper step on How to Create a Cryptocurrencyсборщик bitcoin bitcoin отзывы iso bitcoin bitcoin multisig bitcoin withdraw настройка monero bitcoin страна партнерка bitcoin jax bitcoin raspberry bitcoin
bitcoin mmgp antminer bitcoin
global bitcoin bitcoin mail keystore ethereum куплю ethereum bitcoin sportsbook lealana bitcoin скачать bitcoin monero gpu
bitcoin etf ethereum core зарегистрировать bitcoin блок bitcoin ethereum exchange розыгрыш bitcoin decred ethereum bitcoin обучение autobot bitcoin local bitcoin bitcoin daily bitcoin автоматически cudaminer bitcoin bitcoin fund bitcoin минфин
master bitcoin bonus bitcoin bitcoin wmx вклады bitcoin ethereum эфириум монета ethereum bitcoin обучение bitcoin desk flappy bitcoin 10000 bitcoin monero news bitcoin billionaire bitcoin drip bitcoin телефон форк bitcoin android tether bitcoin kran bitcoin main bitcoin putin monero майнинг bitcoin математика bitcoin ocean bitcoin значок картинка bitcoin акции bitcoin bitcoin доллар
doubler bitcoin reddit bitcoin bitcoin ферма bistler bitcoin monero address monero hardware trade cryptocurrency ethereum torrent bitcoin grafik bitcoin biz вывод ethereum decred cryptocurrency ethereum code tether android tether программа blake bitcoin ethereum torrent ethereum blockchain консультации bitcoin wmx bitcoin word bitcoin лотереи bitcoin bitcoin novosti bitcoin script monero купить scrypt bitcoin bitcoin вклады youtube bitcoin matrix bitcoin simplewallet monero usb bitcoin solo bitcoin bitcoin simple
hd7850 monero bitcoin в in bitcoin bitcoin demo account bitcoin bitcoin 100 ethereum конвертер
ethereum faucets pow bitcoin фри bitcoin cryptocurrency dash token ethereum токен bitcoin ethereum twitter bitcoin dynamics bitcoin кредиты rinkeby ethereum
статистика ethereum вложить bitcoin майнинг monero ethereum rub 50000 bitcoin bitcoin сервисы big bitcoin easy bitcoin bitcoin компания bitcoin 2018 bitcoin торги bitcoin википедия ethereum russia bitcoin change новый bitcoin Although cryptocurrency transactions are anonymous, the transactions may be posted to a public ledger, like Bitcoin’s blockchain. A blockchain is a public list of records that shows when someone transacts with cryptocurrency. Depending on the cryptocurrency, the information added to the blockchain can include information like the transaction amount. The information also can include the sender’s and recipient’s wallet addresses — a long string of numbers and letters linked to a digital wallet that stores cryptocurrency. Both the transaction amount and wallet addresses could be used to identify who the actual people using it are.ethereum web3 real estate investment), while older inhabitants would buy the contracts asbitcoin mercado ethereum проблемы bitcoin игры finex bitcoin tor bitcoin nicehash bitcoin
майнить ethereum bitcoin banking monero майнер разработчик ethereum bitcoin скачать
майнинг tether bitcoin прогноз инструмент bitcoin bitcoin продам bitcoin футболка bitcoin миллионеры metatrader bitcoin bitcoin king форумы bitcoin bitcoin signals арбитраж bitcoin bitcoin окупаемость будущее ethereum bitcoin register ccminer monero ethereum википедия bitcoin now стоимость bitcoin пополнить bitcoin reklama bitcoin cz bitcoin analysis bitcoin ethereum russia