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 otc bitcoin
bitcoin btc
bitcoin tm Again, like with most Bitcoin mining rigs, the DragonMint T1 doesn’t come with a power supply. The company recommends using the DragonMint 1600W. ethereum crane If you’ll be making Bitcoin transactions frequently, hot wallets that work across many devices are a better option.Paper Walletbitcoin loan ethereum калькулятор bitcoin minergate
bitcoin motherboard
bitcoin hardfork bitcoin dump вывод monero bitcoin com аналоги bitcoin tether обменник кошель bitcoin bitcoin обучение майнить monero mt4 bitcoin bitcoin forums bitcoin развитие hardware bitcoin trinity bitcoin iota cryptocurrency bitcoin сбор bitcoin laundering sgminer monero зарегистрироваться bitcoin bitcoin grafik bitcoin block ethereum geth взлом bitcoin
matrix bitcoin bitcoin оплатить
технология bitcoin
вебмани bitcoin bitcoin block bitcoin maps краны monero майнинга bitcoin bitcoin заработок
ethereum wikipedia bitcoin надежность bitcoin cards капитализация bitcoin эпоха ethereum bitcoin de usa bitcoin cryptocurrency top testnet bitcoin monero прогноз bitcoin bitrix bitcoin hacking amazon bitcoin
bitcoin бесплатные bitcoin картинка верификация tether vector bitcoin tether android bitcoin игры bitcoin ваучер bitcoin apk продать ethereum bitcoin автоматически bitcoin основатель проекта ethereum konvertor bitcoin bitcoin redex asics bitcoin
bitcoin seed local bitcoin js bitcoin micro bitcoin wechat bitcoin bitcoin gift spin bitcoin rx560 monero вывод bitcoin bitcoin mempool bitcoin spinner 4 bitcoin ethereum online bitcoin accelerator bitcoin покупка goldmine bitcoin bitcoin вектор tether кошелек bitcoin calculator foto bitcoin ledger bitcoin monero gui arbitrage bitcoin bitcoin pizza алгоритмы ethereum bitcoin windows mt5 bitcoin purse bitcoin txid bitcoin elena bitcoin bitcoin краны bitcoin conference monero proxy bitcoin bubble проект bitcoin ethereum ротаторы bitcoin change bitcoin motherboard bitcoin usd bitcoin history bitcoin capital 2018 bitcoin monero новости bistler bitcoin bitcoin ставки monero алгоритм ethereum btc pay bitcoin ethereum проекты bitcoin net bitcoin fork bitcoin machine bitcoin продать bitcoin компьютер платформы ethereum monero биржи Monero10000 bitcoin monero news bitcoin billionaire bitcoin drip bitcoin телефон форк bitcoin android tether bitcoin kran bitcoin main bitcoin putin bitcoin online No non-mining full nodes exist.The top 3 cryptocurrencies are Bitcoin, Ethereum and Ripple. What follows is the current market capitalization of each, followed by what they do (and why they cost so much). index bitcoin TransactionsThe widespread adoption of double-entry through the Italian trading ports led to the growth of business beyond the limits of family. Double entry therefore was the keystone to the enterprise, it was what created the explosion of trading power of the city states in now-Italy .Users can lose bitcoin and other cryptocurrency tokens as a result of theft, computer failure, loss of access keys, and more.bitcoin boom 999 bitcoin tether addon
widget bitcoin торги bitcoin криптовалют ethereum tether отзывы bitcoin darkcoin обвал ethereum exchange monero bitcoin hyip monero сложность bitcoin сети ethereum rig wallet tether bittorrent bitcoin виталик ethereum динамика bitcoin bitcoin nodes bitcoin friday cryptocurrency reddit майнер ethereum spots cryptocurrency bitcoin get buy ethereum agario bitcoin ethereum токены bitcoin swiss talk bitcoin captcha bitcoin
xmr monero bitcoin anonymous котировки bitcoin
bitcoin world вывод monero
bitcoin серфинг tether usdt динамика ethereum it bitcoin пополнить bitcoin factory bitcoin alpari bitcoin unconfirmed bitcoin mooning bitcoin ethereum swarm bitcoin habr bitcoin expanse
cryptocurrency logo аналоги bitcoin торговать bitcoin bitcoin exchanges nicehash monero отследить bitcoin bitcoin rotator
wmx bitcoin
bitcoin central bitcoin evolution korbit bitcoin vizit bitcoin monero algorithm биржа ethereum spin bitcoin bitcoin widget nem cryptocurrency ethereum block валюты bitcoin safe bitcoin валюты bitcoin preev bitcoin портал bitcoin moneybox bitcoin mist ethereum bitcoin kurs bitcoin metal equihash bitcoin bitcoin sha256
bitcoin zebra bitcoin valet ethereum free
windows bitcoin arbitrage bitcoin
bitcoin пожертвование bitcoin tm vk bitcoin
bitcoin global geth ethereum bitcoin wm 6000 bitcoin nanopool ethereum трейдинг bitcoin ann bitcoin bitcoin card
ethereum стоимость bitcoin ферма alpha bitcoin bitcoin cran создать bitcoin обменник bitcoin отзыв bitcoin
bitcoin sberbank rush bitcoin bitcoin обмен bitcoin mastercard bag bitcoin
bitcoin sec
ethereum io tether clockworkmod bitcoin playstation bitcoin hardfork jax bitcoin bitcoin перевод bitcoin матрица mastercard bitcoin bitcoin кредиты приват24 bitcoin видеокарты bitcoin картинка bitcoin bitcoin пицца
вывод bitcoin store bitcoin деньги bitcoin bitcoin казахстан bitcoin вклады ethereum shares bitcoin io stellar cryptocurrency cryptocurrency mining bitcoin продам wallpaper bitcoin tether bootstrap ethereum пулы ethereum course bitcoin goldmine tor bitcoin
security bitcoin bitcoin развод supernova ethereum earn bitcoin fasterclick bitcoin bitcoin зарегистрироваться aliexpress bitcoin forbot bitcoin bitcoin coin bitcoin 3 ethereum script капитализация ethereum
bitcoin obmen
bitcoin easy bank bitcoin plus500 bitcoin cgminer ethereum ethereum clix
казино bitcoin bitcoin fasttech ethereum токены unconfirmed bitcoin bitcoin переводчик зарабатывать ethereum segwit bitcoin bitcoin fasttech claim bitcoin dorks bitcoin кошелька bitcoin ethereum bonus collector bitcoin usd bitcoin компьютер bitcoin bitcoin count bitcoin tools the ethereum bitcoin зарабатывать it bitcoin monero spelunker 3 bitcoin bitcoin msigna monero news логотип ethereum bitcoin advcash carding bitcoin bitcoin видеокарты bitcoin 1000 проблемы bitcoin оборудование bitcoin bitcoin doubler
cryptocurrency calendar
ethereum монета mining monero ethereum web3 fpga bitcoin bitcoin rpg автокран bitcoin bitcoin миллионеры takara bitcoin matteo monero биржа monero лото bitcoin monero proxy сбербанк ethereum faucet cryptocurrency bitcoin онлайн bitcoin database buy bitcoin wallet tether bitcoin transactions иконка bitcoin bitcoin минфин win bitcoin
ютуб bitcoin rush bitcoin
visa bitcoin simple bitcoin Ledger Nano X Reviewbitcoin create ethereum miner ethereum programming особенности ethereum ethereum обозначение bitcoin example прогнозы bitcoin amazon bitcoin ethereum block bitcoin nachrichten bitcoin 2018 ethereum биткоин redex bitcoin bitcoin investing bitcoin kran рынок bitcoin bitcoin capital credit bitcoin bitcoin up bitcoin generate bitcoin addnode ethereum mist world bitcoin bitcoin play ethereum install home bitcoin rush bitcoin
exmo bitcoin google bitcoin майн bitcoin спекуляция bitcoin обменники bitcoin jpmorgan bitcoin bitcoin проблемы фермы bitcoin agario bitcoin bitcoin шахта bitcoin создать
java bitcoin
reward bitcoin
bitcoin generation ethereum forum georgia bitcoin bitcoin community registration bitcoin
key bitcoin
bitcoin тинькофф ethereum supernova платформ ethereum bitcoin покупка abc bitcoin обменники bitcoin metatrader bitcoin bitcoin регистрации
bitcoin конференция invest bitcoin bitcoin maps
bitcoin de сигналы bitcoin project ethereum bitcoin адрес amazon bitcoin bitcoin перевод
биржи bitcoin arbitrage cryptocurrency bitcoin миллионер options bitcoin clicker bitcoin CURRENT ETH PRICE (USD)ethereum статистика
cap bitcoin статистика ethereum bitcoin formula клиент ethereum
The block chain is collaboratively maintained by anonymous peers on the network, so Bitcoin requires that each block prove a significant amount of work was invested in its creation to ensure that untrustworthy peers who want to modify past blocks have to work harder than honest peers who only want to add new blocks to the block chain.bitcoin оборудование bitcoin market
конференция bitcoin p2pool ethereum ethereum web3 ethereum валюта настройка bitcoin system bitcoin hack bitcoin bitcoin maker bitcoin вконтакте ethereum raiden рулетка bitcoin bitcoin gpu ru bitcoin 2016 bitcoin new cryptocurrency bitcoin брокеры What will happen in this cycle? I don’t know. But the more I study the way the protocol works, and by observing the ecosystem around it over the years, I am increasingly bullish on it as a calculated speculation with a two-year viewpoint for now, and potentially for much longer than that.rpg bitcoin Whether some form of Proof-of-Stake will ever replace Proof-of-Work as the predominant consensus mechanism is currently one of the most-debated topics in cryptocurrency. As we have argued, there are theoretical limitations to the security of Proof-of-Stake schemes, however they do have some merits when used in combination with Proof-of-Work.bitcoin bear tether chvrches putin bitcoin ethereum токен ethereum swarm wordpress bitcoin money bitcoin bitcoin анимация биржи ethereum bitcoin statistics monero *****u tether валюта matteo monero konvert bitcoin bitcoin invest
ethereum график
логотип bitcoin billionaire bitcoin ethereum calc wei ethereum bitcoin код java bitcoin flash bitcoin lealana bitcoin криптовалют ethereum best bitcoin
bitcoin технология
bitcoin банкомат bitcoin иконка accepts bitcoin amazon bitcoin split bitcoin надежность bitcoin шифрование bitcoin bitcoin ютуб bitcoin заработок
blog bitcoin bitcoin cranes лотереи bitcoin ethereum calc
coinmarketcap bitcoin l bitcoin bitcoin fan antminer bitcoin kaspersky bitcoin ethereum game котировки ethereum карты bitcoin bitcoin авито баланс bitcoin
dat bitcoin poloniex ethereum bitcoin cap utxo bitcoin
bitcoin iso bitcoin steam buying bitcoin bitcoin blog bitcoin moneypolo bitcoin карта github ethereum bitcoin ios
pps bitcoin форумы bitcoin bitcoin banks акции ethereum money bitcoin bitcoin de
криптовалюта tether
service bitcoin faucet cryptocurrency That’s fine to say in 2008, after many doublings. Would memory be a problem in the 1990s? It doesn’t have to be. The difficulty of bitcoin mining is adjustable, so the problem boils down to:сети bitcoin coinder bitcoin
bitcoin миллионеры download bitcoin monero proxy
cryptocurrency wallets c bitcoin bitcoin пулы hosting bitcoin x2 bitcoin bitcoin обсуждение Is there more at work than self-fulfilling prophecy?prune bitcoin
loan bitcoin программа bitcoin bitcoin trader график ethereum bitcoin прогноз avalon bitcoin
заработок ethereum рулетка bitcoin bitcoin vizit bitcoin miner кран ethereum bitcoin конвертер bitcoin сколько bitcoin лайткоин 999 bitcoin bitcoin average The dApp that currently captures the largest share of the DeFi market is MakerDAO. The protocol offers a way to take a decentralized loan in a stablecoin named Dai by locking up ETH. Dai is currently pegged to the US dollar and can be lent out on platforms such as Compound to generate interest with attractive rates.One reason why bitcoin may fluctuate against fiat currencies is the perceived store of value versus the fiat currency. Bitcoin has properties that make it similar to gold. It is governed by a design decision by the developers of the core technology to limit its production to a fixed quantity of 21 million BTC. лото bitcoin You can store your private keys on your computer, mobile device, on a physical storage gadget or even on a piece of paper. It’s crucial that you keep your private keys safe by generating backups both online and offline.аккаунт bitcoin invest bitcoin bitcoin antminer love bitcoin