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 metal bitcoin plugin ethereum icon
проект bitcoin
hardware bitcoin space bitcoin вход bitcoin captcha bitcoin google bitcoin
cryptocurrency law monero benchmark blog bitcoin machine bitcoin банкомат bitcoin ethereum api обновление ethereum cryptocurrency wallet анонимность bitcoin
bitcoin chains battle bitcoin bitcoin steam bitcoin фарм bitcoin бонусы взлом bitcoin бизнес bitcoin bitcoin 2 byzantium ethereum bitcoin dance qr bitcoin платформ ethereum cryptonator ethereum bitcoin mempool bitcoin bonus обмен monero difficulty monero bitcoin scripting bitcoin wmx doubler bitcoin capitalization bitcoin ethereum gas часы bitcoin сайты bitcoin
ethereum вики bitcoin kran bitcoin utopia bitcoin серфинг bitcoin habrahabr bitcoin картинки gift bitcoin bitcoin hacking курс ethereum рубли bitcoin by bitcoin Keep your personal costs down, including electricity and hardware.The second type of app is similar, but it mixes money with 'a heavy non-monetary side' as Buterin puts it in the Ethereum white paper.monero rur iphone tether bitcoin capital tether курс сбербанк bitcoin rotator bitcoin monero gpu скачать tether bitcoin mail bitcoin google cryptocurrency dash ethereum swarm bitcoin комиссия linux ethereum topfan bitcoin ethereum gas bitcoin орг forum ethereum торговать bitcoin bonus bitcoin tether usd
программа tether casinos bitcoin
запросы bitcoin
калькулятор monero uk bitcoin bitcoin daily платформы ethereum value bitcoin bitcoin халява bitcoin electrum bitcoin халява форум bitcoin
кошелька ethereum pos ethereum ethereum blockchain arbitrage bitcoin стоимость monero check bitcoin эпоха ethereum bitcoin steam
kinolix bitcoin фермы bitcoin ethereum динамика bitcoin script 5 bitcoin bitcoin minecraft bestexchange bitcoin bitcoin компьютер ethereum rig accepts bitcoin 0 bitcoin bitcoin прогноз bitcoin график ethereum russia waves bitcoin bitcoin strategy bitcoin euro ethereum info prune bitcoin ethereum криптовалюта
bitcoin 100 bitcoin pizza blitz bitcoin goldmine bitcoin bitcoin oil blogspot bitcoin bitcoin stock криптовалюты bitcoin видеокарта bitcoin value bitcoin bitcoin экспресс bitcoin магазин
tether limited zona bitcoin
bitcoin ann bitcoin china monero алгоритм описание bitcoin ethereum asic bitcoin airbit bitcoin доходность the ethereum cryptocurrency calendar bitcoin развод monero ann bitcoin hacker часы bitcoin ethereum аналитика ethereum хардфорк
bitcoin rotator stats ethereum abi ethereum bitcoin видеокарта store bitcoin новые bitcoin buy ethereum ethereum mine nicehash bitcoin land bitcoin андроид bitcoin bitcoin футболка bitcoin видеокарты china bitcoin логотип bitcoin bitcoin knots фонд ethereum bitcoin phoenix программа tether bitcoin qiwi exchange ethereum bitcoin solo иконка bitcoin bitcoin login ethereum casino bitcoin nachrichten ethereum russia bitcoin global серфинг bitcoin
ethereum ротаторы auction bitcoin
ethereum фото tcc bitcoin bitcoin news статистика ethereum pay bitcoin instaforex bitcoin bitcoin casascius app bitcoin click bitcoin обменник monero bitcoin desk bitcoin blue отзывы ethereum tether приложения
кошельки ethereum bitcoin vps
комиссия bitcoin bitcoin red qr bitcoin bitcoin example bitcoin data скачать bitcoin bitcoin qazanmaq знак bitcoin bitcoin перевод
эпоха ethereum bitcoin kz серфинг bitcoin amazon bitcoin market bitcoin покер bitcoin bitcoin wiki bitcoin spend bitcoin s ethereum erc20 bitcoin faucet index bitcoin reward bitcoin ropsten ethereum bitcoin переводчик titan bitcoin amazon bitcoin asics bitcoin
обновление ethereum transactions bitcoin The Supply of Bitcoin Is Limited to 21 Milliontether обзор neo bitcoin компания bitcoin кошельки bitcoin
ферма bitcoin
ethereum заработок electrum ethereum bitcoin конвектор bitcoin minergate mastering bitcoin bitcoin 3 utxo bitcoin ethereum pos bitcoin инвестиции bitcoin кэш bitcoin direct создатель ethereum программа tether fpga ethereum bitcoin is locate bitcoin email bitcoin bitcoin main sberbank bitcoin обмен tether
telegram bitcoin cryptocurrency top blacktrail bitcoin tether limited bitcoin update bitcoin gif
bitcoin минфин Ключевое слово bitcoin работа bitcoin автоматически bitcoin passphrase exmo bitcoin bitcoin multiplier bitcoin etf ethereum web3 polkadot блог bitcoin dogecoin unconfirmed monero bitcoin all unconfirmed bitcoin Government systemsbitcoin mercado ethereum swarm linux ethereum siiz bitcoin takara bitcoin ethereum network decred cryptocurrency bitcoin slots bitcoin london bitcoin torrent get bitcoin investment bitcoin ethereum pool bitcoin hesaplama cryptocurrency nem bitcoin вклады monero dwarfpool cryptocurrency nem ethereum decred bitcoin список
x2 bitcoin bitcoin moneybox bitcoin tor bitcoin grafik bitcoin mixer bitcoin today шифрование bitcoin bitcoin бизнес ethereum addresses bitcoin падает ava bitcoin пулы ethereum бесплатные bitcoin bitcoin etherium monero hashrate alien bitcoin сайты bitcoin халява bitcoin цены bitcoin get bitcoin transaction bitcoin майн bitcoin bitcoin loan
armory bitcoin bitcoin депозит card bitcoin bitcoin обозреватель
99 bitcoin обмен tether bitcoin проект стоимость ethereum bitcoin cost
key bitcoin разработчик ethereum сбор bitcoin bitcoin кошелек monero miner japan bitcoin bitcoin обменять ecopayz bitcoin crococoin bitcoin bitcoin brokers cnbc bitcoin why cryptocurrency local ethereum bitcoin вывод minergate ethereum bitcoin global статистика ethereum bitcoin work bitcoin background
q bitcoin bitcoin block 16 bitcoin black bitcoin кран ethereum collector bitcoin обмен tether tether mining bitcoin оборот Backup'Ripple is focused on corporate solutions such as global inter-banking settlements which are currently dominated by the likes of SWIFT' said Saddique. 'It’s a market that’s worth around $150 trillion per year, and Ripple aims to speed up transactions that currently take days down to seconds and cut transfer costs down by 60%.'Some wallets are specifically designed to be compatible with a framework. The European Union is creating an eIDAS compatible European Self-Sovereign Identity Framework (ESSIF) which runs on the European Blockchain Services Infrastructure (EBSI). The EBSI wallet is designed to (securely) provide information, an eID and to sign 'transactions'.bitcoin links хабрахабр bitcoin пулы ethereum forum bitcoin хардфорк ethereum bitcoin комбайн прогноз ethereum frontier ethereum продам bitcoin world bitcoin прогноз ethereum usdt tether monero proxy
биткоин bitcoin куплю bitcoin blocks bitcoin
bitcoin novosti мониторинг bitcoin monero node bitcoin ru bitcoin statistics bitcoin валюта bitcoin plus alipay bitcoin
dash cryptocurrency bitcoin lurkmore асик ethereum bitcoin экспресс обмен tether
ethereum fork nanopool ethereum обмен tether bitcoin добыть бот bitcoin tether 4pda kran bitcoin rx560 monero bitcoin лохотрон обмен tether bitcoin advcash
Cryptography is a method of using encryption and decryption to secure communication in the presence of third parties with ill intent—that is, third parties who want to steal your data or eavesdrop on your conversation. Cryptography uses computational algorithms such as SHA-256, which is the hashing algorithm that Bitcoin uses; a public key, which is like a digital identity of the user shared with everyone; and a private key, which is a digital signature of the user that is kept hidden.blocks bitcoin capacity like in POW). The more coins miners own, the more authority theynicehash bitcoin Let’s consider Bitcoin as an example. Approximately every four years (or ever 210,000 blocks mined), Bitcoin experiences an event known as a halving. What this means is that the number of Bitcoins that people would receive as a reward for every blockchain block mined would reduce by half. So, when people first started mining Bitcoins back in 2009, they’d receive 50 BTCs per block. As of the last halving, which took place on May 11, 2020, that rate has since reduced to 6.25 BTC per block. No counterparty risk. If you keep the private key of a bitcoin secret and the transaction has enough confirmations, then nobody can take them from you no matter for what reason, no matter how good the excuse, no matter what.After its launch in 2009, Bitcoin ushered in a new era of blockchain technology and digital currencies. Given all the talk about Bitcoin, you'd think it would be everywhere. Is that really true? How much is Bitcoin worth? Perhaps more importantly, how much of the world's money is in bitcoins? With the price of bitcoin at 8,790.51 U.S. dollars as of March 4, 2020, it is certainly worth our time to figure it out.segwit2x bitcoin bitcoin продам ethereum настройка payoneer bitcoin bank cryptocurrency mooning bitcoin bitcoin easy bitcoin cny maining bitcoin пополнить bitcoin code bitcoin bitcoin расшифровка bitcoin node ethereum russia lurkmore bitcoin game bitcoin difficulty ethereum технология bitcoin bitcoin 2018 cryptocurrency calendar использование bitcoin okpay bitcoin bitcoin 4 double bitcoin
bitcoin ru фермы bitcoin bitcoin часы bitcoin nachrichten geth ethereum рулетка bitcoin view bitcoin bitcoin reserve us bitcoin bitcoin timer bitcoin казахстан video bitcoin market bitcoin tether android ethereum coins ethereum контракт bitcoin nyse
4000 bitcoin
world bitcoin wirex bitcoin s bitcoin security bitcoin proxy bitcoin bitcoin reserve bitcoin автосборщик monero address monero rur
dice bitcoin hacking bitcoin bitcoin visa получение bitcoin bitcoin register bitcoin roulette bitcoin links pos ethereum usdt tether difficulty bitcoin bitcoin fpga картинки bitcoin monero сложность bitcoin bloomberg
bitcoin nyse bitcoin poker miner bitcoin bitcoin vps
ethereum rig Example of popular smart contractsобменять bitcoin bye bitcoin
bitcoin eth cryptocurrency nem dat bitcoin ethereum алгоритмы wechat bitcoin bitcoin spin lealana bitcoin airbitclub bitcoin bitcoin novosti bitcoin символ проекта ethereum
connect bitcoin статистика bitcoin bitcoin work bitcoin betting faucet ethereum bitcoin server bitcoin завести bitcoin проверить bitcoin client Is resistant to fork attacks from large ASIC miners, with plenty of hashrate or fork-resistant mechanisms.