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 tether 4pda micro bitcoin смесители bitcoin monero cryptonote forum ethereum bitcoin jp
казино ethereum
miningpoolhub monero 3. A decentralized data feed. For financial contracts for difference, it may actually be possible to decentralize the data feed via a protocol called SchellingCoin. SchellingCoin basically works as follows: N parties all put into the system the value of a given datum (eg. the ETH/USD price), the values are sorted, and everyone between the 25th and 75th percentile gets one token as a reward. Everyone has the incentive to provide the answer that everyone else will provide, and the only value that a large number of players can realistically agree on is the obvious default: the truth. This creates a decentralized protocol that can theoretically provide any number of values, including the ETH/USD price, the temperature in Berlin or even the result of a particular hard computation.сколько bitcoin ethereum casino pinktussy bitcoin bitcoin spin bitcoin location 999 bitcoin карты bitcoin bitcoin casascius bitcoin иконка rise cryptocurrency 5. Decentralized Autonomous Organizations (DAOs)арестован bitcoin bank bitcoin accepts bitcoin bitcoin free simple bitcoin обменник bitcoin
bitcoin комиссия
dwarfpool monero ethereum supernova работа bitcoin boxbit bitcoin
token ethereum ethereum io bitcoin plus monero *****u конвертер bitcoin atm bitcoin top cryptocurrency bitcoin exchanges bitcoin machine компания bitcoin бизнес bitcoin исходники bitcoin monero 1060 купить bitcoin cryptocurrency wikipedia ico monero bitcoin poloniex bitcoin hash работа bitcoin кран bitcoin
monero hardfork unconfirmed bitcoin TWITTERIn the private consumer world, Blockchain technology can be employed by two parties who wish to conduct a private transaction. However, these kinds of transactions have details that need to be hammered out before both parties can proceed:bitcoin machines ethereum обозначение bitcoin расшифровка
обменники bitcoin bitcoin видеокарты trinity bitcoin арбитраж bitcoin bitcoin видео bitcoin daemon ethereum бесплатно
stats ethereum япония bitcoin currency bitcoin cryptocurrency calculator ethereum пул bitcoin putin ethereum course bitcoin monkey
вложения bitcoin bitcoin минфин бесплатные bitcoin bitcoin phoenix bitcoin scam bitcoin grant solidity ethereum bitcoin simple
bitcoin количество
пример bitcoin Advantages of Cloud Mininghourly bitcoin ecdsa bitcoin bitcoin конец lealana bitcoin bitcoin авито bitcoin регистрации bitcoin информация bitcoin kz алгоритмы ethereum миллионер bitcoin bitcoin forbes bitcoin club How this digital currency works and why it's so controversialbitcointalk ethereum кошель bitcoin bitcoin roulette ethereum telegram автомат bitcoin Anyone who wants to make a profit through cryptocurrency mining has the choice to either go solo with their own dedicated devices or to join a mining pool where multiple miners and their devices combine to enhance their hashing output. For example, attaching six mining devices that each offers 335 megahashes per second (MH/s) can generate a cumulative 2 gigahashes of mining power, thereby leading to faster processing of the hash function.bitcoin сеть виталик ethereum bitcoin bat future bitcoin bitcoin froggy
bitcoin primedice bitcoin bio raiden ethereum bitcoin вектор
куплю ethereum ios bitcoin webmoney bitcoin bitcoin майнер bitcoin вложения service bitcoin bitcoin block миксеры bitcoin tether android asus bitcoin bitcoin neteller wired tether bitcoin word bitcoin aliexpress подтверждение bitcoin
monero gui bitcoin зебра bitcoin antminer top bitcoin bitcoin services joker bitcoin usa bitcoin seed bitcoin accepts bitcoin rigname ethereum forecast bitcoin bitcoin check ethereum torrent bitcoin 2048 bitcoin cny bitcoin лайткоин casino bitcoin ethereum homestead майнинг bitcoin bitcoin get bitcoin википедия bitcoin продам average bitcoin byzantium ethereum алгоритмы ethereum
Transaction speed is yet another difference between Ethereum and Bitcoin.bitcoin free ethereum core торги bitcoin проблемы bitcoin bitcoin хайпы ethereum zcash bitcoin golden bitcoin зебра bitcoin софт faucet ethereum bitcoin king gemini bitcoin bitcoin сигналы se*****256k1 bitcoin metal bitcoin блог bitcoin bitcoin click транзакции monero bitcoin motherboard bitcoin email production cryptocurrency
ethereum краны bitcoin рейтинг game bitcoin clame bitcoin
bubble bitcoin
apple bitcoin bonus ethereum bitcoin sec перевести bitcoin bitcoin graph github ethereum foto bitcoin оборот bitcoin bitcoin автоматически видео bitcoin bitcoin автоматический калькулятор bitcoin accept bitcoin токены ethereum будущее bitcoin bitcoin комиссия ставки bitcoin виджет bitcoin monero simplewallet bitcoin zebra putin bitcoin
This article may require cleanup to meet Wikipedia's quality standards. The specific problem is: Needs verification and documentation Please help improve this article if you can. (May 2015) (Learn how and when to remove this template message)адрес bitcoin ethereum casino Something could have gone wrong at the bank (such as a technical issue)bitcoin 999 bitcoin hosting cryptocurrency tech bitcoin blender
habrahabr bitcoin бонус bitcoin nicehash monero bitcoin hosting monero rub site bitcoin bitcoin weekly bitcoin london konvertor bitcoin multiplier bitcoin reddit bitcoin view bitcoin flappy bitcoin fasterclick bitcoin терминал bitcoin bitcoin forbes bitcoin okpay bitcoin wikileaks project ethereum byzantium ethereum bitcoin easy bitcoin аккаунт supernova ethereum mercado bitcoin search bitcoin bitcoin kran alpari bitcoin брокеры bitcoin удвоитель bitcoin pay bitcoin avatrade bitcoin bitcoin parser cryptocurrency wallets настройка bitcoin bitcoin china clicks bitcoin world bitcoin транзакции bitcoin сколько bitcoin bitcoin purchase отзыв bitcoin erc20 ethereum bitcoin bloomberg bitcoin зарегистрироваться кошелька ethereum bitcoin network отзывы ethereum bitcoin artikel amazon bitcoin вход bitcoin ethereum decred
история ethereum bitcoin хабрахабр ethereum монета tether пополнение ethereum block cryptocurrency tech bitcoin 2048 bitcoin goldman strategy bitcoin flappy bitcoin bitcoin two bitcoin forums planet bitcoin usb tether raiden ethereum hardware bitcoin location bitcoin bitcoin world bitcoin explorer ethereum contracts matteo monero 100 bitcoin
bitcoin weekend bitcoin chart
bitcoin wmz equihash bitcoin tether криптовалюта
auction bitcoin биржа bitcoin bitcoin windows россия bitcoin bitcoin сигналы 33 bitcoin bitcoin работать se*****256k1 bitcoin bitcoin capitalization maining bitcoin download bitcoin precious metals in 1980, interest rates today, and tomorrow perhaps bitcoin.monero прогноз dash cryptocurrency bitcoin биржи bitcoin invest bitcoin alliance
развод bitcoin bitcoin moneybox bitcoin machine bitcoin multisig multiplier bitcoin tether yota
tether майнинг
safe bitcoin roll bitcoin
wechat bitcoin bitcoin elena
monero logo ethereum получить testnet ethereum bitcoin earnings free ethereum bitcoin loan monero купить bitcoin сбербанк инструкция bitcoin bitcoin телефон ethereum 4pda bitcoin зарегистрироваться bitcoin maps coinmarketcap bitcoin topfan bitcoin bitcoin hyip bitcoin спекуляция stock bitcoin ethereum blockchain bitcoin 10 ninjatrader bitcoin se*****256k1 bitcoin golden bitcoin strategy bitcoin
bitcoin уязвимости
Before joining a mining pool, a miner should pay attention to uniformity in hash tasks that get assigned by the pool server irrespective of the mining power of a participant’s device. Imagine joining a pool that gives priority to high-speed devices. You may have an advantage today if you join such a pool with the latest and most speedy miner, but it may become a disadvantage tomorrow as new, more powerful devices join the pool, pushing back your now-obsolete devices unless the pool mechanism ensures equal opportunity for all.cryptocurrency calendar create bitcoin cryptocurrency wallets bitcoin сети 777 bitcoin ethereum перспективы
bitcoin info bitcoin значок ethereum news
стоимость ethereum bitcoin key mine bitcoin bitcoin spinner bitcoin monkey ethereum котировки programming bitcoin
tether usb сложность monero книга bitcoin wikileaks bitcoin casinos bitcoin портал bitcoin bitcoin testnet github ethereum торги bitcoin bitcoin бизнес neo bitcoin micro bitcoin bitcoin scam bitcoin motherboard check bitcoin mixer bitcoin bitcoin компания кран monero start bitcoin bitcoin synchronization bitcoin 99 bitcoin puzzle ethereum акции 777 bitcoin карты bitcoin instant bitcoin claymore monero doge bitcoin bitcoin double casascius bitcoin
форумы bitcoin frontier ethereum стоимость monero
ethereum адрес bitcoin информация tether верификация car bitcoin keystore ethereum торги bitcoin lurkmore bitcoin bitcoin frog ethereum ico криптовалют ethereum nanopool ethereum bitcoin лотерея bitcoin проблемы habrahabr bitcoin monero address bitcoin card удвоить bitcoin bitcoin tm monero ann
bitcoin пирамиды bitcoin пирамида bitcoin testnet ethereum валюта кости bitcoin monero обменять ultimate bitcoin second bitcoin фермы bitcoin bitcoin обменник mist ethereum bitcoin парад консультации bitcoin обсуждение bitcoin A fee is calculated in gasспекуляция bitcoin github ethereum bitcoin start pay bitcoin lootool bitcoin stealer bitcoin 99 bitcoin pirates bitcoin
ico ethereum
source bitcoin master bitcoin
favicon bitcoin bitcoin server bitcoin poloniex
программа tether bitcoin упал monero core bitcoin mac bye bitcoin dark bitcoin monero новости scrypt bitcoin bitcoin книга bitcoin abc bitcoin foundation fox bitcoin maps bitcoin To make the contacts you need, you should aim to become more involved in the blockchain community. I suggest going to blockchain events, connecting with new people and building relationships within the industry. This will help you to find the right people to join your project!supernova ethereum bitcoin trader bitcoin trade laundering bitcoin rigname ethereum ico cryptocurrency обмен bitcoin invest bitcoin
консультации bitcoin bitcoin analytics пулы monero monero usd monero майнить bitcoin рейтинг вывод ethereum
pk tether
bitcoin api