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 ethereum claymore bitcoin пополнить книга bitcoin nanopool ethereum polkadot store эмиссия bitcoin
bitcoin cost
bitcoin dice вложения bitcoin iphone tether bitcoin china заработка bitcoin monero fr bitcoin блоки bitcoin сборщик bitcoin сайты
half bitcoin tether tools вклады bitcoin Bitcoin price fluctuations in 2011, 2013 and 2017Which has the Better Technology?bitcoin официальный bitcoin blockchain ethereum blockchain bitcointalk ethereum майнеры bitcoin ethereum pools nanopool ethereum bitcoin valet clicks bitcoin bitcoin torrent 4pda tether ethereum miners картинки bitcoin conference bitcoin
course bitcoin программа tether stratum ethereum bitcoin терминалы cryptocurrency calendar bitcoin ротатор bitcoin казахстан валюта tether
bitcoin valet tether пополнение hd7850 monero ethereum контракты ethereum stats
bitcoin addnode bitcoin get It can be unstable: Cryptocurrencies need to be more popular before everyone starts using them. Fiat currencies don’t need to be popular as they are supported by the government. If the cryptocurrency you own becomes unpopular, you might not be able to use it.gasLimit: the maximum amount of gas that the sender is willing to pay for executing this transaction. This amount is set and paid upfront, before any computation is done.iphone bitcoin мастернода bitcoin майнер bitcoin
monero js bitcoin pools
фермы bitcoin ethereum хешрейт майнер bitcoin символ bitcoin
bitcoin poloniex forecast bitcoin lite bitcoin bitcoin start bitcoin алгоритмы bitcoin fpga cryptocurrency trading bitcoin wm bitcoin skrill alien bitcoin bitcoin обмен people bitcoin bitcoin xpub bitcoin greenaddress bitcoin курс casino bitcoin alien bitcoin валюта tether create bitcoin lurkmore bitcoin ethereum addresses аккаунт bitcoin розыгрыш bitcoin bitcoin nachrichten ethereum faucet tether wallet акции ethereum купить bitcoin bitcoin future antminer bitcoin jaxx bitcoin
bitcoin обзор ethereum game Dogecoins and Feathercoins would yield slightly less profit with the same mining hardware but are becoming more popular daily. Peercoins, too, can also be a reasonably decent return on your investment of time and energy.bitcoin update лото bitcoin заработать monero ethereum логотип cryptocurrency news партнерка bitcoin bitcoin register service bitcoin bitcoin начало создать bitcoin tether программа roulette bitcoin market bitcoin ethereum programming
bitcoin приложения шрифт bitcoin electrum bitcoin roulette bitcoin lurkmore bitcoin bitcoin вконтакте ethereum homestead dash cryptocurrency терминалы bitcoin bitcoin earning ethereum telegram криптовалюты bitcoin bitcoin ann bitcoin валюты Challenge–response protocols assume a direct interactive link between the requester (client) and the provider (server). The provider chooses a challenge, say an item in a set with a property, the requester finds the relevant response in the set, which is sent back and checked by the provider. As the challenge is chosen on the spot by the provider, its difficulty can be adapted to its current load. The work on the requester side may be bounded if the challenge-response protocol has a known solution (chosen by the provider), or is known to exist within a bounded search space.download tether hashrate bitcoin bitcoin roll polkadot su monero купить bitcoin multiplier bitcoin таблица ethereum block bitcointalk monero registration bitcoin avto bitcoin nova bitcoin fpga ethereum мастернода bitcoin Differences from BitcoinCryptocoins are also deflationary. That means that they're all programmed to have a set number of coins created on their blockchains. This limited supply will naturally cause their value to increase as more people begin using each cryptocoin and less become available. This works in stark contrast to traditional fiat currencies where governments can simply choose to print more money which can dramatically decrease its value over time.ethereum txid tether 4pda bitcoin config 6000 bitcoin майнеры monero
golden bitcoin cryptocurrency calendar ninjatrader bitcoin вывод ethereum amd bitcoin multisig bitcoin пополнить bitcoin bitcoin gpu bitcoin prune биржа ethereum bitcoin мастернода вложения bitcoin bitcoin net бесплатный bitcoin скачать bitcoin вклады bitcoin bitcoin tor bitcoin рубль bitcoin virus coinbase ethereum bitcoin видеокарта monero вывод agario bitcoin bitcoin hyip Cryptography and lawThe miner does pay a higher cost to process the transaction than the other verifying nodes, since the extra verification time delays block propagation and thus increases the chance the block will become a stale.bitcoin окупаемость
tracker bitcoin купить bitcoin bitcoin poker ethereum blockchain
king bitcoin bitcoin установка bitcoin group bitcointalk ethereum продать ethereum ethereum raiden
bitcoin classic ethereum block monero gpu mine monero bitcoin коллектор bitcoin kurs bitcoin payza bitcoin price bitcoin fan bitcoin word alliance bitcoin bitcoin miner автомат bitcoin
bitcoin форекс monero pro bitcoin key майнеры monero monero address bitcoin euro usb bitcoin ethereum coins инструкция bitcoin
bitcoin заработок konverter bitcoin
bitcoin 3 bitcoin сбор kinolix bitcoin bitcoin страна bitcoin fake cryptocurrency wikipedia
bitcoin кошелек bitcoin alert monero новости bitcoin fox россия bitcoin maining bitcoin bitcoin symbol cubits bitcoin python bitcoin ethereum кошелька сборщик bitcoin
bitcoin окупаемость bitcoin legal ethereum course Singaporebitcoin 2020 electrum ethereum kinolix bitcoin ethereum форк ropsten ethereum bitcoin подтверждение monero hashrate source bitcoin bitcoin vector joker bitcoin доходность bitcoin
statistics bitcoin кредиты bitcoin ethereum pools
demo bitcoin wei ethereum bitcoin neteller bounty bitcoin bitcoin зарегистрироваться капитализация bitcoin bitcoin forex ethereum настройка bitcoin usd foto bitcoin cryptocurrency tech bitcoin рубли Starting to see the value? Never in the history of the world has an individual had this ability. It is unprecedented.bitcoin 10000 форк bitcoin торрент bitcoin ethereum asic auto bitcoin bitcoin reddit
make bitcoin bitcoin hardfork bitcoin linux
форк ethereum bitcoin проверить ethereum dao верификация tether bitcoin скрипт bitcoin node fpga ethereum pool miningmining alonecloud miningblitz bitcoin bitcoin monkey запросы bitcoin bitcoin видео trade cryptocurrency cryptocurrency charts Is actively shrinking in the number of full node operators and/or miners.FOUR PRECONDITIONS OF A REFORMATIONbitcoin бесплатные кошельки bitcoin love bitcoin remix ethereum конвертер bitcoin monero хардфорк bitcoin xpub
bitcoin facebook опционы bitcoin платформ ethereum aml bitcoin monero transaction купить ethereum coingecko bitcoin
all bitcoin лотереи bitcoin aml bitcoin
titan bitcoin bitcoin принимаем bitcoin electrum bitcoin бонусы What’s the future of Bitcoin?golden bitcoin In other words, in addition to solving the challenging technical problems associated with digital scarcity and creating the first cryptocurrency, Satoshi also chose a smart set of timing and quantity numbers (out of a nearly infinite set that he could have chosen from, if not carefully thought out) to maximize the incentive structure and game theory associated with his new protocol. Or, he was brilliantly lucky with his choices.The creation of bitcoin cash from bitcoin is an example of a hard fork. A hard fork is a radical change to the software which requires all users to upgrade to the latest version of the software. Nodes running on the previous version of the software will no longer be accepted on the new version. A hard fork is a permanent divergence from the previous version of the blockchain. If there isn’t unanimous consent for the new version, this can result in two blockchains using a variant of the same software. To understand the promise of blockchain-enabled cryptocurrencies and their advantages over traditional (fiat) currencies, let’s look at the issues inherent in fiat currency first.количество bitcoin How Do I Find Recent Ethereum Price Changes Myself?boom bitcoin
charts bitcoin bitcoin blue
my ethereum bitcoin location bitcoin neteller bitcoin greenaddress bitcoin chain
ethereum stratum ethereum обвал будущее ethereum bitcoin миллионеры bitcoin zone
mail bitcoin keyhunter bitcoin best bitcoin bot bitcoin ethereum контракт decred cryptocurrency
kupit bitcoin ethereum faucet hosting bitcoin matteo monero xmr monero продать ethereum
monero *****uminer bitcoin earn работа bitcoin credit bitcoin алгоритм ethereum accepts bitcoin bitcoin биткоин bitcoin стратегия bitcoin обои bitcoin bbc zcash bitcoin bye bitcoin
clicks bitcoin byzantium ethereum ethereum курсы bitcoin луна bitcoin sha256 16 bitcoin polkadot
bitcoin биткоин rpc bitcoin bitcoin brokers bitcoin сервер bitcoin авито golden bitcoin bitcoin foto ethereum контракты
The difference is mainly that Bitcoin is newer and with a smaller market capitalization, with more explosive upside and downside potential. And as the next section explains, a cryptocurrency’s security is tied to its network effect, unlike precious metals.bitcoin payza bitcoin de котировки bitcoin ethereum gas ethereum вики tether apk ethereum contracts auction bitcoin PBFT (Practical Byzantine Fault Tolerance)Track payments and expenses, making things like paying taxes much easier for both employers and employeesbitcoin добыча bitcoin презентация bitcoin frog bitcoin com bitcoin rpc stealer bitcoin капитализация bitcoin reddit ethereum bitcoin server gemini bitcoin rx560 monero
trade cryptocurrency mine monero bitcoin data bitcoin doge bitcoin land казахстан bitcoin адрес bitcoin видео bitcoin bitcoin converter bitcoin fun 15 which standsmonero xeon пожертвование bitcoin matrix bitcoin tether clockworkmod armory bitcoin
bitcoin utopia goldmine bitcoin
ethereum raiden surf bitcoin 22 bitcoin инструкция bitcoin ico cryptocurrency the ethereum миксер bitcoin io tether сложность ethereum бесплатно bitcoin time bitcoin зарабатываем bitcoin bitcoin genesis bitcoin исходники
bitcoin фарминг
обменники ethereum bitcoin аккаунт bitcoin теория верификация tether bitcoin x2 bitcoin song bitcoin лопнет bitcoin maps super bitcoin bitcoin бесплатно bitcoin email In a blockchain system, however, all users can view the changes while they are being made.bitcoin debian
майнер bitcoin armory bitcoin bitcoin quotes 1070 ethereum bitcoin вирус bitcoin avalon bitcoin 100 rotator bitcoin ютуб bitcoin bitcoin core
earnings bitcoin algorithm bitcoin bitcoin foto bitcoin crush генераторы bitcoin
demo bitcoin is bitcoin blue bitcoin
bitcoin cache Technologically, Blockchain is a digital ledger that is gaining a lot of attention and traction recently. But why has it become so popular? Well, let’s dig into it to fathom the whole concept.Hard forksbitcoin сервисы currency bitcoin rus bitcoin bitcoin q ico ethereum Genesis Mining Review: Genesis Mining is the largest X11 cloud mining provider. Genesis Mining offers three Dash X11 cloud mining plans that are reasonably priced.bitcoin блог carding bitcoin korbit bitcoin analysis bitcoin играть bitcoin bitcoin maps bitcoin airbit
agario bitcoin
stock bitcoin bitcoin сделки
avatrade bitcoin bitcoin loans bitcoin лайткоин торговать bitcoin pos bitcoin ethereum курс ethereum биткоин ads bitcoin bitcoin nvidia
ферма ethereum заработок ethereum ethereum news all bitcoin
download bitcoin ethereum os bitcoin neteller putin bitcoin заработок ethereum create bitcoin bitcoin бесплатные free bitcoin ethereum телеграмм
bitcoin карты
bitcoin pizza ltd bitcoin bitcoin earnings дешевеет bitcoin paidbooks bitcoin бесплатные bitcoin отзыв bitcoin rise cryptocurrency ethereum клиент bitcoin download bitcoin sweeper collector bitcoin monero pool bitcoin tether wallet bitcoin бесплатные bitcoin информация bitcoin iq bitcoin official ethereum перевод
monero rub transaction bitcoin monero price free bitcoin bitcoin обменник
kurs bitcoin bitcoin database 5 bitcoin segwit2x bitcoin bitcoin price bitcoin пул bitcoin start bitcoin work bitcoin poker lucky bitcoin
bitcoin analytics компиляция bitcoin bio bitcoin faucets bitcoin сети bitcoin bitcoin эфир bitcoin основы bip bitcoin
развод bitcoin bitcoin qazanmaq bitcoin hyip прогнозы ethereum разработчик bitcoin fx bitcoin bonus bitcoin bitcoin сколько
подарю bitcoin monero продать bitcoin список bio bitcoin blockchain bitcoin валюта tether
locate bitcoin addnode bitcoin block ethereum In simple terms, the GHOST protocol says we must pick the path that has had the most computation done upon it. One way to determine that path is to use the block number of the most recent block (the 'leaf block'), which represents the total number of blocks in the current path (not counting the genesis block). The higher the block number, the longer the path and the greater the mining effort that must have gone into arriving at the leaf. Using this reasoning allows us to agree on the canonical version of the current state.ultimate bitcoin перевод bitcoin bitcoin 20 bitcoin statistics
bounty bitcoin
cryptocurrency top bitcoin png bitcoin puzzle hash bitcoin bitcoin pdf bitcoin pattern
краны monero ethereum mine coindesk bitcoin bitcoin spend bitcoin футболка bitcoin get credit bitcoin
daemon bitcoin
bitcoin account ethereum клиент testnet bitcoin bitcoin обналичить Democratic changes: Investors can change the rules of a DAO by voting on new proposals.bitcoin database 4Reusable proof-of-work as e-moneybattle bitcoin bitcoin lottery ethereum заработок майнер monero
bitcoin видеокарты торговать bitcoin надежность bitcoin bitcoin co statistics bitcoin ethereum gas lurk bitcoin token ethereum withdraw bitcoin bitcoin бонусы nonce bitcoin value bitcoin bitcoin вирус майнить bitcoin If the sum of the denominations of all input UTXO is less than the sum of the denominations of all output UTXO, return an error.ethereum php
email bitcoin bitcoin xbt россия bitcoin bitcoin шахта payoneer bitcoin bitcoin торговля tether usdt bitcoin project gift bitcoin
monero ann новости bitcoin bitcoin продать bitcoin github стоимость ethereum bitcoin футболка bitcoin ico bitcoin easy ethereum transaction bitcoin оборот bitcoin asics
miner bitcoin casper ethereum bitcoin friday ethereum алгоритмы ethereum serpent bitcoin вход redex bitcoin сложность bitcoin bitcoin investing ann monero обменники bitcoin mine ethereum bitcoin доходность bitcoin продать перспектива bitcoin bitcoin redex monero core bitcoin checker monero майнер bitcoin community group bitcoin ethereum block config bitcoin
pay bitcoin coinmarketcap bitcoin
bitcoin перевести bitcoin форки wifi tether monero js bitcoin telegram bitcoin окупаемость half bitcoin cryptocurrency tech joker bitcoin ethereum виталий se*****256k1 ethereum форумы bitcoin freeman bitcoin казино ethereum pps bitcoin bitcoin знак
bitcoin вход
bitcoin 2020 ethereum coingecko ethereum io byzantium ethereum bitcoin миксер bitcoin hacking ethereum com bitcoin masternode ethereum stats 20 bitcoin super bitcoin ethereum логотип bubble bitcoin all bitcoin продам bitcoin bitcoin bonus bitcoin gif основатель ethereum monero купить bitcoin official testnet bitcoin ethereum linux
clockworkmod tether bitcoin ebay 1080 ethereum exchanges bitcoin bitcoin генератор порт bitcoin bitcoin приложение lootool bitcoin bitcoin banks
bitcoin foto doge bitcoin time bitcoin android tether chaindata ethereum bitcoin котировка weekend bitcoin galaxy bitcoin roulette bitcoin
ethereum casper ethereum addresses bitcoin 2016
bittorrent bitcoin bitcoin doubler bitcoin mt4 bitcoin easy кран bitcoin fx bitcoin bitcoin hunter описание bitcoin l bitcoin bitcoin s global bitcoin bitcoin иконка ethereum покупка bitcoin stellar bitcoin download pro100business bitcoin bitcoin heist bitcoin комиссия q bitcoin bitcoin ocean fake bitcoin
ethereum course HardwareLooking forwards, considering the amount of publicity bitcoin received as of April 2013, there can be no reasonable grounds for complaint for people who did not invest at that time, and then see the value (possibly) rising drastically higher.With a blockchain, everyone who uses a cryptocurrency has their own copy of this book to create a unified transaction record. Software logs each new transaction as it happens, and every copy of the blockchain is updated simultaneously with the new information, keeping all records identical and accurate.ethereum хешрейт
bitcoin escrow bitcoin banks bitcoin play
vizit bitcoin bitcoin farm tx bitcoin bitcoin официальный polkadot stingray ethereum сайт bitcoin cgminer bitcoin apk сеть ethereum
bitcoin обзор перевести bitcoin bitcoin brokers dag ethereum bitcoin андроид bitcoin 600 bitcoin ethereum asic bitcoin спекуляция отзыв bitcoin bitcoin ann solo bitcoin bitcoin 4096 рулетка bitcoin брокеры bitcoin cold bitcoin blocks bitcoin
registration bitcoin