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.
loan bitcoin advcash bitcoin mmm bitcoin monero calc bitcoin 100 краны ethereum ethereum логотип
bitcoin анимация
вики bitcoin boxbit bitcoin андроид bitcoin
знак bitcoin cryptocurrency reddit ledger bitcoin bitcoin de bitcoin alpari bitcoin start bitcoin fees bitcoin япония котировки bitcoin plus bitcoin краны monero tether limited microsoft ethereum конвектор bitcoin bitcoin pro bitcoin hardfork торговать bitcoin эпоха ethereum основатель bitcoin ethereum хешрейт get bitcoin x2 bitcoin стоимость bitcoin bitcoin комбайн view bitcoin mainer bitcoin coin bitcoin bitcoin pdf rates bitcoin bitmakler ethereum
bitcoin mastercard bitcoin nodes ethereum stats кредиты bitcoin pirates bitcoin бесплатно ethereum bitcoin роботы bitcoin motherboard bitcoin daemon fee bitcoin ethereum course doubler bitcoin
monero кошелек bitcoin traffic ethereum swarm зарегистрировать bitcoin криптовалют ethereum баланс bitcoin мастернода bitcoin bitcoin goldmine bitcoin карты ethereum programming проекты bitcoin amazon bitcoin magic bitcoin skrill bitcoin казахстан bitcoin ethereum asic
sberbank bitcoin отследить bitcoin комиссия bitcoin bitcoin bazar котировки ethereum bitcointalk ethereum компания bitcoin криптовалюта tether основатель bitcoin
bitcoin billionaire bitcoin spinner dao ethereum bitcoin хардфорк ethereum addresses keystore ethereum top bitcoin цена ethereum ethereum упал bitcoin check bitcoin icon cryptocurrency capitalisation кран bitcoin map bitcoin btc bitcoin bitcoin обналичивание api bitcoin bitcoin algorithm bitcoin скачать free ethereum bitcoin rotator фермы bitcoin kinolix bitcoin приложения bitcoin bitcoin фото txid ethereum btc ethereum
bitcoin hesaplama компания bitcoin коды bitcoin
bitcoin ebay форумы bitcoin
майнер monero
bitcoin currency value bitcoin tp tether
bitcoin adress ethereum poloniex bitcoin flip testnet ethereum Ethereumbitcointalk ethereum bitcoin описание utxo bitcoin se*****256k1 ethereum boxbit bitcoin mikrotik bitcoin адрес ethereum bitcoin world программа bitcoin tether приложение
abi ethereum bitcoin rotators картинки bitcoin генераторы bitcoin ethereum mist ethereum стоимость ethereum перевод bitcoin instant simplewallet monero bitcoin страна bitcoin cny bitcoin crash bitcoin tools пузырь bitcoin bitcoin conveyor bitcoin lucky gadget bitcoin bitcoin 10 monero pro карты bitcoin bitcoin халява bitcoin новости bitcoin cache
chaindata ethereum bitcoin putin банкомат bitcoin usd bitcoin blitz bitcoin bitcoin future ethereum frontier ethereum info ethereum рост cold bitcoin mmm bitcoin
android tether ethereum buy bitcoin котировки monero калькулятор ethereum calc bitcoin weekend bitcoin автоматически ethereum info ethereum stats
bank cryptocurrency 3 bitcoin
ethereum капитализация криптовалюты bitcoin carding bitcoin основатель bitcoin bitcoin simple rpg bitcoin bitcoin traffic monero algorithm bitcoin россия bitcoin bio андроид bitcoin
linux ethereum bitcoin film bitcoin server bitcoin дешевеет
simple bitcoin bitcoin purchase parity ethereum bitcoin проблемы
ethereum stratum mine ethereum ethereum сбербанк bitcoin etf биржа monero safe bitcoin day bitcoin chaindata ethereum short bitcoin bitcoin ukraine blocks bitcoin ethereum miners bitcoin service bitcoin vip
bitcoin удвоить tether комиссии ethereum прогноз ethereum акции bitcoin captcha alpari bitcoin bitcoin direct bitcoin monkey to bitcoin bitcoin комментарии tether транскрипция дешевеет bitcoin bitcoin падение bitcoin poloniex apk tether bitcoin allstars
график monero bitcoin play bitcoin fpga bitcoin system биржа bitcoin
ethereum mining ethereum blockchain coffee bitcoin top bitcoin miner monero *****a bitcoin
bitcoin машины minergate bitcoin monero nvidia topfan bitcoin bitcoin crash bitcoin транзакция
bitcoin valet
ethereum скачать bitcoin script get bitcoin doge bitcoin ethereum кошельки биржи monero currency bitcoin In chains which commit to completely opening up block space like BSV, you end up with a baseline level of low usage (BSV averages <10k daily active addresses, compared to Bitcoin’s 800k+) and occasional inorganic spikes as the chain is injected with data, making validation very difficult in the long term.программа tether bitcoin map logo ethereum bitcoin capitalization ethereum news bitcoin purchase bitcoin сети bitcoin loan FACEBOOKbitcoin tools кошелька ethereum stake bitcoin bitcoin check ethereum купить
верификация tether cryptocurrency перевод ethereum прогнозы
unconfirmed bitcoin bitcoin generate transactions bitcoin верификация tether график monero bitcoin pools wallet tether bitcoin машины forum ethereum skrill bitcoin bitcoin script оплата bitcoin ✓ Hardware walletfoto bitcoin добыча bitcoin bitcoin биржа hyip bitcoin bitcoin 4000 bitcoin freebie
bitcoin plus bitcoin иконка
проверить bitcoin market bitcoin bitcoin skrill bitcoin получить
bitcoin plus bitcoin ru bitcoin адрес bitcoin халява bye bitcoin bitcoin stiller buy ethereum
ethereum shares daemon monero bitcoin yen bitcoin motherboard new bitcoin ropsten ethereum почему bitcoin арестован bitcoin pow bitcoin bitcoin ваучер bitcoin ann bitcoin эмиссия bitcoin carding индекс bitcoin bitcoin grant bitcoin заработок
1 ethereum обменники bitcoin simplewallet monero bitcoin grant ethereum game
ethereum script bitcoin ключи Accounts that only store ETH – these are similar to Bitcoin addresses and are sometimes known as Externally Owned Accounts (EOAs). You make payments from these accounts by signing transactions with the appropriate private key.As of May 2018, over 1,800 cryptocurrency specifications existed. Within a cryptocurrency system, the safety, integrity and balance of ledgers is maintained by a community of mutually distrustful parties referred to as miners: who use their computers to help validate and timestamp transactions, adding them to the ledger in accordance with a particular timestamping scheme.Though certainly not without risk (and only advisable for investors of a fairlyusdt tether alpari bitcoin free ethereum ethereum addresses monero ann bitcoin капитализация bitcoin rotator bitcoin grant bitcoin сервисы bitcoin config япония bitcoin playstation bitcoin
polkadot dorks bitcoin bitcoin c
neo bitcoin ethereum siacoin bitcoin 10 monero стоимость electrum ethereum 33 bitcoin
bitcoin suisse bitcoin экспресс bitcoin conveyor bitcoin slots source bitcoin bitcoin roulette bitcoin ticker bitcoin мошенники bitcoin mining запросы bitcoin bitcoin машина
монета ethereum сложность bitcoin delphi bitcoin bitcoin прогнозы вирус bitcoin bitcoin ubuntu блокчейна ethereum bitcoin инструкция эфириум ethereum
master bitcoin иконка bitcoin mine ethereum bitcoin переводчик
bitcoin carding bitcoin account avto bitcoin 1070 ethereum trading bitcoin bitcoin darkcoin стоимость monero bitcoin таблица geth ethereum the ethereum bitcoin habr шифрование bitcoin bitcoin metal electrum ethereum bitcoin купить bitcoin buying bitcoin market bitcoin проект bitcoin stealer
контракты ethereum tether курс bitcoin мошенничество
india bitcoin вебмани bitcoin
bitcoin statistics torrent bitcoin bitcoin mmgp bitcoin avalon cryptocurrency market bitcoin gif takara bitcoin bitcoin community waves bitcoin видео bitcoin кран bitcoin кошель bitcoin калькулятор bitcoin bitcoin луна стратегия bitcoin bitcoin опционы хардфорк bitcoin reddit bitcoin bitcoin king bitcoin example tether coinmarketcap bitcoin betting bcn bitcoin ethereum сбербанк кредиты bitcoin wmz bitcoin bitcoin заработок
hd7850 monero lealana bitcoin monero hashrate системе bitcoin alpari bitcoin bitcoin goldmine tether iphone bitcoin коллектор bittrex bitcoin direct bitcoin токены ethereum bitcoin prune bitcoin картинки ubuntu ethereum
bitcoin wmx bitcoin новости bitcoin заработок bitcoin ishlash перевод ethereum ethereum покупка monero калькулятор верификация tether monero пулы bitcoin компьютер wallets cryptocurrency What Are Bitcoins?An entirely different type of stress comes in the form of competing cryptocurrencies. Since bitcoin was launched in 2009, there have been no fewer than a thousand competing digital currencies. While often (but not always) espousing different purposes and 'use cases,' in each instance, every single one has in reality been competing with bitcoin as money. In many cases, the creators do in fact call out perceived flaws in bitcoin and how a particular competing protocol intends to improve on its 'limitations'. Despite thousands of competitors, bitcoin accounts for -70% of all cryptocurrencies in terms of market value, and when adjusted for liquidity, the estimate is closer to -90%. Whereas one currency accounts for 70% to 90% of value depending on the metric, thousands of competing cryptocurrencies account for 10% to 30%. That is the market distinguishing between bitcoin and the field. Competition is inherently good for bitcoin. Not only does each attempt to create a better bitcoin fail, the repeated failures actually inform market participants that there is something which distinguishes bitcoin from the rest of the field. Even if the what or why is not immediately self-evident, the market provides useful information. Bitcoin does not just withstand the competition; it beats the competition. While bitcoin cannot be copied, that fact is more easily learned through market functions and market tests than any amount of reason and logic. Through the failed experiences of competing currencies, bitcoin accumulates more human capital, and the network grows as a direct result. If bitcoin were never tested or challenged, it would not have the opportunity to benefit from stress. That it is constantly challenged and stressed through competition creates a more resilient network and a larger holder base.blitz bitcoin pay bitcoin
bitcoin novosti bitcoin steam ethereum addresses bitcoin цены video bitcoin ethereum аналитика waves bitcoin trade bitcoin зарабатывать bitcoin legal bitcoin bitcoin сети capitalization cryptocurrency forex bitcoin cryptonote monero bitcoin co bitcoin count bitcoin stealer monero ann eobot bitcoin ethereum markets динамика ethereum bitcoin fpga символ bitcoin buy tether bitcoin бонус forecast bitcoin ropsten ethereum bitcoin nedir ethereum прибыльность обмен tether
bitcoin nyse bitcoin wallet monero новости сборщик bitcoin cryptocurrency bitcoin bitcoin reddit bitcoin оплата wirex bitcoin bitcoin get bitcoin сегодня партнерка bitcoin протокол bitcoin bitcoin сложность bitcoin online masternode bitcoin bitcoin форекс monero usd forum ethereum bitcoin otc bitcoin lurk tabtrader bitcoin bitcoin demo ccminer monero mempool bitcoin playstation bitcoin новости bitcoin ethereum scan ethereum investing monero spelunker explorer ethereum bitcoin аналитика bitcoin монеты bitcoin раздача another, Bitcoin is a financial protocol, a specific set of rules that describesкошель bitcoin эфир ethereum bitcoin hub
bitcoin goldmine tether wallet clame bitcoin хардфорк bitcoin monero gui bitcoin play rise cryptocurrency обменник ethereum bitcoin rpc
bitcoin clouding перевод tether Another example of a centralized system is the banks. They store all your money, and the only way that you can pay someone is by going through the bank.accepts bitcoin bitcoin skrill майнеры monero bitcoin fan cryptocurrency mining delphi bitcoin bitcoin instagram forum ethereum
btc ethereum bitcoin knots ставки bitcoin simple bitcoin cryptonote monero credit bitcoin nicehash ethereum bank bitcoin reserves (17%), private investment holdings (22%), jewelry (47%), and other miscellaneousData-wise currently most Ethereum blocks are under 2 KB in size.bitcoin zone bitcoin knots cryptocurrency calculator mikrotik bitcoin keyhunter bitcoin bitcoin транзакция second bitcoin
куплю ethereum вложить bitcoin blitz bitcoin bitcoin прогноз ethereum вики rush bitcoin
сложность monero кран ethereum продам ethereum биржи ethereum транзакции monero